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 efab52720..ebb665665 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/KeyboardAwareLinearLayout.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/KeyboardAwareLinearLayout.java @@ -63,8 +63,7 @@ public class KeyboardAwareLinearLayout extends LinearLayoutCompat { private int viewInset; private boolean keyboardOpen = false; - private int rotation = -1; - private boolean isFullscreen = false; + private int rotation = 0; private boolean isBubble = false; public KeyboardAwareLinearLayout(Context context) { @@ -108,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); @@ -127,13 +130,18 @@ public class KeyboardAwareLinearLayout extends LinearLayoutCompat { onKeyboardOpen(keyboardHeight); } } else if (keyboardOpen) { - onKeyboardClose(); + if (previousHeight == keyboardHeight) { + onKeyboardClose(); + } else { + postDelayed(() -> updateKeyboardState(keyboardHeight), 100); + } } } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); + rotation = getDeviceRotation(); if (Build.VERSION.SDK_INT >= 23 && getRootWindowInsets() != null) { int bottomInset; WindowInsets windowInsets = getRootWindowInsets(); @@ -299,10 +307,6 @@ public class KeyboardAwareLinearLayout extends LinearLayoutCompat { shownListeners.remove(listener); } - public void setFullscreen(boolean isFullscreen) { - this.isFullscreen = isFullscreen; - } - private void notifyHiddenListeners() { final Set listeners = new HashSet<>(hiddenListeners); for (OnKeyboardHiddenListener listener : listeners) {