mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Fix chat box sliding under keyboard when long pressing text
Slide ChatBarView under IME instead of padding to preserve text selection handles
This commit is contained in:
parent
4c1e3fb1ed
commit
e7e28ff44c
1 changed files with 6 additions and 10 deletions
|
|
@ -164,19 +164,15 @@ class ChatBarView : LinearLayout, OnImeVisibilityChangedListener {
|
|||
|
||||
override fun onImeVisibilityChanged(visible: Boolean, height: Int, safeInsets: Insets) {
|
||||
this.safeInsets = safeInsets
|
||||
imeHeight = if (visible) {
|
||||
height
|
||||
} else {
|
||||
0
|
||||
}
|
||||
applyAllPadding()
|
||||
}
|
||||
imeHeight = if (visible) height else 0
|
||||
|
||||
private fun applyAllPadding() {
|
||||
Log.e("ChatBarView", "applyAllPadding: safeInsets = $safeInsets, imeHeight = $imeHeight")
|
||||
updatePadding(
|
||||
left = safeInsets.left,
|
||||
right = safeInsets.right,
|
||||
bottom = if (imeHeight > 0) imeHeight else safeInsets.bottom)
|
||||
bottom = safeInsets.bottom
|
||||
)
|
||||
|
||||
// slide the bar up under the keyboard
|
||||
translationY = if (imeHeight > 0) -imeHeight.toFloat() else 0f
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue