From aa85ebc266ea7415a883094ea735f549552ff5ac Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Mon, 15 Feb 2016 15:07:53 +0200 Subject: Android: Fix immersive mode The activity exits immersive mode when displaying a dialog. To fix the problem we must use onWindowFocusChanged to update updateFullScreen every time when we've gotten the focus. Task-number: QTBUG-38759 Change-Id: I9f11a82dba484dbec6daba7cbf116f16fe2ba372 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../src/org/qtproject/qt5/android/QtActivityDelegate.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/android') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index ac77de0bab..4cce86e8bb 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -92,6 +92,7 @@ public class QtActivityDelegate private Method m_super_onConfigurationChanged = null; private Method m_super_onActivityResult = null; private Method m_super_dispatchGenericMotionEvent = null; + private Method m_super_onWindowFocusChanged = null; private static final String NATIVE_LIBRARIES_KEY = "native.libraries"; private static final String BUNDLED_LIBRARIES_KEY = "bundled.libraries"; @@ -520,6 +521,7 @@ public class QtActivityDelegate m_super_onKeyUp = m_activity.getClass().getMethod("super_onKeyUp", Integer.TYPE, KeyEvent.class); m_super_onConfigurationChanged = m_activity.getClass().getMethod("super_onConfigurationChanged", Configuration.class); m_super_onActivityResult = m_activity.getClass().getMethod("super_onActivityResult", Integer.TYPE, Integer.TYPE, Intent.class); + m_super_onWindowFocusChanged = m_activity.getClass().getMethod("super_onWindowFocusChanged", Boolean.TYPE); if (Build.VERSION.SDK_INT >= 12) { try { m_super_dispatchGenericMotionEvent = m_activity.getClass().getMethod("super_dispatchGenericMotionEvent", MotionEvent.class); @@ -943,6 +945,16 @@ public class QtActivityDelegate } } + public void onWindowFocusChanged(boolean hasFocus) { + try { + m_super_onWindowFocusChanged.invoke(m_activity, hasFocus); + } catch (Exception e) { + e.printStackTrace(); + } + if (hasFocus) + updateFullScreen(); + } + public void onConfigurationChanged(Configuration configuration) { try { -- cgit v1.2.3