Skip to content

Instantly share code, notes, and snippets.

@mykltronn
Created June 11, 2019 03:16
Show Gist options
  • Save mykltronn/cbbdecfe2449ead7e7ddb95ac672e62a to your computer and use it in GitHub Desktop.
Save mykltronn/cbbdecfe2449ead7e7ddb95ac672e62a to your computer and use it in GitHub Desktop.
package com.myApp;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.Callback;
import android.view.View;
public class FullScreenMode extends ReactContextBaseJavaModule {
ReactApplicationContext reactContext;
View decorView
@Override
public String getName() {
return "FullScreenMode";
}
public HideSystemUI(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}
@ReactMethod
public void enterStickyImmersiveMode() {
View decorView = getCurrentDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
);
}
@ReactMethod
public void enterImmersiveMode() {
View decorView = getCurrentDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
);
}
private getCurrentDecorView() {
return getCurrentActivity().getWindow().getDecorView();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment