Example usage for android.view View SYSTEM_UI_FLAG_FULLSCREEN

List of usage examples for android.view View SYSTEM_UI_FLAG_FULLSCREEN

Introduction

In this page you can find the example usage for android.view View SYSTEM_UI_FLAG_FULLSCREEN.

Prototype

int SYSTEM_UI_FLAG_FULLSCREEN

To view the source code for android.view View SYSTEM_UI_FLAG_FULLSCREEN.

Click Source Link

Document

Flag for #setSystemUiVisibility(int) : View has requested to go into the normal fullscreen mode so that its content can take over the screen while still allowing the user to interact with the application.

Usage

From source file:Main.java

@TargetApi(Build.VERSION_CODES.KITKAT)
public static void setImmersiveSticky(Window w) {
    w.getDecorView().setSystemUiVisibility(
            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 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

}

From source file:Main.java

public static void requestImmersiveStickyMode(Activity activity) {
    activity.getWindow().getDecorView().setSystemUiVisibility(
            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 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}

From source file:Main.java

/**
 * Detects and toggles immersive mode (also known as "hidey bar" mode).
 *//*from  w  w  w.  j a  v  a 2 s. c  o  m*/
public static void toggleHideyBar(Window window, String TAG) {

    // The UI options currently enabled are represented by a bitfield.
    // getSystemUiVisibility() gives us that bitfield.
    int uiOptions = window.getDecorView().getSystemUiVisibility();
    int newUiOptions = uiOptions;
    boolean isImmersiveModeEnabled = ((uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) == uiOptions);
    if (isImmersiveModeEnabled) {
        Log.i(TAG, "Turning immersive mode mode off. ");
    } else {
        Log.i(TAG, "Turning immersive mode mode on.");
    }

    // Navigation bar hiding:  Backwards compatible to ICS.
    if (Build.VERSION.SDK_INT >= 14) {
        newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }

    // Status bar hiding: Backwards compatible to Jellybean
    if (Build.VERSION.SDK_INT >= 16) {
        newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    // Immersive mode: Backward compatible to KitKat.
    // Note that this flag doesn't do anything by itself, it only augments the behavior
    // of HIDE_NAVIGATION and FLAG_FULLSCREEN.  For the purposes of this sample
    // all three flags are being toggled together.
    // Note that there are two immersive mode UI flags, one of which is referred to as "sticky".
    // Sticky immersive mode differs in that it makes the navigation and status bars
    // semi-transparent, and the UI flag does not get cleared when the user interacts with
    // the screen.
    if (Build.VERSION.SDK_INT >= 18) {
        newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    }

    window.getDecorView().setSystemUiVisibility(newUiOptions);
}

From source file:Main.java

public static void onResume(Dialog dialog) {
    View decorView = dialog.getWindow().getDecorView();
    dialog.getWindow().setFlags(FLAG_NOT_FOCUSABLE, FLAG_NOT_FOCUSABLE);
    dialog.setOnShowListener(d -> dialog.getWindow().clearFlags(FLAG_NOT_FOCUSABLE));
    hideSystemUI(decorView);/*from  w  w w . j  ava2 s  . c  o m*/
    decorView.setOnSystemUiVisibilityChangeListener(visibility -> {
        if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
            hideSystemUI(decorView);
        }
    });
}

From source file:Main.java

/**
 * Sets the Android fullscreen flags. Expected to be called from {@link
 * Activity#onWindowFocusChanged(boolean hasFocus)}.
 *
 * @param activity the Activity on which the full screen mode will be set.
 * @param hasFocus the hasFocus flag passed from the {@link Activity#onWindowFocusChanged(boolean
 *                 hasFocus)} callback.//from   w  w w  .j a v a  2  s  .co  m
 */
public static void setFullScreenOnWindowFocusChanged(Activity activity, boolean hasFocus) {
    if (hasFocus) {
        // https://developer.android.com/training/system-ui/immersive.html#sticky
        activity.getWindow().getDecorView().setSystemUiVisibility(
                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 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
}

From source file:Main.java

private static void hideSystemUI(View view) {
    view.setSystemUiVisibility(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 | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}

From source file:MainActivity.java

private void hideSystemUi() {
    getWindow().getDecorView()/*from ww  w.j a  va2  s  .c o m*/
            .setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | 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);
}

From source file:io.argonjs.example.ExampleActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
    decorView.setSystemUiVisibility(uiOptions);

    String version = Vuforia.getLibraryVersion();
    System.out.println("version: " + version);

    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {

        initializeVuforia();//from w  w w . j  av a 2  s  . c o  m

    } else {

        // Should we show an explanation?
        if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.CAMERA)) {

            Toast.makeText(this, "Your camera is used to provide an augmented reality experience",
                    Toast.LENGTH_LONG).show();
        }

        ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.CAMERA },
                PERMISSIONS_REQUEST_CAMERA);
    }
}

From source file:ca.frozen.curlingtv.activities.VideoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // configure the activity
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video);
    Log.d(TAG, "onCreate");

    // load the settings and cameras
    Utils.loadData();/*www .  ja  v a 2  s .c  o  m*/

    // get the camera object
    Bundle data = getIntent().getExtras();
    camera = data.getParcelable(CAMERA);

    // get the frame layout, handle system visibility changes
    frameLayout = (FrameLayout) findViewById(R.id.video);
    frameLayout.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                videoFragment.startFadeIn();
            }
        }
    });

    // set full screen layout
    int visibility = frameLayout.getSystemUiVisibility();
    visibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
    frameLayout.setSystemUiVisibility(visibility);

    // create the video fragment
    videoFragment = videoFragment.newInstance(camera, true);
    FragmentTransaction fragTran = getSupportFragmentManager().beginTransaction();
    fragTran.add(R.id.video, videoFragment);
    fragTran.commit();
}

From source file:ca.frozen.rpicameraviewer.activities.VideoActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    // configure the activity
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video);
    //Log.d(TAG, "onCreate");

    // load the settings and cameras
    Utils.loadData();/*ww  w.j  ava2 s .  co  m*/

    // get the camera object
    Bundle data = getIntent().getExtras();
    camera = data.getParcelable(CAMERA);

    // get the frame layout, handle system visibility changes
    frameLayout = (FrameLayout) findViewById(R.id.video);
    frameLayout.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                videoFragment.startFadeIn();
            }
        }
    });

    // set full screen layout
    int visibility = frameLayout.getSystemUiVisibility();
    visibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
    frameLayout.setSystemUiVisibility(visibility);

    // create the video fragment
    videoFragment = videoFragment.newInstance(camera, true);
    FragmentTransaction fragTran = getSupportFragmentManager().beginTransaction();
    fragTran.add(R.id.video, videoFragment);
    fragTran.commit();
}