Created
June 11, 2019 03:16
-
-
Save mykltronn/cbbdecfe2449ead7e7ddb95ac672e62a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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