From e9479791691c0f872aa589295c26ad451eae7b09 Mon Sep 17 00:00:00 2001 From: Cody Henthorne Date: Wed, 14 Dec 2022 12:53:01 -0500 Subject: [PATCH] Revert "Fix view flicker when switching between keyboard and attachment/emoji keyboards." This reverts commit 161814134258880d06df4f70fd8407e8bf9b0053. --- .../components/KeyboardAwareLinearLayout.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/KeyboardAwareLinearLayout.java b/app/src/main/java/org/thoughtcrime/securesms/components/KeyboardAwareLinearLayout.java index b34138ef7..ebb665665 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/KeyboardAwareLinearLayout.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/KeyboardAwareLinearLayout.java @@ -107,6 +107,10 @@ public class KeyboardAwareLinearLayout extends LinearLayoutCompat { } private void updateKeyboardState() { + updateKeyboardState(Integer.MAX_VALUE); + } + + private void updateKeyboardState(int previousHeight) { if (viewInset == 0 && Build.VERSION.SDK_INT >= 21) viewInset = getViewInset(); getWindowVisibleDisplayFrame(rect); @@ -126,7 +130,11 @@ public class KeyboardAwareLinearLayout extends LinearLayoutCompat { onKeyboardOpen(keyboardHeight); } } else if (keyboardOpen) { - onKeyboardClose(); + if (previousHeight == keyboardHeight) { + onKeyboardClose(); + } else { + postDelayed(() -> updateKeyboardState(keyboardHeight), 100); + } } }