kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix keyboard auto-close bug.
rodzic
5b781c45f3
commit
7dfebdca32
|
@ -63,8 +63,7 @@ public class KeyboardAwareLinearLayout extends LinearLayoutCompat {
|
||||||
private int viewInset;
|
private int viewInset;
|
||||||
|
|
||||||
private boolean keyboardOpen = false;
|
private boolean keyboardOpen = false;
|
||||||
private int rotation = -1;
|
private int rotation = 0;
|
||||||
private boolean isFullscreen = false;
|
|
||||||
private boolean isBubble = false;
|
private boolean isBubble = false;
|
||||||
|
|
||||||
public KeyboardAwareLinearLayout(Context context) {
|
public KeyboardAwareLinearLayout(Context context) {
|
||||||
|
@ -108,6 +107,10 @@ public class KeyboardAwareLinearLayout extends LinearLayoutCompat {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateKeyboardState() {
|
private void updateKeyboardState() {
|
||||||
|
updateKeyboardState(Integer.MAX_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateKeyboardState(int previousHeight) {
|
||||||
if (viewInset == 0 && Build.VERSION.SDK_INT >= 21) viewInset = getViewInset();
|
if (viewInset == 0 && Build.VERSION.SDK_INT >= 21) viewInset = getViewInset();
|
||||||
|
|
||||||
getWindowVisibleDisplayFrame(rect);
|
getWindowVisibleDisplayFrame(rect);
|
||||||
|
@ -127,13 +130,18 @@ public class KeyboardAwareLinearLayout extends LinearLayoutCompat {
|
||||||
onKeyboardOpen(keyboardHeight);
|
onKeyboardOpen(keyboardHeight);
|
||||||
}
|
}
|
||||||
} else if (keyboardOpen) {
|
} else if (keyboardOpen) {
|
||||||
onKeyboardClose();
|
if (previousHeight == keyboardHeight) {
|
||||||
|
onKeyboardClose();
|
||||||
|
} else {
|
||||||
|
postDelayed(() -> updateKeyboardState(keyboardHeight), 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onAttachedToWindow() {
|
protected void onAttachedToWindow() {
|
||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
|
rotation = getDeviceRotation();
|
||||||
if (Build.VERSION.SDK_INT >= 23 && getRootWindowInsets() != null) {
|
if (Build.VERSION.SDK_INT >= 23 && getRootWindowInsets() != null) {
|
||||||
int bottomInset;
|
int bottomInset;
|
||||||
WindowInsets windowInsets = getRootWindowInsets();
|
WindowInsets windowInsets = getRootWindowInsets();
|
||||||
|
@ -299,10 +307,6 @@ public class KeyboardAwareLinearLayout extends LinearLayoutCompat {
|
||||||
shownListeners.remove(listener);
|
shownListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFullscreen(boolean isFullscreen) {
|
|
||||||
this.isFullscreen = isFullscreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notifyHiddenListeners() {
|
private void notifyHiddenListeners() {
|
||||||
final Set<OnKeyboardHiddenListener> listeners = new HashSet<>(hiddenListeners);
|
final Set<OnKeyboardHiddenListener> listeners = new HashSet<>(hiddenListeners);
|
||||||
for (OnKeyboardHiddenListener listener : listeners) {
|
for (OnKeyboardHiddenListener listener : listeners) {
|
||||||
|
|
Ładowanie…
Reference in New Issue