Skip to content

Instantly share code, notes, and snippets.

@mykltronn
Created June 11, 2019 18:49
Show Gist options
  • Save mykltronn/ddb20ff7127cbd6d517407b85c42631d to your computer and use it in GitHub Desktop.
Save mykltronn/ddb20ff7127cbd6d517407b85c42631d to your computer and use it in GitHub Desktop.
public class ImmersiveMode extends ReactContextBaseJavaModule {
. . .
// Previously added stuff
// our method takes one argument, systemUIFlags.
// It ends up being an integer, which is pretty neat-- more on that later.
private void setSystemUIFlags(int visibility) {
// here we get ourCurrentActivity
// from it, we grab the window
// and from that we grab the decorView for our current activity
View decorView = getCurrentActivity().getWindow().getDecorView();
// think of the decorView as the eldest ancestor of the UI class familly tree.
// it contains not only your views, but all current system views
// eg system alerts and *navigation elements*
// it contains a method for manipulating some of those system views
decorView.setSystemUiVisibility(visibility);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment