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 <eskil.abrahamsen-blomfeldt@theqtcompany.com>
bb10
BogDan Vatra 2016-02-15 15:07:53 +02:00
parent 7906255ef2
commit aa85ebc266
1 changed files with 12 additions and 0 deletions

View File

@ -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 {