mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-06 14:27:24 +00:00
add reactions for LocationMessageViewHolders
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
c4de77ce00
commit
73d50c4f0e
@ -78,6 +78,8 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) : Mess
|
||||
@Inject
|
||||
var appPreferences: AppPreferences? = null
|
||||
|
||||
lateinit var reactionsInterface: ReactionsInterface
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBind(message: ChatMessage) {
|
||||
super.onBind(message)
|
||||
@ -93,13 +95,18 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) : Mess
|
||||
val textSize = context?.resources!!.getDimension(R.dimen.chat_text_size)
|
||||
binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
||||
binding.messageText.text = message.text
|
||||
binding.messageText.isEnabled = false
|
||||
|
||||
// parent message handling
|
||||
setParentMessageDataOnMessageItem(message)
|
||||
|
||||
// geo-location
|
||||
setLocationDataOnMessageItem(message)
|
||||
|
||||
Reaction().showReactions(message, binding.reactions, context!!)
|
||||
|
||||
binding.reactions.reactionsEmojiWrapper.setOnClickListener {
|
||||
reactionsInterface.onClickReactions(message)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setAvatarAndAuthorOnMessageItem(message: ChatMessage) {
|
||||
@ -270,6 +277,10 @@ class IncomingLocationMessageViewHolder(incomingView: View, payload: Any) : Mess
|
||||
return locationGeoLink.replace("geo:", "geo:0,0?q=")
|
||||
}
|
||||
|
||||
fun assignReactionInterface(reactionsInterface: ReactionsInterface) {
|
||||
this.reactionsInterface = reactionsInterface
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "LocInMessageView"
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ import android.widget.Toast
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.core.view.ViewCompat
|
||||
import autodagger.AutoInjector
|
||||
import coil.load
|
||||
import com.google.android.flexbox.FlexboxLayout
|
||||
import com.nextcloud.talk.R
|
||||
import com.nextcloud.talk.application.NextcloudTalkApplication
|
||||
@ -68,6 +67,8 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders
|
||||
@Inject
|
||||
var context: Context? = null
|
||||
|
||||
lateinit var reactionsInterface: ReactionsInterface
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBind(message: ChatMessage) {
|
||||
super.onBind(message)
|
||||
@ -84,7 +85,6 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders
|
||||
binding.messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize)
|
||||
binding.messageTime.layoutParams = layoutParams
|
||||
binding.messageText.text = message.text
|
||||
binding.messageText.isEnabled = false
|
||||
|
||||
// parent message handling
|
||||
setParentMessageDataOnMessageItem(message)
|
||||
@ -112,6 +112,12 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders
|
||||
|
||||
// geo-location
|
||||
setLocationDataOnMessageItem(message)
|
||||
|
||||
Reaction().showReactions(message, binding.reactions, context!!)
|
||||
|
||||
binding.reactions.reactionsEmojiWrapper.setOnClickListener {
|
||||
reactionsInterface.onClickReactions(message)
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetJavaScriptEnabled", "ClickableViewAccessibility")
|
||||
@ -245,6 +251,10 @@ class OutcomingLocationMessageViewHolder(incomingView: View) : MessageHolders
|
||||
return locationGeoLink.replace("geo:", "geo:0,0?q=")
|
||||
}
|
||||
|
||||
fun assignReactionInterface(reactionsInterface: ReactionsInterface) {
|
||||
this.reactionsInterface = reactionsInterface
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "LocOutMessageView"
|
||||
}
|
||||
|
@ -53,12 +53,19 @@ public class TalkMessagesListAdapter<M extends IMessage> extends MessagesListAda
|
||||
((MagicIncomingTextMessageViewHolder) holder).assignReactionInterface(chatController);
|
||||
} else if (holder instanceof MagicOutcomingTextMessageViewHolder) {
|
||||
((MagicOutcomingTextMessageViewHolder) holder).assignReactionInterface(chatController);
|
||||
|
||||
} else if (holder instanceof IncomingLocationMessageViewHolder) {
|
||||
((IncomingLocationMessageViewHolder) holder).assignReactionInterface(chatController);
|
||||
} else if (holder instanceof OutcomingLocationMessageViewHolder) {
|
||||
((OutcomingLocationMessageViewHolder) holder).assignReactionInterface(chatController);
|
||||
|
||||
} else if (holder instanceof IncomingVoiceMessageViewHolder) {
|
||||
((IncomingVoiceMessageViewHolder) holder).assignVoiceMessageInterface(chatController);
|
||||
((IncomingVoiceMessageViewHolder) holder).assignReactionInterface(chatController);
|
||||
} else if (holder instanceof OutcomingVoiceMessageViewHolder) {
|
||||
((OutcomingVoiceMessageViewHolder) holder).assignVoiceMessageInterface(chatController);
|
||||
((OutcomingVoiceMessageViewHolder) holder).assignReactionInterface(chatController);
|
||||
|
||||
} else if (holder instanceof MagicPreviewMessageViewHolder) {
|
||||
((MagicPreviewMessageViewHolder) holder).assignPreviewMessageInterface(chatController);
|
||||
((MagicPreviewMessageViewHolder) holder).assignReactionInterface(chatController);
|
||||
|
@ -76,7 +76,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:textAlignment="viewStart"
|
||||
android:textIsSelectable="true"
|
||||
android:textIsSelectable="false"
|
||||
app:layout_alignSelf="flex_start"
|
||||
app:layout_flexGrow="1"
|
||||
app:layout_wrapBefore="true" />
|
||||
@ -89,5 +89,8 @@
|
||||
android:layout_marginStart="8dp"
|
||||
app:layout_alignSelf="center" />
|
||||
|
||||
<include
|
||||
android:id="@+id/reactions"
|
||||
layout="@layout/reactions_inside_message" />
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
</RelativeLayout>
|
||||
|
@ -59,7 +59,7 @@
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColorHighlight="@color/nc_grey"
|
||||
android:textIsSelectable="true"
|
||||
android:textIsSelectable="false"
|
||||
tools:text="Talk to you later!" />
|
||||
|
||||
<TextView
|
||||
@ -80,5 +80,8 @@
|
||||
app:layout_alignSelf="center"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<include
|
||||
android:id="@+id/reactions"
|
||||
layout="@layout/reactions_inside_message" />
|
||||
</com.google.android.flexbox.FlexboxLayout>
|
||||
</RelativeLayout>
|
||||
|
Loading…
Reference in New Issue
Block a user