Example usage for android.view View SYSTEM_UI_FLAG_HIDE_NAVIGATION

List of usage examples for android.view View SYSTEM_UI_FLAG_HIDE_NAVIGATION

Introduction

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

Prototype

int SYSTEM_UI_FLAG_HIDE_NAVIGATION

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

Click Source Link

Document

Flag for #setSystemUiVisibility(int) : View has requested that the system navigation be temporarily hidden.

Usage

From source file:com.tealeaf.TeaLeaf.java

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        logger.log("{focus} Gained focus");
        ActivityState.onWindowFocusAcquired();
        if (ActivityState.hasResumed(true)) {
            onRealResume();//from  w w  w.ja va2 s . c om
        }
        registerScreenOffReceiver();

        // always send acquired focus event
        EventQueue.pushEvent(new WindowFocusAcquiredEvent());

        // games are inherently full screen and immersive, hide OS UI bars
        if (isFullScreen && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            int uiFlag = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                uiFlag |= View.SYSTEM_UI_FLAG_FULLSCREEN;
                uiFlag |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
                uiFlag |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
                uiFlag |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                    uiFlag |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
                }
            }
            getWindow().getDecorView().setSystemUiVisibility(uiFlag);
        }
    } else {
        logger.log("{focus} Lost focus");
        ActivityState.onWindowFocusLost();
        pause();
        unregisterReceiver(screenOffReciever);
        if (jsRunning) {
            //always send lost focus event
            String[] events = { new WindowFocusLostEvent().pack() };

            // DANGER: Calling dispatchEvents() is NOT thread-safe.
            // Doing it here because the GLThread is paused.
            NativeShim.dispatchEvents(events);
        }
    }
}

From source file:com.cerema.cloud2.ui.preview.PreviewImageActivity.java

@SuppressLint("InlinedApi")
public void toggleFullScreen() {

    if (isHoneycombOrHigher()) {

        boolean visible = (mFullScreenAnchorView.getSystemUiVisibility()
                & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;

        if (visible) {
            hideSystemUI(mFullScreenAnchorView);
            // actionBar.hide(); // propagated through
            // OnSystemUiVisibilityChangeListener()
        } else {/*from w w  w  .j  ava 2 s . c  o  m*/
            showSystemUI(mFullScreenAnchorView);
            // actionBar.show(); // propagated through
            // OnSystemUiVisibilityChangeListener()
        }

    } else {

        ActionBar actionBar = getSupportActionBar();
        if (!actionBar.isShowing()) {
            actionBar.show();
            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);

        } else {
            actionBar.hide();
            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

        }

    }
}

From source file:com.synox.android.ui.preview.PreviewImageActivity.java

@SuppressLint("InlinedApi")
public void toggleFullScreen() {

    if (isHoneycombOrHigher()) {

        boolean visible = (mFullScreenAnchorView.getSystemUiVisibility()
                & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;

        if (visible) {
            hideSystemUI(mFullScreenAnchorView);
            // actionBar.hide(); // propagated through
            // OnSystemUiVisibilityChangeListener()
        } else {/*from  w  ww  .  jav a 2  s  .c om*/
            showSystemUI(mFullScreenAnchorView);
            // actionBar.show(); // propagated through
            // OnSystemUiVisibilityChangeListener()
        }

    } else {
        if (!getSupportActionBar().isShowing()) {
            getSupportActionBar().show();
            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);

        } else {
            getSupportActionBar().hide();
            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);

        }

    }
}

From source file:com.google.android.apps.muzei.ArtDetailFragment.java

private void showHideChrome(boolean show) {
    int flags = show ? 0 : View.SYSTEM_UI_FLAG_LOW_PROFILE;
    flags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
    if (!show) {/*from   w  w  w. j  av a 2 s  . c  o  m*/
        flags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_IMMERSIVE;
    }
    mContainerView.setSystemUiVisibility(flags);
}

From source file:com.nbplus.vbroadlauncher.RealtimeBroadcastActivity.java

private void hideSystemUI() {
    // Set the IMMERSIVE flag.m
    // Set the content to appear under the system bars so that the content
    // doesn't resize when the system bars hide and show.
    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 // hide nav bar
                    | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);
}

From source file:com.google.android.libraries.cast.companionlibrary.cast.player.VideoCastControllerActivity.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setImmersive() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        return;/*from ww w . ja va  2  s.  c om*/
    }
    int newUiOptions = getWindow().getDecorView().getSystemUiVisibility();

    // 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;
    }

    if (Build.VERSION.SDK_INT >= 18) {
        newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    }

    getWindow().getDecorView().setSystemUiVisibility(newUiOptions);
    if (Build.VERSION.SDK_INT >= 18) {
        setImmersive(true);
    }
}

From source file:org.fossasia.phimpme.leafpic.activities.PlayerActivity.java

private void hideSystemBars() {
    toolbar.animate().translationY(-toolbar.getHeight()).setInterpolator(new AccelerateInterpolator())
            .setDuration(200).start();//from  www  . j a va  2s  . c om

    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 // hide nav bar
                    | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);
}

From source file:com.horaapps.leafpic.PlayerActivity.java

private void hideControls() {
    mediaController.hide();//w  w  w.j a  v a  2s  .  c  o m
    toolbar.animate().translationY(-toolbar.getHeight()).setInterpolator(new AccelerateInterpolator())
            .setDuration(200).start();

    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 // hide nav bar
                    | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);
    fullscreen = true;
}

From source file:com.nbplus.vbroadlauncher.RealtimeBroadcastActivity.java

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        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);
    }// w  w  w .j av  a 2 s  .  c o  m
}

From source file:com.segma.trim.MainActivity.java

private void hideNavigationBar() {

    //TODO: 11-4-2016 FIX: Hide Navigation Bar
    final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN
            //| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    final View decorView = getWindow().getDecorView();
    decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
        @Override/*from   w  w w. j a  v a  2 s.  c  o m*/
        public void onSystemUiVisibilityChange(int visibility) {
            // Note that system bars will only be "visible" if none of the
            // LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set.
            if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                // TODO: The system bars are visible. Make any desired
                // adjustments to your UI, such as showing the action bar or
                // other navigational controls.

                //decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
                //decorView.setSystemUiVisibility(decorView.getSystemUiVisibility());
                //getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
                decorView.setSystemUiVisibility(flags);
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                        WindowManager.LayoutParams.FLAG_FULLSCREEN);
            } else {
                // TODO: The system bars are NOT visible. Make any desired
                // adjustments to your UI, such as hiding the action bar or
                // other navigational controls.
            }
        }
    });
    decorView.setSystemUiVisibility(flags);
}