From d0d29a944a5836bedbac9e57ffc937c5c3842899 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 4 Oct 2021 16:23:18 +0200 Subject: Android: Hide the keyboard when the height is less than 0 When swiping on a device to do the back gesture then there is no back key pressed sent so we still need to catch when the keyboard is hidden. So we can listen for the geometry change and if the height is less than 0 then it is safe to say it is hidden so we update the internal setting on this. Fixes: QTBUG-96560 Pick-to: 6.2 5.15 Change-Id: Iec0560935ef914d2cebcb7641a72ab4f71877d23 Reviewed-by: Andreas Buhr Reviewed-by: Assam Boudjelthia --- src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/android') diff --git a/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java index 9c36090c92..9039f9c4f9 100644 --- a/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt/android/QtActivityDelegate.java @@ -848,6 +848,10 @@ public class QtActivityDelegate DisplayMetrics metrics = new DisplayMetrics(); m_activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); final int kbHeight = metrics.heightPixels - r.bottom; + if (kbHeight < 0) { + setKeyboardVisibility(false, System.nanoTime()); + return true; + } final int[] location = new int[2]; m_layout.getLocationOnScreen(location); QtNative.keyboardGeometryChanged(location[0], r.bottom - location[1], -- cgit v1.2.3