mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 12:38:33 +00:00
Multiple skin tones for reaction bursts.
This commit is contained in:
committed by
Greyson Parrelli
parent
fa32b7a883
commit
00a91e32fc
@@ -498,7 +498,7 @@ class StoryViewerPageFragment :
|
||||
childFragmentManager.setFragmentResultListener(StoryDirectReplyDialogFragment.REQUEST_EMOJI, viewLifecycleOwner) { _, bundle ->
|
||||
val emoji = bundle.getString(StoryDirectReplyDialogFragment.REQUEST_EMOJI)
|
||||
if (emoji != null) {
|
||||
reactionAnimationView.playForEmoji(emoji)
|
||||
reactionAnimationView.playForEmoji(listOf(emoji))
|
||||
viewModel.setIsDisplayingReactionAnimation(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class StoryGroupReplyBottomSheetDialogFragment : FixedRoundedCornerBottomSheetDi
|
||||
}
|
||||
|
||||
override fun onReactionEmojiSelected(emoji: String) {
|
||||
reactionView.playForEmoji(emoji)
|
||||
reactionView.playForEmoji(listOf(emoji))
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -47,13 +47,13 @@ class MultiReactionBurstLayout @JvmOverloads constructor(
|
||||
.filter { it.value.groupBy { event -> event.sender }.size >= REACTION_COUNT_THRESHOLD }
|
||||
.values
|
||||
.map { it.sortedBy { event -> event.timestamp } }
|
||||
.map { it[REACTION_COUNT_THRESHOLD - 1] }
|
||||
.sortedBy { it.timestamp }
|
||||
.sortedBy { it.last().timestamp }
|
||||
.take(MAX_SIMULTANEOUS_REACTIONS - cooldownTimes.filter { it.value > System.currentTimeMillis() }.size)
|
||||
.forEach {
|
||||
val reactionView = getNextReactionView()
|
||||
reactionView.playForEmoji(it.reaction)
|
||||
cooldownTimes[EmojiUtil.getCanonicalRepresentation(it.reaction)] = it.timestamp + cooldownDuration.inWholeMilliseconds
|
||||
reactionView.playForEmoji(it.map { event -> event.reaction })
|
||||
val lastEvent = it.last()
|
||||
cooldownTimes[EmojiUtil.getCanonicalRepresentation(lastEvent.reaction)] = lastEvent.timestamp + cooldownDuration.inWholeMilliseconds
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class OnReactionSentView @JvmOverloads constructor(
|
||||
})
|
||||
}
|
||||
|
||||
fun playForEmoji(emoji: CharSequence) {
|
||||
fun playForEmoji(emojis: List<CharSequence>) {
|
||||
motionLayout.progress = 0f
|
||||
|
||||
listOf(
|
||||
@@ -47,8 +47,9 @@ class OnReactionSentView @JvmOverloads constructor(
|
||||
R.id.emoji_9,
|
||||
R.id.emoji_10,
|
||||
R.id.emoji_11
|
||||
).forEach {
|
||||
findViewById<EmojiImageView>(it).setImageEmoji(emoji)
|
||||
).forEachIndexed { index, it ->
|
||||
val emojiIndex = index % emojis.size
|
||||
findViewById<EmojiImageView>(it).setImageEmoji(emojis[emojiIndex])
|
||||
}
|
||||
|
||||
motionLayout.requestLayout()
|
||||
|
||||
@@ -159,7 +159,7 @@ class StoryViewsAndRepliesDialogFragment : FixedRoundedCornerBottomSheetDialogFr
|
||||
}
|
||||
|
||||
override fun onReactionEmojiSelected(emoji: String) {
|
||||
reactionView.playForEmoji(emoji)
|
||||
reactionView.playForEmoji(listOf(emoji))
|
||||
}
|
||||
|
||||
private inner class PageChangeCallback : ViewPager2.OnPageChangeCallback() {
|
||||
|
||||
Reference in New Issue
Block a user