package com.colorful.keyboard.theme.myutil;

import android.app.Activity;
import android.os.Build;
import android.view.View;

public class ConfigImmUtils {

    public static void setMyStatusBar(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            View decorView = activity.getWindow().getDecorView();
            //修改状态栏颜色只需要这行代码
            activity.getWindow().setStatusBarColor(activity.getResources().getColor(android.R.color.white));//这里对应的是状态栏的颜色，就是style中colorPrimaryDark的颜色
            if (decorView != null) {
                int vis = decorView.getSystemUiVisibility();
                vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
                decorView.setSystemUiVisibility(vis);
            }
        }
    }

    public static void setMyStatusBarTransparent(Activity activity) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            View decorView = activity.getWindow().getDecorView();
            //修改状态栏颜色只需要这行代码
            activity.getWindow().setStatusBarColor(activity.getResources().getColor(android.R.color.transparent));//这里对应的是状态栏的颜色，就是style中colorPrimaryDark的颜色
            if (decorView != null) {
                int vis = decorView.getSystemUiVisibility();
                vis |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
                decorView.setSystemUiVisibility(vis);
            }
        }
    }
}