Fix keyboard issue on some Android devices.

fork-5.53.8
Alex Hart 2021-10-26 10:24:59 -03:00
rodzic 12565d28ae
commit 85551ca824
2 zmienionych plików z 13 dodań i 1 usunięć

Wyświetl plik

@ -3,14 +3,26 @@ package org.thoughtcrime.securesms.giph.mp4
import android.graphics.Canvas import android.graphics.Canvas
import androidx.core.view.children import androidx.core.view.children
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import kotlin.math.min
/** /**
* Decoration that will make the video display params update on each recycler redraw. * 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) : RecyclerView.ItemDecoration() {
override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) { override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) {
setParentRecyclerTranslationY(parent)
parent.children.map { parent.getChildViewHolder(it) }.filterIsInstance(GiphyMp4Playable::class.java).forEach { parent.children.map { parent.getChildViewHolder(it) }.filterIsInstance(GiphyMp4Playable::class.java).forEach {
callback.updateVideoDisplayPositionAndSize(parent, it) callback.updateVideoDisplayPositionAndSize(parent, it)
} }
} }
private fun setParentRecyclerTranslationY(parent: RecyclerView) {
if (parent.childCount == 0 || parent.canScrollVertically(-1) || parent.canScrollVertically(1)) {
parent.translationY = 0f
} else {
val childTop = parent.children.last().top
parent.translationY = min(0, -childTop).toFloat()
}
}
} }

Wyświetl plik

@ -26,7 +26,7 @@
<org.thoughtcrime.securesms.conversation.mutiselect.MultiselectRecyclerView <org.thoughtcrime.securesms.conversation.mutiselect.MultiselectRecyclerView
android:id="@android:id/list" android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:cacheColorHint="@color/signal_background_primary" android:cacheColorHint="@color/signal_background_primary"
android:clipChildren="false" android:clipChildren="false"
android:clipToPadding="false" android:clipToPadding="false"