From 68e777638a90364e60718725271606d80ad95337 Mon Sep 17 00:00:00 2001 From: Jake Klinker Date: Sun, 10 Aug 2014 23:22:26 -0500 Subject: [PATCH 1/2] fix system bars being displayed when using immersive mode on many custom ROMs --- .../systembartint/SystemBarTintManager.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java b/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java index ff15741..6c3d5d1 100644 --- a/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java +++ b/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java @@ -119,6 +119,11 @@ public SystemBarTintManager(Activity activity) { mNavBarAvailable = false; } + if (mConfig.isImmersiveMode(activity)) { + mStatusBarAvailable = false; + mNavBarAvailable = false; + } + if (mStatusBarAvailable) { setupStatusBarView(activity, decorViewGroup); } @@ -443,6 +448,18 @@ private boolean hasNavBar(Context context) { } } + private boolean isImmersiveMode(Activity activity) { + try { + int immersive = android.provider.Settings.System.getInt(activity.getContentResolver(), "immersive_mode"); + if (immersive == 1) { + return true; + } + } catch (Exception e) { + } + + return false; + } + private int getInternalDimensionSize(Resources res, String key) { int result = 0; int resourceId = res.getIdentifier(key, "dimen", "android"); From 9b8b8865057c5b685a3a4eba5b6efea5fcafc03a Mon Sep 17 00:00:00 2001 From: Jake Klinker Date: Tue, 12 Aug 2014 12:24:02 -0500 Subject: [PATCH 2/2] fix for system bars being shown when launched in hover mode on custom ROMs --- .../systembartint/SystemBarTintManager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java b/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java index 6c3d5d1..a388473 100644 --- a/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java +++ b/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java @@ -119,7 +119,7 @@ public SystemBarTintManager(Activity activity) { mNavBarAvailable = false; } - if (mConfig.isImmersiveMode(activity)) { + if (mConfig.isImmersiveMode(activity) || mConfig.isHoverMode(activity)) { mStatusBarAvailable = false; mNavBarAvailable = false; } @@ -365,6 +365,7 @@ public static class SystemBarConfig { private static final String NAV_BAR_HEIGHT_LANDSCAPE_RES_NAME = "navigation_bar_height_landscape"; private static final String NAV_BAR_WIDTH_RES_NAME = "navigation_bar_width"; private static final String SHOW_NAV_BAR_RES_NAME = "config_showNavigationBar"; + private static final int HOVER_INTENT_FLAG = 0x00002000; private final boolean mTranslucentStatusBar; private final boolean mTranslucentNavBar; @@ -460,6 +461,14 @@ private boolean isImmersiveMode(Activity activity) { return false; } + private boolean isHoverMode(Activity activity) { + if ((activity.getIntent().getFlags() & HOVER_INTENT_FLAG) != 0) { + return true; + } else { + return false; + } + } + private int getInternalDimensionSize(Resources res, String key) { int result = 0; int resourceId = res.getIdentifier(key, "dimen", "android");