Restore fullscreen mode after keyboard is dismissed

Showing the onscreen keyboard will also show the navigation
soft buttons. We need to tell Android to re-enable immersive
mode after the keyboard is hidden.

Since we now do this in two places, refactor the logic.

Task-number: QTBUG-36916
Change-Id: Ic69c28f41f5e8cf324d81f9bada3cb148dfb5306
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Paul Olav Tvete 2014-05-14 14:38:07 +02:00 committed by The Qt Project
parent 08117eee00
commit a968042f54

View File

@ -170,6 +170,13 @@ public class QtActivityDelegate
m_layout.requestLayout(); m_layout.requestLayout();
} }
public void updateFullScreen()
{
if (m_fullScreen) {
m_fullScreen = false;
setFullScreen(true);
}
}
// input method hints - must be kept in sync with QTDIR/src/corelib/global/qnamespace.h // input method hints - must be kept in sync with QTDIR/src/corelib/global/qnamespace.h
private final int ImhHiddenText = 0x1; private final int ImhHiddenText = 0x1;
@ -213,6 +220,10 @@ public class QtActivityDelegate
return false; return false;
m_keyboardIsVisible = visibility; m_keyboardIsVisible = visibility;
QtNative.keyboardVisibilityChanged(m_keyboardIsVisible); QtNative.keyboardVisibilityChanged(m_keyboardIsVisible);
if (visibility == false)
updateFullScreen(); // Hiding the keyboard clears the immersive mode, so we need to set it again.
return true; return true;
} }
public void resetSoftwareKeyboard() public void resetSoftwareKeyboard()
@ -721,12 +732,7 @@ public class QtActivityDelegate
QtNative.updateApplicationState(ApplicationActive); QtNative.updateApplicationState(ApplicationActive);
QtNative.clearLostActions(); QtNative.clearLostActions();
QtNative.updateWindow(); QtNative.updateWindow();
updateFullScreen(); // Suspending the app clears the immersive mode, so we need to set it again.
if (m_fullScreen) {
// Suspending the app clears the immersive mode, so we need to set it again.
m_fullScreen = false; // Force the setFullScreen() call below to actually do something
setFullScreen(true);
}
} }
} }
} }