mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-27 13:13:43 +00:00
Fix emoji picker weird scrolling in RTL.
This commit is contained in:
@@ -34,6 +34,7 @@ import org.thoughtcrime.securesms.keyboard.emoji.toMappingModels
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.reactions.any.ReactWithAnyEmojiBottomSheetDialogFragment
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.ViewUtil
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingModel
|
||||
|
||||
class StoryReplyComposer @JvmOverloads constructor(
|
||||
@@ -47,7 +48,6 @@ class StoryReplyComposer @JvmOverloads constructor(
|
||||
private val emojiDrawer: MediaKeyboard
|
||||
private val reactionEmojiView: EmojiPageView
|
||||
private val anyReactionView: View
|
||||
private val emojiBar: View
|
||||
private val bubbleView: ViewGroup
|
||||
|
||||
val input: ComposeText
|
||||
@@ -70,7 +70,6 @@ class StoryReplyComposer @JvmOverloads constructor(
|
||||
emojiDrawer = findViewById(R.id.emoji_drawer)
|
||||
anyReactionView = findViewById(R.id.any_reaction)
|
||||
reactionEmojiView = findViewById(R.id.reaction_emoji_view)
|
||||
emojiBar = findViewById(R.id.emoji_bar)
|
||||
bubbleView = findViewById(R.id.bubble)
|
||||
|
||||
val reply: View = findViewById(R.id.reply)
|
||||
@@ -213,19 +212,13 @@ class StoryReplyComposer @JvmOverloads constructor(
|
||||
val numItems = reactionEmojiView.adapter?.itemCount ?: 0
|
||||
|
||||
decoration.firstItemOffset = anyReactionView.marginEnd
|
||||
|
||||
if (numItems > maxNumItems) {
|
||||
decoration.horizontalSpacing = 0
|
||||
reactionEmojiView.invalidateItemDecorations()
|
||||
decoration.horizontalSpacing = if (numItems > maxNumItems) {
|
||||
0
|
||||
} else {
|
||||
decoration.horizontalSpacing = (availableWidth - (numItems * emojiItemWidth)) / numItems
|
||||
reactionEmojiView.invalidateItemDecorations()
|
||||
(availableWidth - (numItems * emojiItemWidth)) / numItems
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
|
||||
super.onLayout(changed, left, top, right, bottom)
|
||||
updateEmojiSpacing()
|
||||
reactionEmojiView.invalidateItemDecorations()
|
||||
}
|
||||
|
||||
interface Callback {
|
||||
@@ -243,11 +236,20 @@ class StoryReplyComposer @JvmOverloads constructor(
|
||||
|
||||
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
|
||||
super.getItemOffsets(outRect, view, parent, state)
|
||||
outRect.right = horizontalSpacing
|
||||
if (parent.getChildAdapterPosition(view) == 0) {
|
||||
outRect.left = firstItemOffset
|
||||
if (ViewUtil.isRtl(view)) {
|
||||
outRect.left = horizontalSpacing
|
||||
if (parent.getChildAdapterPosition(view) == 0) {
|
||||
outRect.right = firstItemOffset
|
||||
} else {
|
||||
outRect.right = 0
|
||||
}
|
||||
} else {
|
||||
outRect.left = 0
|
||||
outRect.right = horizontalSpacing
|
||||
if (parent.getChildAdapterPosition(view) == 0) {
|
||||
outRect.left = firstItemOffset
|
||||
} else {
|
||||
outRect.left = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user