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

Hide the bottom navigation bar when fullScreen is set to true (Only android compatible) #525

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
18 changes: 15 additions & 3 deletions android/src/main/java/org/devio/rn/splashscreen/SplashScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Activity;
import android.app.Dialog;
import android.os.Build;
import android.view.View;

import java.lang.ref.WeakReference;

Expand All @@ -21,17 +22,28 @@ public class SplashScreen {
/**
* 打开启动屏
*/
public static void show(final Activity activity, final int themeResId) {
public static void show(final Activity activity, final int themeResId, final boolean fullScreen) {
if (activity == null) return;
mActivity = new WeakReference<Activity>(activity);
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (!activity.isFinishing()) {
mSplashDialog = new Dialog(activity, themeResId);

if(fullScreen) {
// Hides the status and navigation bar until the user wants to interact with them.
View decorView = mSplashDialog.getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
}

mSplashDialog.setContentView(R.layout.launch_screen);
mSplashDialog.setCancelable(false);

if (!mSplashDialog.isShowing()) {
mSplashDialog.show();
}
Expand All @@ -46,7 +58,7 @@ public void run() {
public static void show(final Activity activity, final boolean fullScreen) {
int resourceId = fullScreen ? R.style.SplashScreen_Fullscreen : R.style.SplashScreen_SplashTheme;

show(activity, resourceId);
show(activity, resourceId, fullScreen);
}

/**
Expand Down