Bug 1074536 - Hide statubar tint whenever statusbar is hidden (r=mfinkle)

This commit is contained in:
Lucas Rocha 2014-10-10 16:09:06 +01:00
Родитель 6e5a3d23d1
Коммит 6136e1984c
4 изменённых файлов: 43 добавлений и 13 удалений

Просмотреть файл

@ -75,12 +75,21 @@ public class BaseGeckoInterface implements GeckoAppShell.GeckoInterface {
public void run() {
// Hide/show the system notification bar
Window window = getActivity().getWindow();
window.setFlags(fullscreen ?
WindowManager.LayoutParams.FLAG_FULLSCREEN : 0,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
if (Versions.feature11Plus) {
window.getDecorView().setSystemUiVisibility(fullscreen ? 1 : 0);
final int newVis;
if (fullscreen) {
newVis = View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_LOW_PROFILE;
} else {
newVis = View.SYSTEM_UI_FLAG_VISIBLE;
}
window.getDecorView().setSystemUiVisibility(newVis);
} else {
window.setFlags(fullscreen ?
WindowManager.LayoutParams.FLAG_FULLSCREEN : 0,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
});

Просмотреть файл

@ -685,7 +685,20 @@ public class BrowserApp extends GeckoApp
mTintManager = new SystemBarTintManager(this);
mTintManager.setTintColor(getResources().getColor(R.color.background_tabs));
mTintManager.setStatusBarTintEnabled(true);
updateSystemUITinting(mRootLayout.getSystemUiVisibility());
mRootLayout.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
updateSystemUITinting(visibility);
}
});
}
private void updateSystemUITinting(int visibility) {
final boolean shouldTint = (visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0 &&
(visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0;
mTintManager.setStatusBarTintEnabled(shouldTint);
}
/**
@ -2656,10 +2669,6 @@ public class BrowserApp extends GeckoApp
mLayerView.getLayerMarginsAnimator().setMaxMargins(0, mToolbarHeight, 0, 0);
}
}
if (mTintManager != null) {
mTintManager.setStatusBarTintEnabled(!fullscreen);
}
}
});
}

Просмотреть файл

@ -158,6 +158,7 @@ public abstract class GeckoApp
// after a version upgrade.
private static final int CLEANUP_DEFERRAL_SECONDS = 15;
protected RelativeLayout mRootLayout;
protected RelativeLayout mMainLayout;
protected RelativeLayout mGeckoLayout;
private View mCameraView;
@ -1076,12 +1077,21 @@ public abstract class GeckoApp
public void run() {
// Hide/show the system notification bar
Window window = getWindow();
window.setFlags(fullscreen ?
WindowManager.LayoutParams.FLAG_FULLSCREEN : 0,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
if (Versions.feature11Plus) {
window.getDecorView().setSystemUiVisibility(fullscreen ? 1 : 0);
final int newVis;
if (fullscreen) {
newVis = View.SYSTEM_UI_FLAG_FULLSCREEN |
View.SYSTEM_UI_FLAG_LOW_PROFILE;
} else {
newVis = View.SYSTEM_UI_FLAG_VISIBLE;
}
window.getDecorView().setSystemUiVisibility(newVis);
} else {
window.setFlags(fullscreen ?
WindowManager.LayoutParams.FLAG_FULLSCREEN : 0,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
});
@ -1262,6 +1272,7 @@ public abstract class GeckoApp
setContentView(getLayout());
// Set up Gecko layout.
mRootLayout = (RelativeLayout) findViewById(R.id.root_layout);
mGeckoLayout = (RelativeLayout) findViewById(R.id.gecko_layout);
mMainLayout = (RelativeLayout) findViewById(R.id.main_layout);

Просмотреть файл

@ -5,6 +5,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto"
android:id="@+id/root_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">