Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix system bars being displayed when using immersive mode on many custom ROMs #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ public SystemBarTintManager(Activity activity) {
mNavBarAvailable = false;
}

if (mConfig.isImmersiveMode(activity) || mConfig.isHoverMode(activity)) {
mStatusBarAvailable = false;
mNavBarAvailable = false;
}

if (mStatusBarAvailable) {
setupStatusBarView(activity, decorViewGroup);
}
Expand Down Expand Up @@ -360,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;
Expand Down Expand Up @@ -443,6 +449,26 @@ 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 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");
Expand Down