Skip to content

Commit 1c633c5

Browse files
authored
chore(android): Improve handling of splashImmersive and splashFullScreen preferences (#2705)
1 parent 3cd02e4 commit 1c633c5

File tree

2 files changed

+6
-9
lines changed
  • android/capacitor/src/main/java/com/getcapacitor
  • site/docs-md/apis/splash-screen

2 files changed

+6
-9
lines changed

android/capacitor/src/main/java/com/getcapacitor/Splash.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,10 @@ private static void buildViews(Context c) {
6464
splashImage = new ImageView(c);
6565

6666
splashImage.setFitsSystemWindows(true);
67-
68-
// Hide status bar during splash screen.
69-
Boolean splashFullScreen = Config.getBoolean(CONFIG_KEY_PREFIX + "splashFullScreen", DEFAULT_SPLASH_FULL_SCREEN);
70-
if(splashFullScreen) {
71-
splashImage.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
72-
}
73-
74-
// Enable immersive mode (hides status bar and navbar) during splash screen.
67+
68+
// Enable immersive mode (hides status bar and navbar) during splash screen or hide status bar.
7569
Boolean splashImmersive = Config.getBoolean(CONFIG_KEY_PREFIX + "splashImmersive", DEFAULT_SPLASH_IMMERSIVE);
70+
Boolean splashFullScreen = Config.getBoolean(CONFIG_KEY_PREFIX + "splashFullScreen", DEFAULT_SPLASH_FULL_SCREEN);
7671
if (splashImmersive) {
7772
final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
7873
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
@@ -81,6 +76,8 @@ private static void buildViews(Context c) {
8176
| View.SYSTEM_UI_FLAG_FULLSCREEN
8277
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
8378
splashImage.setSystemUiVisibility(flags);
79+
} else if (splashFullScreen) {
80+
splashImage.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN);
8481
}
8582

8683
// Stops flickers dead in their tracks

site/docs-md/apis/splash-screen/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Then run `npx cap copy` to apply these changes.
110110

111111
## Full Screen & Immersive
112112

113-
You can enable `splashFullScreen` to hide status bar, or `splashImmersive` to hide both status bar and software navigation buttons.
113+
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.
114114

115115
## Configuration
116116

0 commit comments

Comments
 (0)