Example usage for android.view Window getNavigationBarColor

List of usage examples for android.view Window getNavigationBarColor

Introduction

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

Prototype

@ColorInt
public abstract int getNavigationBarColor();

Source Link

Usage

From source file:Main.java

/**
 * @see android.view.Window#setStatusBarColor(int color).
 *//*from  w w w .j ava2  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);
    }
}