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

feat(android): add splashFullScreen configuration option #2302

Merged
merged 1 commit into from
Jan 29, 2020
Merged
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
Update Splash.java to realize full screen splash!
For android, it is useful to hide the status bar right from the start. 
The user can add following setting:
    "SplashScreen": {
      "splashFullScreen": true
    }
unitree-czk authored Jan 7, 2020

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 1e331cae28e2f5cd6dea9a898c28d4f595a164c6
8 changes: 8 additions & 0 deletions android/capacitor/src/main/java/com/getcapacitor/Splash.java
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ public interface SplashListener {
public static final int DEFAULT_FADE_OUT_DURATION = 200;
public static final int DEFAULT_SHOW_DURATION = 3000;
public static final boolean DEFAULT_AUTO_HIDE = true;
public static final boolean DEFAULT_SPLASH_FULL_SCREEN = false;

private static ImageView splashImage;
private static ProgressBar spinnerBar;
@@ -52,7 +53,14 @@ private static void buildViews(Context c) {
}

splashImage = new ImageView(c);

// 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);
}


// Stops flickers dead in their tracks
// https://stackoverflow.com/a/21847579/32140
splashImage.setDrawingCacheEnabled(true);