Android-Keyboard: Remove redundant code in isKeyboardHidden()
The m_keyboardIsVisible variable already reflects the current keyboard visibility state. This commit simplifies the isKeyboardHidden() method by using it directly, removing unnecessary logic. Task-number: QTBUG-98984 Pick-to: 6.10 6.9 6.8 Change-Id: I6bba90e6fbfb1191415e7ee812517ca15ac1c937 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
33cf82c13d
commit
acbcf992ee
@ -321,8 +321,6 @@ class QtInputDelegate implements QtInputConnection.QtInputConnectionListener, Qt
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean isKeyboardHidden = true;
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
|
||||
Rect r = new Rect();
|
||||
activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
|
||||
@ -330,13 +328,10 @@ class QtInputDelegate implements QtInputConnection.QtInputConnectionListener, Qt
|
||||
QtDisplayManager.getDisplay(activity).getMetrics(metrics);
|
||||
int screenHeight = metrics.heightPixels;
|
||||
final int kbHeight = screenHeight - r.bottom;
|
||||
isKeyboardHidden = kbHeight < screenHeight * KEYBOARD_TO_SCREEN_RATIO;
|
||||
} else {
|
||||
WindowInsets w = activity.getWindow().getDecorView().getRootWindowInsets();
|
||||
isKeyboardHidden = !w.isVisible(Type.ime());
|
||||
return kbHeight < screenHeight * KEYBOARD_TO_SCREEN_RATIO;
|
||||
}
|
||||
|
||||
return isKeyboardHidden;
|
||||
return !m_keyboardIsVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user