mac
2024-03-11 7c2dce60eeb3b3b54c52890ece8aa472d5512a04
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.hdl.photovoltaic.base;
 
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
 
import androidx.annotation.NonNull;
 
import com.hdl.photovoltaic.R;
 
public class BaseDialog extends Dialog {
 
    private Context mContext;
 
    public BaseDialog(@NonNull Context context, int themeResId) {
        super(context, themeResId);
        this.mContext = context;
        setStatusBarTextColor();
        setNotificationBarBackgroundColor(CustomColor.white);
    }
 
    /**
     * 修改状态栏字体颜色(黑色)
     */
    public void setStatusBarTextColor() {
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    }
 
    /**
     * 设置通知栏背景颜色
     *
     * @param color 颜色值(0=蓝色;1=白色;)
     */
    public void setNotificationBarBackgroundColor(CustomColor color) {
        switch (color) {
            case blue: {
                getWindow().setStatusBarColor(this.mContext.getColor(R.color.text_245EC3));
                break;
            }
            case white: {
                getWindow().setStatusBarColor(this.mContext.getColor(R.color.text_FFFFFFFF));
                break;
            }
        }
 
    }
 
    public enum CustomColor {
        blue,//蓝色
        white,//白色
 
 
    }
}