Skip to content

Commit

Permalink
chore(android): Improve handling of splashImmersive and splashFullScr…
Browse files Browse the repository at this point in the history
…een preferences (#2705)
  • Loading branch information
iljadaderko authored Apr 6, 2020
1 parent 3cd02e4 commit 1c633c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions android/capacitor/src/main/java/com/getcapacitor/Splash.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,10 @@ private static void buildViews(Context c) {
splashImage = new ImageView(c);

splashImage.setFitsSystemWindows(true);

// Hide status bar during splash screen.
Boolean splashFullScreen = Config.getBoolean(CONFIG_KEY_PREFIX + "splashFullScreen", DEFAULT_SPLASH_FULL_SCREEN);
if(splashFullScreen) {
splashImage.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
}

// Enable immersive mode (hides status bar and navbar) during splash screen.

// Enable immersive mode (hides status bar and navbar) during splash screen or hide status bar.
Boolean splashImmersive = Config.getBoolean(CONFIG_KEY_PREFIX + "splashImmersive", DEFAULT_SPLASH_IMMERSIVE);
Boolean splashFullScreen = Config.getBoolean(CONFIG_KEY_PREFIX + "splashFullScreen", DEFAULT_SPLASH_FULL_SCREEN);
if (splashImmersive) {
final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
Expand All @@ -81,6 +76,8 @@ private static void buildViews(Context c) {
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
splashImage.setSystemUiVisibility(flags);
} else if (splashFullScreen) {
splashImage.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
}

// Stops flickers dead in their tracks
Expand Down
2 changes: 1 addition & 1 deletion site/docs-md/apis/splash-screen/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Then run `npx cap copy` to apply these changes.

## Full Screen & Immersive

You can enable `splashFullScreen` to hide status bar, or `splashImmersive` to hide both status bar and software navigation buttons.
You can enable `splashFullScreen` to hide status bar, or `splashImmersive` to hide both status bar and software navigation buttons. If both options are enabled `splashImmersive` takes priority, as it also fulfils `splashFullScreen` functionality.

## Configuration

Expand Down

0 comments on commit 1c633c5

Please sign in to comment.