mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-22 13:05:31 +03:00
Improvements to replies
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
b36c70b783
commit
d166276b80
5 changed files with 50 additions and 23 deletions
|
@ -40,7 +40,7 @@ android {
|
|||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
versionCode 115
|
||||
versionName "8"
|
||||
versionName "8.0.0beta1"
|
||||
|
||||
flavorDimensions "default"
|
||||
renderscriptTargetApi 19
|
||||
|
|
|
@ -38,12 +38,15 @@ import androidx.emoji.widget.EmojiTextView
|
|||
import autodagger.AutoInjector
|
||||
import butterknife.BindView
|
||||
import butterknife.ButterKnife
|
||||
import coil.api.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import com.amulyakhare.textdrawable.TextDrawable
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.DisplayUtils
|
||||
import com.nextcloud.talk.utils.TextMatchers
|
||||
import com.nextcloud.talk.utils.preferences.AppPreferences
|
||||
|
@ -77,7 +80,7 @@ class MagicIncomingTextMessageViewHolder(incomingView: View) : MessageHolders
|
|||
|
||||
@JvmField
|
||||
@BindView(R.id.quotedUserAvatar)
|
||||
var quotedUserAvatar: SimpleDraweeView? = null
|
||||
var quotedUserAvatar: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.quotedMessageAuthor)
|
||||
|
@ -85,7 +88,7 @@ class MagicIncomingTextMessageViewHolder(incomingView: View) : MessageHolders
|
|||
|
||||
@JvmField
|
||||
@BindView(R.id.quotedMessageImage)
|
||||
var quotedMessagePreview: SimpleDraweeView? = null
|
||||
var quotedMessagePreview: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.quotedMessage)
|
||||
|
@ -228,10 +231,15 @@ class MagicIncomingTextMessageViewHolder(incomingView: View) : MessageHolders
|
|||
|
||||
message.parentMessage?.let { parentChatMessage ->
|
||||
parentChatMessage.activeUser = message.activeUser
|
||||
imageLoader.loadImage(quotedUserAvatar!!, parentChatMessage.user.avatar, null)
|
||||
quotedUserAvatar?.load(parentChatMessage.user.avatar) {
|
||||
addHeader("Authorization", ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token))
|
||||
transformations(CircleCropTransformation())
|
||||
}
|
||||
parentChatMessage.imageUrl?.let{
|
||||
quotedMessagePreview?.visibility = View.VISIBLE
|
||||
imageLoader.loadImage(quotedMessagePreview, it, null)
|
||||
quotedMessagePreview?.load(it) {
|
||||
addHeader("Authorization", ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token))
|
||||
}
|
||||
} ?: run {
|
||||
quotedMessagePreview?.visibility = View.GONE
|
||||
}
|
||||
|
|
|
@ -34,12 +34,15 @@ import androidx.emoji.widget.EmojiTextView
|
|||
import autodagger.AutoInjector
|
||||
import butterknife.BindView
|
||||
import butterknife.ButterKnife
|
||||
import coil.api.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import com.facebook.drawee.view.SimpleDraweeView
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication.Companion.sharedApplication
|
||||
import com.nextcloud.talk.models.json.chat.ChatMessage
|
||||
import com.nextcloud.talk.utils.ApiUtils
|
||||
import com.nextcloud.talk.utils.DisplayUtils.getMessageSelector
|
||||
import com.nextcloud.talk.utils.DisplayUtils.searchAndReplaceWithMentionSpan
|
||||
import com.nextcloud.talk.utils.TextMatchers
|
||||
|
@ -63,7 +66,7 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage
|
|||
|
||||
@JvmField
|
||||
@BindView(R.id.quotedUserAvatar)
|
||||
var quotedUserAvatar: SimpleDraweeView? = null
|
||||
var quotedUserAvatar: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.quotedMessageAuthor)
|
||||
|
@ -71,7 +74,7 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage
|
|||
|
||||
@JvmField
|
||||
@BindView(R.id.quotedMessageImage)
|
||||
var quotedMessagePreview: SimpleDraweeView? = null
|
||||
var quotedMessagePreview: ImageView? = null
|
||||
|
||||
@JvmField
|
||||
@BindView(R.id.quotedMessage)
|
||||
|
@ -151,10 +154,15 @@ class MagicOutcomingTextMessageViewHolder(itemView: View) : OutcomingTextMessage
|
|||
|
||||
message.parentMessage?.let { parentChatMessage ->
|
||||
parentChatMessage.activeUser = message.activeUser
|
||||
imageLoader.loadImage(quotedUserAvatar, parentChatMessage.user.avatar, null)
|
||||
quotedUserAvatar?.load(parentChatMessage.user.avatar) {
|
||||
transformations(CircleCropTransformation())
|
||||
addHeader("Authorization", ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token))
|
||||
}
|
||||
parentChatMessage.imageUrl?.let{
|
||||
quotedMessagePreview?.visibility = View.VISIBLE
|
||||
imageLoader.loadImage(quotedMessagePreview, it, null)
|
||||
quotedMessagePreview?.load(it) {
|
||||
addHeader("Authorization", ApiUtils.getCredentials(message.activeUser.username, message.activeUser.token))
|
||||
}
|
||||
} ?: run {
|
||||
quotedMessagePreview?.visibility = View.GONE
|
||||
}
|
||||
|
|
|
@ -840,8 +840,8 @@ class ChatController(args: Bundle) : BaseController(args), MessagesListAdapter
|
|||
}
|
||||
|
||||
messageInput?.setText("")
|
||||
val replyMessageId: Long? = view?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)?.tag as Long?
|
||||
sendMessage(editable, if (view?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)?.visibility == View.VISIBLE) replyMessageId?.toInt() else null )
|
||||
val replyMessageId: Int? = view?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)?.tag as Int
|
||||
sendMessage(editable, if (view?.findViewById<RelativeLayout>(R.id.quotedChatMessageView)?.visibility == View.VISIBLE) replyMessageId else null )
|
||||
cancelReply()
|
||||
}
|
||||
}
|
||||
|
@ -1258,8 +1258,8 @@ class ChatController(args: Bundle) : BaseController(args), MessagesListAdapter
|
|||
@OnClick(R.id.cancelReplyButton)
|
||||
fun cancelReply() {
|
||||
quotedChatMessageView?.visibility = View.GONE
|
||||
messageInputView?.findViewById<ImageButton>(R.id.attachmentButton)?.visibility = View.VISIBLE
|
||||
messageInputView?.findViewById<Space>(R.id.attachmentButtonSpace)?.visibility = View.VISIBLE
|
||||
messageInputView!!.findViewById<ImageButton>(R.id.attachmentButton)?.visibility = View.VISIBLE
|
||||
messageInputView!!.findViewById<Space>(R.id.attachmentButtonSpace)?.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun onMessageViewLongClick(view: View?, message: IMessage?) {
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/quotedChatMessageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/quoteColoredView"
|
||||
|
@ -15,13 +16,10 @@
|
|||
android:layout_marginEnd="4dp"
|
||||
android:background="@color/colorPrimary"></View>
|
||||
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
<ImageView
|
||||
android:id="@+id/quotedUserAvatar"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="8dp"
|
||||
android:scaleType="centerInside"
|
||||
android:adjustViewBounds="true"
|
||||
app:roundAsCircle="true"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_toEndOf="@id/quoteColoredView"
|
||||
|
@ -44,19 +42,20 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/quotedUserAvatar"
|
||||
android:layout_alignStart="@id/quotedUserAvatar"
|
||||
android:layout_toStartOf="@id/cancelReplyButton"
|
||||
android:layout_marginTop="4dp"
|
||||
android:orientation="vertical"
|
||||
app:alignContent="stretch"
|
||||
app:alignItems="stretch"
|
||||
app:flexWrap="wrap"
|
||||
app:justifyContent="flex_end">
|
||||
app:justifyContent="flex_start">
|
||||
|
||||
<com.facebook.drawee.view.SimpleDraweeView
|
||||
<ImageView
|
||||
android:id="@+id/quotedMessageImage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_alignSelf="flex_start"
|
||||
app:layout_flexGrow="1"
|
||||
app:layout_wrapBefore="true"
|
||||
|
@ -87,4 +86,16 @@
|
|||
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
|
||||
<ImageButton
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="@drawable/ic_cancel_black_24dp"
|
||||
android:backgroundTint="@color/grey_600"
|
||||
android:id="@+id/cancelReplyButton"/>
|
||||
|
||||
</RelativeLayout>
|
Loading…
Reference in a new issue