Example usage for android.view Window clearFlags

List of usage examples for android.view Window clearFlags

Introduction

In this page you can find the example usage for android.view Window clearFlags.

Prototype

public void clearFlags(int flags) 

Source Link

Document

Convenience function to clear the flag bits as specified in flags, as per #setFlags .

Usage

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 ava  2s .  co  m
}

From source file:Main.java

public static void requestFullscreen(final Activity pActivity) {
    final Window window = pActivity.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    window.requestFeature(Window.FEATURE_NO_TITLE);
}

From source file:Main.java

public static void requestFullscreen(final Activity mActivity) {
    final Window window = mActivity.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
    window.requestFeature(Window.FEATURE_NO_TITLE);
}

From source file:Main.java

public static void setStatusBarColor(Activity activity, int colorResource) {
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Window window = activity.getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(colorResource);
    }//from www.  j  ava2  s.c  o  m
}

From source file:com.microsoft.mimickeralarm.utilities.GeneralUtilities.java

public static void clearLockScreenFlags(Window window) {
    window.clearFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    window.clearFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    window.clearFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
}

From source file:com.stockita.stockitapointofsales.utilities.Utility.java

/**
 * This method to will set the color of the statusbar to
 *//*from  www  .  j a  v a  2  s  .com*/
public static void changeTheStatusbarColor(Activity activity, int colorResource) {
    /**
     * Change the color of the status bar
     */
    Window window = activity.getWindow();
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    if (Build.VERSION.SDK_INT >= 23) {
        window.setStatusBarColor(ContextCompat.getColor(activity, colorResource));
    } else {
        window.setStatusBarColor(activity.getResources().getColor(colorResource));
    }
}

From source file:Main.java

public static void initSystemBar(Activity activity) {
    if (android.os.Build.VERSION.SDK_INT > 18 && android.os.Build.VERSION.SDK_INT < 21) {
        Window window = activity.getWindow();
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    } else if (android.os.Build.VERSION.SDK_INT >= 21) {
        Window window = activity.getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(Color.TRANSPARENT);
    }/*from w ww. j a v  a 2s .c om*/
}

From source file:Main.java

/**
 * @see android.view.Window#setStatusBarColor(int color).
 *//*w  w  w .j  ava  2  s.c om*/
public static void setStatusBarColor(Window window, int statusBarColor) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        // If both system bars are black, we can remove these from our layout,
        // removing or shrinking the SurfaceFlinger overlay required for our views.
        if (statusBarColor == Color.BLACK && window.getNavigationBarColor() == Color.BLACK) {
            window.clearFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        } else {
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        }
        window.setStatusBarColor(statusBarColor);
    }
}

From source file:Main.java

public static void setFullScreen(Activity activity, boolean isFull) {
    Window window = activity.getWindow();
    WindowManager.LayoutParams params = window.getAttributes();
    if (isFull) {
        params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
        window.setAttributes(params);/*w w w. j av a 2s  .co m*/
        window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    } else {
        params.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
        window.setAttributes(params);
        window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    }
}

From source file:com.vuze.android.remote.AndroidUtilsUI.java

public static void onCreate(Context context) {
    // AppThemeDark is LeanBack, and LeanBack is API 17
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        boolean isTV = AndroidUtils.isTV();
        if (ALWAYS_DARK || isTV) {
            context.setTheme(R.style.AppThemeDark);
            if (!isTV && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
                Window window = ((AppCompatActivity) context).getWindow();
                window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN);
            }/* w ww .  j a  v  a2s .  c o  m*/
        }
    }
}