UI changes + bumped com.android.tools.build:gradle version

This commit is contained in:
Sylvain Berfini 2021-05-18 15:02:27 +02:00
parent 4dfaf7eb09
commit 6ab7c47571
30 changed files with 289 additions and 191 deletions

View file

@ -23,9 +23,11 @@ import android.content.ClipData
import android.content.ClipboardManager import android.content.ClipboardManager
import android.content.Context import android.content.Context
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.MenuInflater
import android.view.MenuItem import android.view.MenuItem
import android.view.ViewGroup import android.view.ViewGroup
import androidx.appcompat.widget.PopupMenu import androidx.appcompat.view.menu.MenuBuilder
import androidx.appcompat.view.menu.MenuPopupHelper
import androidx.databinding.DataBindingUtil import androidx.databinding.DataBindingUtil
import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
@ -134,7 +136,7 @@ class ChatMessagesListAdapter(
inner class ChatMessageViewHolder( inner class ChatMessageViewHolder(
val binding: ChatMessageListCellBinding val binding: ChatMessageListCellBinding
) : RecyclerView.ViewHolder(binding.root), PopupMenu.OnMenuItemClickListener { ) : RecyclerView.ViewHolder(binding.root) {
fun bind(eventLog: EventLog) { fun bind(eventLog: EventLog) {
with(binding) { with(binding) {
if (eventLog.type == EventLog.Type.ConferenceChatMessage) { if (eventLog.type == EventLog.Type.ConferenceChatMessage) {
@ -192,61 +194,66 @@ class ChatMessagesListAdapter(
if (contextMenuDisabled) return if (contextMenuDisabled) return
setContextMenuClickListener { setContextMenuClickListener {
val popup = PopupMenu(root.context, background) val builder = MenuBuilder(root.context)
popup.setOnMenuItemClickListener(this@ChatMessageViewHolder) val popupMenu = MenuPopupHelper(root.context, builder, background)
popup.inflate(R.menu.chat_message_menu) popupMenu.setForceShowIcon(true)
MenuInflater(root.context).inflate(R.menu.chat_message_menu, builder)
if (chatMessage.chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) || if (chatMessage.chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) ||
chatMessage.state == ChatMessage.State.NotDelivered) { // No message id chatMessage.state == ChatMessage.State.NotDelivered) { // No message id
popup.menu.removeItem(R.id.chat_message_menu_imdn_infos) builder.removeItem(R.id.chat_message_menu_imdn_infos)
} }
if (chatMessage.state != ChatMessage.State.NotDelivered) { if (chatMessage.state != ChatMessage.State.NotDelivered) {
popup.menu.removeItem(R.id.chat_message_menu_resend) builder.removeItem(R.id.chat_message_menu_resend)
} }
if (chatMessage.contents.find { content -> content.isText } == null) { if (chatMessage.contents.find { content -> content.isText } == null) {
popup.menu.removeItem(R.id.chat_message_menu_copy_text) builder.removeItem(R.id.chat_message_menu_copy_text)
} }
if (chatMessageViewModel.contact.value != null) { if (chatMessage.isOutgoing || chatMessageViewModel.contact.value != null) {
popup.menu.removeItem(R.id.chat_message_menu_add_to_contacts) builder.removeItem(R.id.chat_message_menu_add_to_contacts)
} }
popup.show() builder.setCallback(object : MenuBuilder.Callback {
override fun onMenuModeChange(menu: MenuBuilder) {}
override fun onMenuItemSelected(menu: MenuBuilder, item: MenuItem): Boolean {
return when (item.itemId) {
R.id.chat_message_menu_imdn_infos -> {
showImdnDeliveryFragment()
true
}
R.id.chat_message_menu_resend -> {
resendMessage()
true
}
R.id.chat_message_menu_copy_text -> {
copyTextToClipboard()
true
}
R.id.chat_message_forward_message -> {
forwardMessage()
true
}
R.id.chat_message_menu_delete_message -> {
deleteMessage()
true
}
R.id.chat_message_menu_add_to_contacts -> {
addSenderToContacts()
true
}
else -> false
}
}
})
popupMenu.show()
true true
} }
} }
} }
} }
override fun onMenuItemClick(item: MenuItem): Boolean {
return when (item.itemId) {
R.id.chat_message_menu_imdn_infos -> {
showImdnDeliveryFragment()
true
}
R.id.chat_message_menu_resend -> {
resendMessage()
true
}
R.id.chat_message_menu_copy_text -> {
copyTextToClipboard()
true
}
R.id.chat_message_forward_message -> {
forwardMessage()
true
}
R.id.chat_message_menu_delete_message -> {
deleteMessage()
true
}
R.id.chat_message_menu_add_to_contacts -> {
addSenderToContacts()
true
}
else -> false
}
}
private fun resendMessage() { private fun resendMessage() {
val chatMessage = binding.data?.chatMessage val chatMessage = binding.data?.chatMessage
if (chatMessage != null) { if (chatMessage != null) {

View file

@ -32,6 +32,8 @@ class ChatMessageAttachmentData(
val fileName: String = FileUtils.getNameFromFilePath(path) val fileName: String = FileUtils.getNameFromFilePath(path)
val isImage: Boolean = FileUtils.isExtensionImage(path) val isImage: Boolean = FileUtils.isExtensionImage(path)
val isVideo: Boolean = FileUtils.isExtensionVideo(path) val isVideo: Boolean = FileUtils.isExtensionVideo(path)
val isAudio: Boolean = FileUtils.isExtensionAudio(path)
val isPdf: Boolean = FileUtils.isExtensionPdf(path)
val videoPreview = MutableLiveData<Bitmap>() val videoPreview = MutableLiveData<Bitmap>()
private val scope = CoroutineScope(Dispatchers.Main + SupervisorJob()) private val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())

View file

@ -22,6 +22,7 @@ package org.linphone.activities.main.chat.data
import android.graphics.Bitmap import android.graphics.Bitmap
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import kotlinx.coroutines.* import kotlinx.coroutines.*
import org.linphone.R
import org.linphone.core.ChatMessage import org.linphone.core.ChatMessage
import org.linphone.core.ChatMessageListenerStub import org.linphone.core.ChatMessageListenerStub
import org.linphone.core.Content import org.linphone.core.Content
@ -39,18 +40,17 @@ class ChatMessageContentData(
val isVideo = MutableLiveData<Boolean>() val isVideo = MutableLiveData<Boolean>()
val isAudio = MutableLiveData<Boolean>() val isAudio = MutableLiveData<Boolean>()
val videoPreview = MutableLiveData<Bitmap>() val videoPreview = MutableLiveData<Bitmap>()
val isPdf = MutableLiveData<Boolean>()
val isGenericFile = MutableLiveData<Boolean>()
val fileName = MutableLiveData<String>() val fileName = MutableLiveData<String>()
val filePath = MutableLiveData<String>() val filePath = MutableLiveData<String>()
val fileSize = MutableLiveData<String>() val fileSize = MutableLiveData<String>()
val downloadable = MutableLiveData<Boolean>() val downloadable = MutableLiveData<Boolean>()
val downloadEnabled = MutableLiveData<Boolean>() val downloadEnabled = MutableLiveData<Boolean>()
val downloadProgress = MutableLiveData<Int>() val downloadProgress = MutableLiveData<Int>()
val downloadLabel = MutableLiveData<String>()
val isAlone: Boolean val isAlone: Boolean
get() { get() {
@ -97,6 +97,7 @@ class ChatMessageContentData(
content.name content.name
} }
fileSize.value = AppUtils.bytesToDisplayableSize(content.fileSize.toLong()) fileSize.value = AppUtils.bytesToDisplayableSize(content.fileSize.toLong())
downloadLabel.value = "${AppUtils.getString(R.string.chat_message_download_file)} (${fileSize.value})"
if (content.isFile || (content.isFileTransfer && chatMessage.isOutgoing)) { if (content.isFile || (content.isFileTransfer && chatMessage.isOutgoing)) {
val path = if (content.isFileEncrypted) content.plainFilePath else content.filePath ?: "" val path = if (content.isFileEncrypted) content.plainFilePath else content.filePath ?: ""
@ -108,6 +109,7 @@ class ChatMessageContentData(
isImage.value = FileUtils.isExtensionImage(path) isImage.value = FileUtils.isExtensionImage(path)
isVideo.value = FileUtils.isExtensionVideo(path) isVideo.value = FileUtils.isExtensionVideo(path)
isAudio.value = FileUtils.isExtensionAudio(path) isAudio.value = FileUtils.isExtensionAudio(path)
isPdf.value = FileUtils.isExtensionPdf(path)
if (isVideo.value == true) { if (isVideo.value == true) {
scope.launch { scope.launch {
@ -121,14 +123,17 @@ class ChatMessageContentData(
isImage.value = false isImage.value = false
isVideo.value = false isVideo.value = false
isAudio.value = false isAudio.value = false
isPdf.value = false
} }
} else { } else {
downloadable.value = true downloadable.value = true
isImage.value = false isImage.value = FileUtils.isExtensionImage(fileName.value!!)
isVideo.value = false isVideo.value = FileUtils.isExtensionVideo(fileName.value!!)
isAudio.value = false isAudio.value = FileUtils.isExtensionAudio(fileName.value!!)
isPdf.value = FileUtils.isExtensionPdf(fileName.value!!)
} }
isGenericFile.value = !isPdf.value!! && !isAudio.value!! && !isVideo.value!! && !isImage.value!!
downloadEnabled.value = !chatMessage.isFileTransferInProgress downloadEnabled.value = !chatMessage.isFileTransferInProgress
downloadProgress.value = 0 downloadProgress.value = 0
chatMessage.addListener(chatMessageListener) chatMessage.addListener(chatMessageListener)

View file

@ -132,10 +132,8 @@ class CorePreferences constructor(private val context: Context) {
/* Chat */ /* Chat */
// iOS and Android 4.4.x releases currently can't display more than 1 file per message
// TODO: Remove for the release, this won't be necessary anymore
var preventMoreThanOneFilePerMessage: Boolean var preventMoreThanOneFilePerMessage: Boolean
get() = config.getBool("app", "prevent_more_than_one_file_per_message", true) get() = config.getBool("app", "prevent_more_than_one_file_per_message", false)
set(value) { set(value) {
config.setBool("app", "prevent_more_than_one_file_per_message", value) config.setBool("app", "prevent_more_than_one_file_per_message", value)
} }

View file

@ -92,6 +92,7 @@ fun ImageView.setImageMaxHeight(dimension: Float) {
@BindingAdapter("android:layout_size") @BindingAdapter("android:layout_size")
fun View.setLayoutSize(dimension: Float) { fun View.setLayoutSize(dimension: Float) {
if (dimension == 0f) return
this.layoutParams.height = dimension.toInt() this.layoutParams.height = dimension.toInt()
this.layoutParams.width = dimension.toInt() this.layoutParams.width = dimension.toInt()
} }
@ -304,6 +305,11 @@ fun <T> setEntries(
setEntries(viewGroup, entries, layoutId, null, parent) setEntries(viewGroup, entries, layoutId, null, parent)
} }
@BindingAdapter("android:scaleType")
fun setImageViewScaleType(imageView: ImageView, scaleType: ImageView.ScaleType) {
imageView.scaleType = scaleType
}
@BindingAdapter("glideAvatarFallback") @BindingAdapter("glideAvatarFallback")
fun loadAvatarWithGlideFallback(imageView: ImageView, path: String?) { fun loadAvatarWithGlideFallback(imageView: ImageView, path: String?) {
if (path != null && path.isNotEmpty() && FileUtils.isExtensionImage(path)) { if (path != null && path.isNotEmpty() && FileUtils.isExtensionImage(path)) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<bitmap android:src="@drawable/file_default"
android:tint="?attr/drawableTintOverColor"/>
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/file_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item>
<bitmap android:src="@drawable/file_default"
android:tint="?attr/drawableTintColor"/>
</item>
</selector>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<bitmap android:src="@drawable/file_audio_default"
android:tint="?attr/drawableTintOverColor"/>
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/file_audio_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item>
<bitmap android:src="@drawable/file_audio_default"
android:tint="?attr/drawableTintColor"/>
</item>
</selector>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<bitmap android:src="@drawable/file_pdf_default"
android:tint="?attr/drawableTintOverColor"/>
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/file_pdf_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item>
<bitmap android:src="@drawable/file_pdf_default"
android:tint="?attr/drawableTintColor"/>
</item>
</selector>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<bitmap android:src="@drawable/file_picture_default"
android:tint="?attr/drawableTintOverColor"/>
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/file_picture_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item>
<bitmap android:src="@drawable/file_picture_default"
android:tint="?attr/drawableTintColor"/>
</item>
</selector>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<bitmap android:src="@drawable/file_video_default"
android:tint="?attr/drawableTintOverColor"/>
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/file_video_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item>
<bitmap android:src="@drawable/file_video_default"
android:tint="?attr/drawableTintColor"/>
</item>
</selector>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<bitmap android:src="@drawable/menu_copy_text_default"
android:tint="?attr/drawableTintOverColor"/>
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/menu_copy_text_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item>
<bitmap android:src="@drawable/menu_copy_text_default"
android:tint="?attr/drawableTintColor"/>
</item>
</selector>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<bitmap android:src="@drawable/menu_delete_default"
android:tint="?attr/drawableTintOverColor"/>
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/menu_delete_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item>
<bitmap android:src="@drawable/menu_delete_default"
android:tint="?attr/drawableTintColor"/>
</item>
</selector>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<bitmap android:src="@drawable/menu_forward_default"
android:tint="?attr/drawableTintOverColor"/>
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/menu_forward_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item>
<bitmap android:src="@drawable/menu_forward_default"
android:tint="?attr/drawableTintColor"/>
</item>
</selector>

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<bitmap android:src="@drawable/menu_imdn_info_default"
android:tint="?attr/drawableTintOverColor"/>
</item>
<item android:state_enabled="false">
<bitmap android:src="@drawable/menu_imdn_info_default"
android:tint="?attr/drawableTintDisabledColor"/>
</item>
<item>
<bitmap android:src="@drawable/menu_imdn_info_default"
android:tint="?attr/drawableTintColor"/>
</item>
</selector>

View file

@ -10,37 +10,31 @@
</data> </data>
<RelativeLayout <RelativeLayout
android:layout_width="wrap_content" android:layout_width="110dp"
android:layout_height="100dp" android:layout_height="110dp"
android:layout_margin="5dp" android:layout_margin="5dp"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <ImageView
android:id="@+id/pendingImageForUpload"
android:visibility="@{data.image ? View.VISIBLE : View.GONE}" android:visibility="@{data.image ? View.VISIBLE : View.GONE}"
android:contentDescription="@string/content_description_pending_file_transfer" android:contentDescription="@string/content_description_pending_file_transfer"
android:layout_width="wrap_content" android:layout_width="100dp"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerCrop"
app:glidePath="@{data.path}"/> app:glidePath="@{data.path}"/>
<ImageView <ImageView
android:visibility="@{data.image ? View.VISIBLE : View.GONE}" android:visibility="@{data.video ? View.VISIBLE : View.GONE}"
android:onClick="@{() -> data.delete()}"
android:contentDescription="@string/content_description_remove_pending_file_transfer"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignTop="@id/pendingImageForUpload"
android:layout_alignRight="@id/pendingImageForUpload"
android:src="@drawable/field_clean" />
<ImageView
android:id="@+id/pendingVideoForUpload"
android:visibility="@{data.video ? View.VISIBLE : View.GONE, default=gone}"
android:contentDescription="@string/content_description_pending_file_transfer" android:contentDescription="@string/content_description_pending_file_transfer"
android:layout_width="wrap_content" android:layout_width="100dp"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@{data.videoPreview}"/> android:src="@{data.videoPreview}"/>
<ImageView <ImageView
@ -51,36 +45,39 @@
android:contentDescription="@string/content_description_chat_message_video_attachment" android:contentDescription="@string/content_description_chat_message_video_attachment"
android:layout_centerInParent="true"/> android:layout_centerInParent="true"/>
<ImageView <LinearLayout
android:visibility="@{data.video ? View.VISIBLE : View.GONE, default=gone}" android:layout_width="100dp"
android:onClick="@{() -> data.delete()}" android:layout_height="100dp"
android:contentDescription="@string/content_description_remove_pending_file_transfer" android:layout_alignParentBottom="true"
android:layout_width="20dp" android:layout_alignParentLeft="true"
android:layout_height="20dp" android:orientation="vertical"
android:layout_alignTop="@id/pendingVideoForUpload"
android:layout_alignRight="@id/pendingVideoForUpload"
android:src="@drawable/field_clean" />
<TextView
android:id="@+id/pendingFileForUpload"
android:visibility="@{data.image || data.video ? View.GONE : View.VISIBLE, default=gone}"
android:text="@{data.fileName}"
android:textColor="?attr/secondaryTextColor"
android:textSize="21sp"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:textAlignment="center" /> android:background="?attr/backgroundColor"
android:visibility="@{data.image || data.video ? View.GONE : View.VISIBLE}">
<TextView
style="@style/chat_file_attachment_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:ellipsize="middle"
android:singleLine="true"
android:padding="10dp"
android:gravity="center"
android:textAlignment="center"
android:drawablePadding="5dp"
android:drawableTop="@{data.pdf ? @drawable/file_pdf : (data.audio ? @drawable/file_audio : @drawable/file), default=@drawable/file}"
android:text="@{data.fileName, default=`test.txt`}"/>
</LinearLayout>
<ImageView <ImageView
android:visibility="@{data.image || data.video ? View.GONE : View.VISIBLE, default=gone}"
android:onClick="@{() -> data.delete()}" android:onClick="@{() -> data.delete()}"
android:contentDescription="@string/content_description_remove_pending_file_transfer" android:contentDescription="@string/content_description_remove_pending_file_transfer"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:layout_alignTop="@id/pendingFileForUpload" android:layout_alignParentTop="true"
android:layout_alignRight="@id/pendingFileForUpload" android:layout_alignParentRight="true"
android:src="@drawable/field_clean" /> android:src="@drawable/field_clean" />
</RelativeLayout> </RelativeLayout>

View file

@ -4,6 +4,7 @@
<data> <data>
<import type="android.view.View"/> <import type="android.view.View"/>
<import type="android.widget.ImageView.ScaleType"/>
<variable <variable
name="data" name="data"
type="org.linphone.activities.main.chat.data.ChatMessageContentData" /> type="org.linphone.activities.main.chat.data.ChatMessageContentData" />
@ -14,7 +15,8 @@
<RelativeLayout <RelativeLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_margin="5dp">
<ImageView <ImageView
android:onClick="@{() -> data.openFile()}" android:onClick="@{() -> data.openFile()}"
@ -22,10 +24,11 @@
android:contentDescription="@string/content_description_downloaded_file_transfer" android:contentDescription="@string/content_description_downloaded_file_transfer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxHeight="@{data.alone ? @dimen/chat_message_bubble_image_height_big : @dimen/chat_message_bubble_image_height_small}" android:maxHeight="@dimen/chat_message_bubble_image_height_big"
android:layout_margin="5dp" android:layout_size="@{data.alone ? 0f : @dimen/chat_message_bubble_file_size}"
app:glidePath="@{data.filePath}" app:glidePath="@{data.filePath}"
android:visibility="@{data.image ? View.VISIBLE : View.GONE}" android:visibility="@{data.image ? View.VISIBLE : View.GONE}"
android:scaleType="@{data.alone ? ScaleType.FIT_CENTER : ScaleType.CENTER_CROP}"
android:adjustViewBounds="true" /> android:adjustViewBounds="true" />
<ImageView <ImageView
@ -34,115 +37,52 @@
android:contentDescription="@string/content_description_downloaded_file_transfer" android:contentDescription="@string/content_description_downloaded_file_transfer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxHeight="@{data.alone ? @dimen/chat_message_bubble_image_height_big : @dimen/chat_message_bubble_image_height_small}" android:maxHeight="@dimen/chat_message_bubble_image_height_big"
android:layout_margin="5dp" android:layout_size="@{data.alone ? 0f : @dimen/chat_message_bubble_file_size}"
android:src="@{data.videoPreview}" android:src="@{data.videoPreview}"
android:visibility="@{data.video ? View.VISIBLE : View.GONE, default=gone}" android:visibility="@{data.video ? View.VISIBLE : View.GONE}"
android:scaleType="@{data.alone ? ScaleType.FIT_CENTER : ScaleType.CENTER_CROP}"
android:adjustViewBounds="true" /> android:adjustViewBounds="true" />
<ImageView <ImageView
android:visibility="@{data.video ? View.VISIBLE : View.GONE, default=gone}" android:visibility="@{data.video ? View.VISIBLE : View.GONE}"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:src="@drawable/recording_play_pause" android:src="@drawable/recording_play_pause"
android:contentDescription="@string/content_description_chat_message_video_attachment" android:contentDescription="@string/content_description_chat_message_video_attachment"
android:layout_centerInParent="true"/> android:layout_centerInParent="true"/>
<TextView
style="@style/chat_file_attachment_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="end"
android:padding="10dp"
android:gravity="center_vertical"
android:text="@{data.fileName}"
android:onClick="@{() -> data.openFile()}"
android:onLongClick="@{longClickListener}"
android:visibility="@{data.downloadable || data.image || data.video || !data.alone ? View.GONE : View.VISIBLE, default=gone}"
android:drawablePadding="10dp"
app:drawableTint="@color/dark_grey_color"
android:drawableLeft="@{data.isAudio ? @drawable/audio : @drawable/file}"/>
<TextView
style="@style/chat_file_attachment_font"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:maxHeight="100dp"
android:layout_margin="5dp"
android:ellipsize="end"
android:padding="10dp"
android:gravity="center"
android:textAlignment="center"
android:text="@{data.fileName}"
android:onClick="@{() -> data.openFile()}"
android:onLongClick="@{longClickListener}"
android:visibility="@{data.downloadable || data.image || data.video || data.alone ? View.GONE : View.VISIBLE, default=gone}"
android:drawablePadding="10dp"
app:drawableTint="@color/dark_grey_color"
android:drawableTop="@{data.isAudio ? @drawable/audio : @drawable/file}"/>
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="@dimen/chat_message_bubble_file_size"
android:layout_height="wrap_content" android:layout_height="@dimen/chat_message_bubble_file_size"
android:orientation="horizontal" android:orientation="vertical"
android:gravity="center" android:gravity="center"
android:background="@drawable/resizable_assistant_button" android:background="?attr/backgroundColor"
android:layout_margin="5dp" android:visibility="@{data.downloadable || data.pdf || data.audio || data.genericFile ? View.VISIBLE : View.GONE}">
android:visibility="@{data.downloadable ? View.VISIBLE : View.GONE}"
android:onClick="@{() -> data.download()}"
android:onLongClick="@{longClickListener}"
android:enabled="@{data.downloadEnabled}">
<ImageView <TextView
style="@style/chat_file_attachment_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:ellipsize="middle"
android:singleLine="true"
android:padding="10dp"
android:gravity="center"
android:textAlignment="center"
android:drawablePadding="5dp"
android:drawableTop="@{data.video ? @drawable/file_video : (data.image ? @drawable/file_picture : (data.pdf ? @drawable/file_pdf : (data.audio ? @drawable/file_audio : @drawable/file))), default=@drawable/file}"
android:text="@{data.fileName, default=`test.pdf`}"
android:onClick="@{() -> data.downloadable ? data.download() : data.openFile()}"
android:onLongClick="@{longClickListener}"/>
<TextView
style="@style/chat_file_attachment_font"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:contentDescription="@string/chat_message_download_file" android:text="@{data.downloadLabel}"
android:padding="5dp" android:onClick="@{() -> data.download()}"
android:src="@drawable/download" /> android:visibility="@{data.downloadable ? View.VISIBLE : View.GONE}"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp">
<TextView
style="@style/button_small_font"
android:text="@{data.fileName}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:textColor="@drawable/assistant_button_text_color" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
style="@style/button_tiny_font"
android:text="@{data.fileSize}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:textColor="@drawable/assistant_button_text_color" />
<ProgressBar
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:max="100"
android:visibility="@{data.downloadProgress > 0 ? View.VISIBLE : View.GONE, default=gone}"
android:progress="@{data.downloadProgress, default=50}"/>
</LinearLayout>
</LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -150,7 +150,7 @@
<HorizontalScrollView <HorizontalScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/darkToolbarBackgroundColor" android:background="?attr/lightToolbarBackgroundColor"
android:orientation="horizontal"> android:orientation="horizontal">
<LinearLayout <LinearLayout

View file

@ -3,26 +3,32 @@
<item <item
android:id="@+id/chat_message_menu_resend" android:id="@+id/chat_message_menu_resend"
android:icon="@drawable/chat_send_message"
android:title="@string/chat_message_context_menu_resend" /> android:title="@string/chat_message_context_menu_resend" />
<item <item
android:id="@+id/chat_message_menu_copy_text" android:id="@+id/chat_message_menu_copy_text"
android:icon="@drawable/menu_copy_text"
android:title="@string/chat_message_context_menu_copy_text" /> android:title="@string/chat_message_context_menu_copy_text" />
<item <item
android:id="@+id/chat_message_forward_message" android:id="@+id/chat_message_forward_message"
android:icon="@drawable/menu_forward"
android:title="@string/chat_message_context_menu_forward" /> android:title="@string/chat_message_context_menu_forward" />
<item <item
android:id="@+id/chat_message_menu_imdn_infos" android:id="@+id/chat_message_menu_imdn_infos"
android:icon="@drawable/menu_imdn_info"
android:title="@string/chat_message_context_menu_imdn_info" /> android:title="@string/chat_message_context_menu_imdn_info" />
<item <item
android:id="@+id/chat_message_menu_delete_message" android:id="@+id/chat_message_menu_delete_message"
android:icon="@drawable/menu_delete"
android:title="@string/chat_message_context_menu_delete" /> android:title="@string/chat_message_context_menu_delete" />
<item <item
android:id="@+id/chat_message_menu_add_to_contacts" android:id="@+id/chat_message_menu_add_to_contacts"
android:icon="@drawable/contact_add_default"
android:title="@string/chat_message_context_menu_add_to_contacts" /> android:title="@string/chat_message_context_menu_add_to_contacts" />
</menu> </menu>

View file

@ -7,6 +7,8 @@
<dimen name="outgoing_chat_message_bubble_right_margin">3dp</dimen> <dimen name="outgoing_chat_message_bubble_right_margin">3dp</dimen>
<dimen name="chat_message_bubble_image_height_big">200dp</dimen> <dimen name="chat_message_bubble_image_height_big">200dp</dimen>
<dimen name="chat_message_bubble_image_height_small">100dp</dimen> <dimen name="chat_message_bubble_image_height_small">100dp</dimen>
<dimen name="chat_message_bubble_file_size">150dp</dimen>
<dimen name="chat_message_bubble_file_icon_size">30dp</dimen>
<dimen name="chat_message_bubble_desired_height">600dp</dimen> <dimen name="chat_message_bubble_desired_height">600dp</dimen>
<dimen name="video_preview_max_size">200dp</dimen> <dimen name="video_preview_max_size">200dp</dimen>
<dimen name="video_preview_pip_max_size">50dp</dimen> <dimen name="video_preview_pip_max_size">50dp</dimen>

View file

@ -225,7 +225,7 @@
</style> </style>
<style name="chat_file_attachment_font" parent="@android:style/TextAppearance.Medium"> <style name="chat_file_attachment_font" parent="@android:style/TextAppearance.Medium">
<item name="android:textColor">@color/dark_grey_color</item> <item name="android:textColor">?attr/primaryTextColor</item>
<item name="android:textSize">12sp</item> <item name="android:textSize">12sp</item>
<item name="android:fontFamily">sans-serif</item> <item name="android:fontFamily">sans-serif</item>
</style> </style>

View file

@ -12,7 +12,7 @@ buildscript {
maven { url "https://www.jitpack.io" } // for com.github.chrisbanes:PhotoView maven { url "https://www.jitpack.io" } // for com.github.chrisbanes:PhotoView
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.2.0' classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.google.gms:google-services:4.3.5' classpath 'com.google.gms:google-services:4.3.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jlleitschuh.gradle:ktlint-gradle:9.1.1" classpath "org.jlleitschuh.gradle:ktlint-gradle:9.1.1"