MainActivity.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.safeareaviewexample;
  2. import android.os.Bundle;
  3. import android.view.View;
  4. import android.view.WindowManager;
  5. import com.facebook.react.ReactActivity;
  6. public class MainActivity extends ReactActivity {
  7. private static final boolean TEST_TRANSLUCENT_STATUS_BAR = true;
  8. private static final boolean TEST_TRANSLUCENT_NAVBAR = true;
  9. /**
  10. * Returns the name of the main component registered from JavaScript.
  11. * This is used to schedule rendering of the component.
  12. */
  13. @Override
  14. protected String getMainComponentName() {
  15. return "SafeAreaViewExample";
  16. }
  17. @Override
  18. protected void onCreate(Bundle savedInstanceState) {
  19. super.onCreate(savedInstanceState);
  20. if (TEST_TRANSLUCENT_STATUS_BAR) {
  21. getWindow().getDecorView().setSystemUiVisibility(
  22. View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
  23. }
  24. if (TEST_TRANSLUCENT_NAVBAR) {
  25. getWindow().setFlags(
  26. WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
  27. WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
  28. }
  29. }
  30. }