mac
2023-11-14 54a8c79222bba0644b02fe1dbc5d75e26ea50b5d
app/src/main/java/com/hdl/photovoltaic/base/CustomBaseActivity.java
@@ -1,11 +1,15 @@
package com.hdl.photovoltaic.base;
import android.content.Context;
import android.os.Bundle;
import androidx.annotation.Nullable;
import com.hdl.photovoltaic.R;
import com.hdl.photovoltaic.utils.LocalManageUtil;
import java.util.Locale;
/**
 * 自定义方法,用于实现个性化
@@ -15,7 +19,8 @@
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setNotificationBarBackgroundColor(0);
        setNotificationBarBackgroundColor(CustomColor.blue);
    }
    /**
@@ -23,15 +28,24 @@
     *
     * @param color 颜色值(0=蓝色;1=白色;)
     */
    public void setNotificationBarBackgroundColor(int color) {
        if (color == 0) {
            color = R.color.text_245EC3;
        } else if (color == 1) {
            if (color == 1) {
                color = R.color.text_FFFFFFFF;
    public void setNotificationBarBackgroundColor(CustomColor color) {
        switch (color) {
            case blue: {
                getWindow().setStatusBarColor(getColor(R.color.text_245EC3));
                break;
            }
            case white: {
                getWindow().setStatusBarColor(getColor(R.color.text_FFFFFFFF));
                break;
            }
        }
        getWindow().setStatusBarColor(getColor(color));
    }
    public enum CustomColor {
        blue,//蓝色
        white,//白色
    }
}