forked from github/cordova-android
fix(splashscreen): nav & title bar showing in fullscreen mode (#733)
Co-authored-by: Daniel Stone <daniel.stone@powerdms.com> Co-authored-by: distinctdan <distinctdan@users.noreply.github.com>
This commit is contained in:
parent
6cbf69d109
commit
cb1cf4dc8e
@ -125,6 +125,9 @@ public class CordovaActivity extends Activity {
|
|||||||
// (as was the case in previous cordova versions)
|
// (as was the case in previous cordova versions)
|
||||||
if (!preferences.getBoolean("FullscreenNotImmersive", false)) {
|
if (!preferences.getBoolean("FullscreenNotImmersive", false)) {
|
||||||
immersiveMode = true;
|
immersiveMode = true;
|
||||||
|
// The splashscreen plugin needs the flags set before we're focused to prevent
|
||||||
|
// the nav and title bars from flashing in.
|
||||||
|
setImmersiveUiVisibility();
|
||||||
} else {
|
} else {
|
||||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
@ -321,11 +324,16 @@ public class CordovaActivity extends Activity {
|
|||||||
/**
|
/**
|
||||||
* Called when view focus is changed
|
* Called when view focus is changed
|
||||||
*/
|
*/
|
||||||
@SuppressLint("InlinedApi")
|
|
||||||
@Override
|
@Override
|
||||||
public void onWindowFocusChanged(boolean hasFocus) {
|
public void onWindowFocusChanged(boolean hasFocus) {
|
||||||
super.onWindowFocusChanged(hasFocus);
|
super.onWindowFocusChanged(hasFocus);
|
||||||
if (hasFocus && immersiveMode) {
|
if (hasFocus && immersiveMode) {
|
||||||
|
setImmersiveUiVisibility();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressLint("InlinedApi")
|
||||||
|
protected void setImmersiveUiVisibility() {
|
||||||
final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
@ -335,7 +343,6 @@ public class CordovaActivity extends Activity {
|
|||||||
|
|
||||||
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
|
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user