List of usage examples for android.view Window setStatusBarColor
public abstract void setStatusBarColor(@ColorInt int color);
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); }/*w w w . j a v a 2 s . c om*/ }
From source file:enterprayz.megatools.Tools.java
public static void setStatusBarColor(Activity activity, int resColor) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setTranslucentStatus(activity, true); Window window = activity.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); activity.getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); window.setStatusBarColor(ContextCompat.getColor(activity, resColor)); }//from w ww . ja va 2 s . co m }
From source file:org.bottiger.podcast.utils.UIUtils.java
public static void tintStatusBar(int argColor, Activity argActivity) { if (Build.VERSION.SDK_INT >= 22) { Window window = argActivity.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(argColor); }/*from w w w. j a va2s . c o m*/ }
From source file:Main.java
/** * @see android.view.Window#setStatusBarColor(int color). *//*from w w w.ja v a2s . c o m*/ 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 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 ava 2s . c o m*/ }
From source file:com.miz.utils.ViewUtils.java
public static void setToolbarAndStatusBarColor(android.support.v7.app.ActionBar actionBar, Window window, int color) { if (color != 0) { actionBar.setBackgroundDrawable(new ColorDrawable(color)); if (MizLib.hasLollipop()) window.setStatusBarColor(color); }// w w w .j a v a2 s .c o m }
From source file:me.henrytao.mdcore.core.MdCompat.java
public static void enableTranslucentStatus(Activity activity) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = activity.getWindow(); window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(Color.TRANSPARENT); }/*from w w w. java 2 s. c o m*/ }
From source file:org.huxizhijian.sdk.util.StatusBarUtil.java
public static void setFullScreen(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_STABLE); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.TRANSPARENT); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // ???,? ContentView ? activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); }//w w w.j a v a 2 s. co m }
From source file:com.adithya321.sharesanalysis.fragments.ChartsFragment.java
@Nullable @Override/* w w w. j a v a2s .c o m*/ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_charts, container, false); Window window = getActivity().getWindow(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) window.setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark)); ((AppCompatActivity) getActivity()).getSupportActionBar() .setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.colorPrimary))); return root; }
From source file:com.devolta.dailyremind.AboutActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);//from w w w . j a v a 2s . co m if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark)); } FirebaseAnalytics mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); mFirebaseAnalytics.setAnalyticsCollectionEnabled(true); }