Fix keyboard auto-close bug.

fork-5.53.8
Cody Henthorne 2022-07-06 13:00:59 -04:00 zatwierdzone przez Alex Hart
rodzic 5b781c45f3
commit 7dfebdca32
1 zmienionych plików z 11 dodań i 7 usunięć

Wyświetl plik

@ -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<OnKeyboardHiddenListener> listeners = new HashSet<>(hiddenListeners);
for (OnKeyboardHiddenListener listener : listeners) {