mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Fix reaction shade on new conversations.
This commit is contained in:
committed by
Greyson Parrelli
parent
dc22b27cd8
commit
09dd2583b9
@@ -9,7 +9,10 @@ import kotlin.math.min
|
||||
/**
|
||||
* Decoration that will make the video display params update on each recycler redraw.
|
||||
*/
|
||||
class GiphyMp4ItemDecoration(val callback: GiphyMp4PlaybackController.Callback) : RecyclerView.ItemDecoration() {
|
||||
class GiphyMp4ItemDecoration(
|
||||
val callback: GiphyMp4PlaybackController.Callback,
|
||||
val onRecyclerVerticalTranslationSet: (Float) -> Unit
|
||||
) : RecyclerView.ItemDecoration() {
|
||||
override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
|
||||
setParentRecyclerTranslationY(parent)
|
||||
|
||||
@@ -21,6 +24,7 @@ class GiphyMp4ItemDecoration(val callback: GiphyMp4PlaybackController.Callback)
|
||||
private fun setParentRecyclerTranslationY(parent: RecyclerView) {
|
||||
if (parent.childCount == 0 || parent.canScrollVertically(-1) || parent.canScrollVertically(1)) {
|
||||
parent.translationY = 0f
|
||||
onRecyclerVerticalTranslationSet(parent.translationY)
|
||||
} else {
|
||||
val footerViewHolder = parent.children
|
||||
.map { parent.getChildViewHolder(it) }
|
||||
@@ -29,12 +33,13 @@ class GiphyMp4ItemDecoration(val callback: GiphyMp4PlaybackController.Callback)
|
||||
|
||||
if (footerViewHolder == null) {
|
||||
parent.translationY = 0f
|
||||
onRecyclerVerticalTranslationSet(parent.translationY)
|
||||
return
|
||||
}
|
||||
|
||||
val childTop = footerViewHolder.itemView.top
|
||||
parent.translationY = min(0, -childTop).toFloat().also {
|
||||
}
|
||||
parent.translationY = min(0, -childTop).toFloat()
|
||||
onRecyclerVerticalTranslationSet(parent.translationY)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user