Example usage for android.view View SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

List of usage examples for android.view View SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

Introduction

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

Prototype

int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

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

Click Source Link

Document

Flag for #setSystemUiVisibility(int) : View would like its window to be laid out as if it has requested #SYSTEM_UI_FLAG_HIDE_NAVIGATION , even if it currently hasn't.

Usage

From source file:Main.java

public static void showSystemUI(Activity act) {
    act.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}

From source file:Main.java

@TargetApi(VERSION_CODES.KITKAT)
public static void showSystemUI(Activity activity) {
    View decorView = activity.getWindow().getDecorView();
    decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}

From source file:Main.java

public static String systemUIVisibilityString(View theView) {
    int crap = theView.getWindowSystemUiVisibility();

    int duhs[] = { View.SYSTEM_UI_FLAG_LOW_PROFILE, View.SYSTEM_UI_FLAG_HIDE_NAVIGATION,
            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_IMMERSIVE, View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY };
    String result = "OK: 0";

    for (int duh : duhs) {
        if ((crap & duh) == duh) {
            switch (duh) {
            case View.SYSTEM_UI_FLAG_LOW_PROFILE:
                result += " | SYSTEM_UI_FLAG_LOW_PROFILE";
                break;
            case View.SYSTEM_UI_FLAG_HIDE_NAVIGATION:
                result += " | SYSTEM_UI_FLAG_HIDE_NAVIGATION";
                break;
            case View.SYSTEM_UI_FLAG_FULLSCREEN:
                result += " | SYSTEM_UI_FLAG_FULLSCREEN";
                break;
            case View.SYSTEM_UI_FLAG_LAYOUT_STABLE:
                result += " | SYSTEM_UI_FLAG_LAYOUT_STABLE";
                break;
            case View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION:
                result += " | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION";
                break;
            case View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN:
                result += " | SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN";
                break;
            case View.SYSTEM_UI_FLAG_IMMERSIVE:
                result += " | SYSTEM_UI_FLAG_IMMERSIVE";
                break;
            case View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY:
                result += " | SYSTEM_UI_FLAG_IMMERSIVE_STICKY";
                break;
            }/*from ww  w.  java 2 s .c om*/
        }
    }

    return result;
}

From source file:Main.java

@TargetApi(VERSION_CODES.KITKAT)
public static void hideSystemUI(Activity activity) {
    // Set the IMMERSIVE flag.
    // Set the content to appear under the system bars so that the content
    // doesn't resize when the system bars hideSelf and show.
    View decorView = activity.getWindow().getDecorView();
    decorView.setSystemUiVisibility(//from   w w w  .  j  a v  a 2 s.  com
            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 // hideSelf nav bar
                    | View.SYSTEM_UI_FLAG_FULLSCREEN // hideSelf status bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);
}

From source file:Main.java

@TargetApi(19)
public static void transparencyBar(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = activity.getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                | WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(Color.TRANSPARENT);
        window.setNavigationBarColor(Color.TRANSPARENT);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window window = activity.getWindow();
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }//from ww w  .j  a v a2  s .  c o  m
}

From source file:Main.java

@SuppressLint("InlinedApi")
public static void makeFullscreen(Activity activity) {
    //      if (!SkyUtility.isNexus()) return;
    //      if (SkyUtility.isNexusTablet()) return;
    activity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    if (Build.VERSION.SDK_INT >= 19) {
        activity.getWindow().getDecorView()
                .setSystemUiVisibility(View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
    } else if (Build.VERSION.SDK_INT >= 11) {
        activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    }/*w  w  w  .  ja  va 2 s . com*/
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.KITKAT)
public static void setImmersiveStickyWithActionBar(Window w) {
    w.getDecorView()//from w  ww.  ja va 2 s.  co  m
            .setSystemUiVisibility(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

@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

/**
 * 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  a2  s. c  om*/
 */
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);
    }
}