From 42ecdfe6f3bcbf3e35ca88b24af07249e3936fc7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 6 Jan 2020 12:33:55 +0100 Subject: Revert "Android: Implement MaximizeUsingFullscreenGeometryHint" This reverts commit c17a5cec1901dd23f4c39ec2ae47a060fbb06895. The patch introduced a call to View.getRootViewInsets() which was introduced in API level 23. We don't want to change the minimum level for Qt 5.x series now, so we will revert the change in 5.15 and reintroduce it in Qt 6, simultaneously setting the minimum API level to 23. Task-number: QTBUG-74202 Change-Id: Ia25bb2cd62287aa80a43bbd294fb757f3f79ff5e Reviewed-by: BogDan Vatra --- .../qtproject/qt5/android/QtActivityDelegate.java | 63 ++++++++-------------- 1 file changed, 23 insertions(+), 40 deletions(-) (limited to 'src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java') 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 0db9441749..2df2ed9a1d 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -121,10 +121,6 @@ public class QtActivityDelegate private static final String EXTRACT_STYLE_KEY = "extract.android.style"; private static final String EXTRACT_STYLE_MINIMAL_KEY = "extract.android.style.option"; - public static final int SYSTEM_UI_VISIBILITY_NORMAL = 0; - public static final int SYSTEM_UI_VISIBILITY_FULLSCREEN = 1; - public static final int SYSTEM_UI_VISIBILITY_TRANSLUCENT = 2; - private static String m_environmentVariables = null; private static String m_applicationParameters = null; @@ -135,7 +131,7 @@ public class QtActivityDelegate private long m_metaState; private int m_lastChar = 0; private int m_softInputMode = 0; - private int m_systemUiVisibility = SYSTEM_UI_VISIBILITY_NORMAL; + private boolean m_fullScreen = false; private boolean m_started = false; private HashMap m_surfaces = null; private HashMap m_nativeViews = null; @@ -157,51 +153,38 @@ public class QtActivityDelegate private CursorHandle m_rightSelectionHandle; private EditPopupMenu m_editPopupMenu; - - public void setSystemUiVisibility(int systemUiVisibility) + public void setFullScreen(boolean enterFullScreen) { - if (m_systemUiVisibility == systemUiVisibility) + if (m_fullScreen == enterFullScreen) return; - m_systemUiVisibility = systemUiVisibility; - - int systemUiVisibilityFlags = 0; - switch (m_systemUiVisibility) { - case SYSTEM_UI_VISIBILITY_NORMAL: - m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); - m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); - systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_VISIBLE; - break; - case SYSTEM_UI_VISIBILITY_FULLSCREEN: + if (m_fullScreen = enterFullScreen) { m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); - systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - | View.SYSTEM_UI_FLAG_FULLSCREEN - | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY - | View.INVISIBLE; - break; - case SYSTEM_UI_VISIBILITY_TRANSLUCENT: - m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN - | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION - | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); + try { + int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION; + flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE; + flags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION; + flags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; + flags |= View.SYSTEM_UI_FLAG_FULLSCREEN; + flags |= View.class.getDeclaredField("SYSTEM_UI_FLAG_IMMERSIVE_STICKY").getInt(null); + m_activity.getWindow().getDecorView().setSystemUiVisibility(flags | View.INVISIBLE); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + m_activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); m_activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); - systemUiVisibilityFlags = View.SYSTEM_UI_FLAG_VISIBLE; - break; - }; - - m_activity.getWindow().getDecorView().setSystemUiVisibility(systemUiVisibilityFlags); - + m_activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE); + } m_layout.requestLayout(); } public void updateFullScreen() { - if (m_systemUiVisibility == SYSTEM_UI_VISIBILITY_FULLSCREEN) { - m_systemUiVisibility = SYSTEM_UI_VISIBILITY_NORMAL; - setSystemUiVisibility(SYSTEM_UI_VISIBILITY_FULLSCREEN); + if (m_fullScreen) { + m_fullScreen = false; + setFullScreen(true); } } @@ -960,7 +943,7 @@ public class QtActivityDelegate } catch (Exception e) { e.printStackTrace(); } - outState.putInt("SystemUiVisibility", m_systemUiVisibility); + outState.putBoolean("FullScreen", m_fullScreen); outState.putBoolean("Started", m_started); // It should never } -- cgit v1.2.3