添加调色板对话框,未调试。

This commit is contained in:
2025-12-16 12:11:32 +08:00
parent 70a004d9e3
commit 8e1d6ba197
14 changed files with 758 additions and 6 deletions

View File

@@ -15,7 +15,6 @@ import android.os.Looper;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.FileProvider;
@@ -24,6 +23,7 @@ import cc.winboll.studio.libappbase.ToastUtils;
import cc.winboll.studio.powerbell.App;
import cc.winboll.studio.powerbell.R;
import cc.winboll.studio.powerbell.dialogs.BackgroundPicturePreviewDialog;
import cc.winboll.studio.powerbell.dialogs.ColorPaletteDialog;
import cc.winboll.studio.powerbell.dialogs.YesNoAlertDialog;
import cc.winboll.studio.powerbell.models.BackgroundBean;
import cc.winboll.studio.powerbell.utils.BackgroundSourceUtils;
@@ -864,5 +864,22 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
doubleRefreshPreview();
isPreviewBackgroundChanged = true;
}
public void onColorPaletteDialog(View view) {
// 初始颜色(白色,含透明度)
//int initialColor = 0xFFFFFFFF;
int initialColor = mBgSourceUtils.getPreviewBackgroundBean().getPixelColor();
// 显示对话框
ColorPaletteDialog dialog = new ColorPaletteDialog(this, initialColor, new ColorPaletteDialog.OnColorSelectedListener() {
@Override
public void onColorSelected(int color) {
// 回调返回 0xAARRGGBB 格式颜色,直接使用
mBgSourceUtils.getPreviewBackgroundBean().setPixelColor(color);
doubleRefreshPreview();
LogUtils.d("选择颜色", String.format("#%08X", color));
}
});
dialog.show();
}
}

View File

@@ -0,0 +1,356 @@
package cc.winboll.studio.powerbell.dialogs;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.powerbell.R;
/**
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
* @Date 2025/12/16 11:47
* @Describe 调色板对话框支持颜色拾取、RGB输入、透明度/色阶调节,兼容 API29-30+ 小米机型)
*/
public class ColorPaletteDialog extends Dialog implements View.OnClickListener {
// ====================== 常量/成员变量 ======================
private static final String TAG = "ColorPaletteDialog";
private static final int MAX_PROGRESS = 255; // 透明度/色阶最大值0-255
private OnColorSelectedListener mListener; // 颜色选择回调接口
private int mInitialColor; // 初始颜色含透明度默认白色0xFFFFFFFF
private int mCurrentColor; // 当前选择的颜色
// 控件引用
private ImageView ivColorPicker; // 颜色拾取框(点击选色)
private EditText etR, etG, etB; // RGB 颜色输入框
private EditText etColorValue; // 颜色值输入框(如 #FFFFFF
private SeekBar sbAlpha; // 透明度进度条0=全透明255=不透明)
private SeekBar sbBrightness; // 色阶进度条调节亮度0=最暗255=最亮)
private TextView tvConfirm; // 确认按钮
private TextView tvCancel; // 取消按钮
// ====================== 回调接口 ======================
/**
* 颜色选择完成回调接口
*/
public interface OnColorSelectedListener {
void onColorSelected(int color); // 返回 0xAARRGGBB 格式颜色
}
// ====================== 构造方法 ======================
public ColorPaletteDialog(Context context, int initialColor, OnColorSelectedListener listener) {
super(context, R.style.CustomDialogStyle);
this.mInitialColor = initialColor;
this.mCurrentColor = initialColor;
this.mListener = listener;
if (mListener == null) {
throw new IllegalArgumentException("OnColorSelectedListener 不能为 null");
}
}
// ====================== 生命周期 ======================
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_color_palette, null);
setContentView(view);
initView(view);
initData();
adjustDialogSize();
}
// ====================== 初始化方法 ======================
private void initView(View view) {
// 颜色拾取框
ivColorPicker = view.findViewById(R.id.iv_color_picker);
ivColorPicker.setOnClickListener(this);
// RGB 输入框
etR = view.findViewById(R.id.et_r);
etG = view.findViewById(R.id.et_g);
etB = view.findViewById(R.id.et_b);
setEditTextWatcher(etR);
setEditTextWatcher(etG);
setEditTextWatcher(etB);
// 颜色值输入框
etColorValue = view.findViewById(R.id.et_color_value);
etColorValue.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
parseColorFromStr(s.toString().trim());
}
});
// 透明度进度条
sbAlpha = view.findViewById(R.id.sb_alpha);
sbAlpha.setMax(MAX_PROGRESS);
sbAlpha.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) updateColorByAlpha(progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
});
// 色阶进度条
sbBrightness = view.findViewById(R.id.sb_brightness);
sbBrightness.setMax(MAX_PROGRESS);
sbBrightness.setProgress(128);
sbBrightness.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) updateColorByBrightness(progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
});
// 按钮
tvConfirm = view.findViewById(R.id.tv_confirm);
tvCancel = view.findViewById(R.id.tv_cancel);
tvConfirm.setOnClickListener(this);
tvCancel.setOnClickListener(this);
}
private void initData() {
ivColorPicker.setBackgroundColor(mInitialColor);
int alpha = Color.alpha(mInitialColor);
int r = Color.red(mInitialColor);
int g = Color.green(mInitialColor);
int b = Color.blue(mInitialColor);
etR.setText(String.valueOf(r));
etG.setText(String.valueOf(g));
etB.setText(String.valueOf(b));
etColorValue.setText(String.format("#%08X", mInitialColor));
sbAlpha.setProgress(alpha);
}
private void adjustDialogSize() {
Window window = getWindow();
if (window != null) {
WindowManager.LayoutParams lp = window.getAttributes();
lp.width = (int) (getContext().getResources().getDisplayMetrics().widthPixels * 0.8);
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setAttributes(lp);
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
}
}
// ====================== 颜色逻辑处理 ======================
private void parseColorFromStr(String colorStr) {
if (TextUtils.isEmpty(colorStr)) return;
try {
if (!colorStr.startsWith("#")) colorStr = "#" + colorStr;
int color = Color.parseColor(colorStr);
if (colorStr.length() == 7) { // #RRGGBB 补全透明度
color = Color.argb(Color.alpha(mCurrentColor), Color.red(color), Color.green(color), Color.blue(color));
}
updateCurrentColor(color, true);
} catch (IllegalArgumentException e) {
LogUtils.e(TAG, "颜色格式错误:" + colorStr, e);
}
}
private void updateColorByRGB() {
try {
int r = parseInputValue(etR.getText().toString(), 0, MAX_PROGRESS);
int g = parseInputValue(etG.getText().toString(), 0, MAX_PROGRESS);
int b = parseInputValue(etB.getText().toString(), 0, MAX_PROGRESS);
int alpha = Color.alpha(mCurrentColor);
int newColor = Color.argb(alpha, r, g, b);
updateCurrentColor(newColor, true);
} catch (Exception e) {
LogUtils.e(TAG, "RGB 更新失败", e);
}
}
private void updateColorByAlpha(int alpha) {
int r = Color.red(mCurrentColor);
int g = Color.green(mCurrentColor);
int b = Color.blue(mCurrentColor);
updateCurrentColor(Color.argb(alpha, r, g, b), true);
}
private void updateColorByBrightness(int brightness) {
float factor = brightness / 128f;
int alpha = Color.alpha(mCurrentColor);
int r = adjustBrightness(Color.red(mCurrentColor), factor);
int g = adjustBrightness(Color.green(mCurrentColor), factor);
int b = adjustBrightness(Color.blue(mCurrentColor), factor);
updateCurrentColor(Color.argb(alpha, r, g, b), false);
}
private int adjustBrightness(int colorComponent, float factor) {
int newComponent = (int) (colorComponent * factor);
return Math.min(Math.max(newComponent, 0), MAX_PROGRESS);
}
private void updateCurrentColor(int newColor, boolean updateBrightness) {
mCurrentColor = newColor;
// 更新拾取框
ivColorPicker.setBackgroundColor(newColor);
// 更新 RGB 输入框
etR.setText(String.valueOf(Color.red(newColor)));
etG.setText(String.valueOf(Color.green(newColor)));
etB.setText(String.valueOf(Color.blue(newColor)));
// 更新颜色值输入框
etColorValue.setText(String.format("#%08X", newColor));
// 更新透明度进度条(避免循环)
sbAlpha.setOnSeekBarChangeListener(null);
sbAlpha.setProgress(Color.alpha(newColor));
sbAlpha.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) updateColorByAlpha(progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
});
// 更新色阶进度条
if (updateBrightness) {
sbBrightness.setOnSeekBarChangeListener(null);
sbBrightness.setProgress(128);
sbBrightness.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (fromUser) updateColorByBrightness(progress);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {}
});
}
}
private int parseInputValue(String input, int min, int max) {
if (TextUtils.isEmpty(input)) return min;
try {
int value = Integer.parseInt(input);
return Math.min(Math.max(value, min), max);
} catch (NumberFormatException e) {
return min;
}
}
// ====================== 控件监听 ======================
private void setEditTextWatcher(EditText editText) {
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {}
@Override
public void afterTextChanged(Editable s) {
updateColorByRGB();
}
});
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.iv_color_picker) {
showSystemColorPicker();
} else if (id == R.id.tv_confirm) {
if (mListener != null) mListener.onColorSelected(mCurrentColor);
dismiss();
} else if (id == R.id.tv_cancel) {
dismiss();
}
}
/**
* 修正后:系统颜色选择器(无 API29+ 方法,全版本兼容)
*/
private void showSystemColorPicker() {
final android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(getContext());
builder.setTitle("选择颜色");
final int[] systemColors = {
0xFFFFFFFF, 0xFF000000, 0xFFFF0000, 0xFF00FF00, 0xFF0000FF,
0xFFFFFF00, 0xFFFF00FF, 0xFF00FFFF, 0xFF888888, 0xFFAAAAAA
};
// 横向布局存放颜色按钮
LinearLayout colorView = new LinearLayout(getContext());
colorView.setOrientation(LinearLayout.HORIZONTAL);
colorView.setGravity(Gravity.CENTER);
colorView.setPadding(dp2px(10), dp2px(10), dp2px(10), dp2px(10));
// 循环添加颜色按钮(用 LayoutParams 设置边距)
for (int i = 0; i < systemColors.length; i++) {
ImageView iv = new ImageView(getContext());
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
dp2px(40), dp2px(40)
);
// 非最后一个按钮设置右侧边距 10dp
if (i != systemColors.length - 1) {
lp.setMargins(0, 0, dp2px(10), 0);
}
iv.setLayoutParams(lp);
iv.setBackgroundColor(systemColors[i]);
iv.setClickable(true);
iv.setFocusable(true);
// 点击选择颜色
final int finalI = i;
iv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int selectedColor = systemColors[finalI];
int newColor = Color.argb(
Color.alpha(mCurrentColor),
Color.red(selectedColor),
Color.green(selectedColor),
Color.blue(selectedColor)
);
updateCurrentColor(newColor, true);
builder.create().dismiss();
}
});
colorView.addView(iv);
}
builder.setView(colorView)
.setNegativeButton("取消", null)
.show();
}
// ====================== 工具方法 ======================
private int dp2px(float dp) {
return (int) (dp * getContext().getResources().getDisplayMetrics().density + 0.5f);
}
// ====================== 内存优化 ======================
@Override
public void dismiss() {
super.dismiss();
mListener = null;
}
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/darker_gray" />
<corners android:radius="6dp" />
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/holo_blue_light" />
<corners android:radius="6dp" />
</shape>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 背景色:白色 -->
<solid android:color="@android:color/white" />
<!-- 圆角12dp适配小米机型圆角无锯齿 -->
<corners android:radius="12dp" />
<!-- 边框:浅灰色细边框(避免弹窗边缘模糊) -->
<stroke
android:width="1dp"
android:color="@android:color/darker_gray" />
<!-- 内边距:轻微留白,避免内容贴边 -->
<padding
android:bottom="5dp"
android:top="5dp" />
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:radius="6dp" />
<stroke
android:width="1dp"
android:color="@android:color/darker_gray" />
</shape>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 进度条未完成部分:浅灰色 -->
<item android:id="@android:id/background">
<shape android:shape="rectangle">
<solid android:color="@android:color/darker_gray" />
<corners android:radius="10dp" />
</shape>
</item>
<!-- 进度条已完成部分:系统蓝色(无需额外定义颜色) -->
<item android:id="@android:id/progress">
<clip>
<shape android:shape="rectangle">
<solid android:color="@android:color/holo_blue_light" />
<corners android:radius="10dp" />
</shape>
</clip>
</item>
</layer-list>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<!-- 滑块颜色:系统蓝色 -->
<solid android:color="@android:color/holo_blue_light" />
<!-- 滑块大小20dp适配小米机型触摸区域 -->
<size
android:width="20dp"
android:height="20dp" />
<!-- 白色边框:区分滑块与进度条 -->
<stroke
android:width="2dp"
android:color="@android:color/white" />
</shape>

View File

@@ -117,6 +117,15 @@
android:layout_margin="5dp"
android:id="@+id/activitybackgroundpictureAButton7"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"
android:text="[©]"
android:layout_gravity="center_vertical"
android:layout_margin="5dp"
android:id="@+id/activitybackgroundsettingsAButton1"
android:onClick="onColorPaletteDialog"/>
<cc.winboll.studio.libaes.views.AButton
android:layout_width="50dp"
android:layout_height="36dp"

View File

@@ -0,0 +1,207 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="20dp"
android:background="@drawable/dialog_bg_radius">
<!-- 标题 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="调色板"
android:textSize="18sp"
android:textColor="@color/black"
android:textStyle="bold"
android:layout_marginBottom="20dp"/>
<!-- 颜色拾取框 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="颜色拾取:"
android:textSize="14sp"
android:textColor="@color/gray_700"
android:layout_marginRight="10dp"/>
<ImageView
android:id="@+id/iv_color_picker"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@color/white"
android:scaleType="fitXY"
android:clickable="true"
android:focusable="true"
android:padding="2dp"
android:backgroundTint="@color/gray_200"/>
</LinearLayout>
<!-- RGB 输入框 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RGB"
android:textSize="14sp"
android:textColor="@color/gray_700"
android:layout_marginRight="10dp"/>
<EditText
android:id="@+id/et_r"
android:layout_width="60dp"
android:layout_height="40dp"
android:hint="R"
android:inputType="number"
android:maxLength="3"
android:gravity="center"
android:textSize="14sp"
android:background="@drawable/edittext_bg"
android:padding="5dp"
android:layout_marginRight="10dp"/>
<EditText
android:id="@+id/et_g"
android:layout_width="60dp"
android:layout_height="40dp"
android:hint="G"
android:inputType="number"
android:maxLength="3"
android:gravity="center"
android:textSize="14sp"
android:background="@drawable/edittext_bg"
android:padding="5dp"
android:layout_marginRight="10dp"/>
<EditText
android:id="@+id/et_b"
android:layout_width="60dp"
android:layout_height="40dp"
android:hint="B"
android:inputType="number"
android:maxLength="3"
android:gravity="center"
android:textSize="14sp"
android:background="@drawable/edittext_bg"
android:padding="5dp"/>
</LinearLayout>
<!-- 颜色值输入框 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="颜色值:"
android:textSize="14sp"
android:textColor="@color/gray_700"
android:layout_marginRight="10dp"/>
<EditText
android:id="@+id/et_color_value"
android:layout_width="match_parent"
android:layout_height="40dp"
android:hint="#AARRGGBB"
android:inputType="text"
android:maxLength="9"
android:gravity="center"
android:textSize="14sp"
android:background="@drawable/edittext_bg"
android:padding="5dp"/>
</LinearLayout>
<!-- 透明度进度条 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="透明度0-255"
android:textSize="14sp"
android:textColor="@color/gray_700"
android:layout_marginBottom="5dp"/>
<SeekBar
android:id="@+id/sb_alpha"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/seekbar_progress"
android:thumb="@drawable/seekbar_thumb"/>
</LinearLayout>
<!-- 色阶进度条 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="色阶(亮度)"
android:textSize="14sp"
android:textColor="@color/gray_700"
android:layout_marginBottom="5dp"/>
<SeekBar
android:id="@+id/sb_brightness"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/seekbar_progress"
android:thumb="@drawable/seekbar_thumb"/>
</LinearLayout>
<!-- 按钮区域 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="end">
<TextView
android:id="@+id/tv_cancel"
android:layout_width="80dp"
android:layout_height="40dp"
android:text="取消"
android:gravity="center"
android:textSize="14sp"
android:textColor="@color/gray_700"
android:background="@drawable/btn_bg_gray"
android:layout_marginRight="10dp"/>
<TextView
android:id="@+id/tv_confirm"
android:layout_width="80dp"
android:layout_height="40dp"
android:text="确认"
android:gravity="center"
android:textSize="14sp"
android:textColor="@color/white"
android:background="@drawable/btn_bg_primary"/>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center"
android:padding="10dp">
</LinearLayout>

View File

@@ -58,9 +58,73 @@
<color name="colorUsege">@color/colorRed</color>
<color name="colorCurrent">@color/colorBlue</color>
<color name="colorCharge">@color/colorYellow</color>
<!--CustomSlideToUnlockView控件配置-->
<color name="colorCustomSlideToUnlockViewWhite">#FFFFFFFF</color>
<!---->
<!-- ============== 基础黑白(必含,适配文字/背景) ============== -->
<color name="white">#FFFFFF</color> <!-- 纯白色(文字/背景) -->
<color name="black">#000000</color> <!-- 近黑色(重要文字) -->
<!-- ============== 基础色系(按钮/强调色常用) ============== -->
<!-- 蓝色系(常用:确认/链接/主题色) -->
<color name="blue_light">#4A90E2</color> <!-- 浅蓝(次要按钮) -->
<color name="blue_normal">#2196F3</color> <!-- 标准蓝(主题/确认按钮) -->
<color name="blue_dark">#1976D2</color> <!-- 深蓝(按压态/重要强调) -->
<!-- 绿色系(常用:成功/完成/安全提示) -->
<color name="green_light">#66BB6A</color> <!-- 浅绿(次要成功态) -->
<color name="green_normal">#4CAF50</color> <!-- 标准绿(成功按钮/提示) -->
<color name="green_dark">#388E3C</color> <!-- 深绿(按压态/重要成功) -->
<!-- 红色系(常用:错误/警告/删除按钮) -->
<color name="red_light">#EF5350</color> <!-- 浅红(次要错误提示) -->
<color name="red_normal">#F44336</color> <!-- 标准红(删除/错误按钮) -->
<color name="red_dark">#D32F2F</color> <!-- 深红(按压态/重要错误) -->
<!-- 黄色系(常用:警告/提醒/高亮) -->
<color name="yellow_light">#FFF59D</color> <!-- 浅黄(次要提醒) -->
<color name="yellow_normal">#FFC107</color> <!-- 标准黄(警告提示/高亮) -->
<color name="yellow_dark">#FFA000</color> <!-- 深黄(重要警告) -->
<!-- 橙色系(常用:提醒/进度/活力色) -->
<color name="orange_normal">#FF9800</color> <!-- 标准橙(提醒按钮/进度) -->
<!-- 紫色系(常用:特殊强调/个性按钮) -->
<color name="purple_normal">#9C27B0</color> <!-- 标准紫(特殊功能按钮) -->
<!-- ============== 透明色(遮罩/背景叠加) ============== -->
<color name="transparent">#00000000</color> <!-- 全透明 -->
<color name="black_transparent_50">#80000000</color> <!-- 50%透明黑(遮罩) -->
<!-- 1. 不透明灰色(常用深浅梯度,直接用) -->
<color name="gray_100">#F5F5F5</color> <!-- 极浅灰(接近白色,背景用) -->
<color name="gray_200">#EEEEEE</color> <!-- 浅灰(卡片/分割线背景) -->
<color name="gray_300">#E0E0E0</color> <!-- 中浅灰(边框/次要背景) -->
<color name="gray_400">#BDBDBD</color> <!-- 中灰(次要文字/图标) -->
<color name="gray_500">#9E9E9E</color> <!-- 标准中灰(常用辅助文字) -->
<color name="gray_600">#757575</color> <!-- 中深灰(常规辅助文字) -->
<color name="gray_700">#616161</color> <!-- 深灰(重要辅助文字) -->
<color name="gray_800">#424242</color> <!-- 极深灰(接近黑色,标题副文本) -->
<color name="gray_900">#212121</color> <!-- 近黑色(特殊场景用) -->
<!-- 2. 半透明灰色(带透明度,遮罩/蒙层用) -->
<color name="gray_transparent_30">#4D9E9E9E</color> <!-- 30%透明中灰A=4D -->
<color name="gray_transparent_50">#809E9E9E</color> <!-- 50%透明中灰A=80 -->
<color name="gray_transparent_70">#B39E9E9E</color> <!-- 70%透明中灰A=B3 -->
<color name="gray_light">#EEE</color> <!-- 等价 #EEEEEE浅灰 -->
<color name="gray_mid">#999</color> <!-- 等价 #999999中灰 -->
<color name="gray_dark">#666</color> <!-- 等价 #666666深灰 -->
<color name="gray_black">#333</color> <!-- 等价 #333333极深灰 -->
<!-- 50% 透明中灰(弹窗遮罩常用) -->
<color name="mask_gray">#809E9E9E</color>
<!-- 30% 透明深灰(背景叠加) -->
<color name="bg_overlay_gray">#4D424242</color>
<!-- 1. 常规灰色(按钮默认态,常用中灰) -->
<color name="btn_gray_normal">#9E9E9E</color>
<!-- 2. 按压深色(按钮点击态,加深一级,提升交互感) -->
<color name="btn_gray_pressed">#757575</color>
<!-- 3. 禁用灰色(按钮不可点击态,浅灰) -->
<color name="btn_gray_disabled">#E0E0E0</color>
</resources>

View File

@@ -26,4 +26,18 @@
<item name="android:textSize">@dimen/text_subtitle_size</item>
</style>
<!-- 自定义调色板对话框样式 -->
<style name="CustomDialogStyle" parent="@android:style/Theme.Dialog">
<!-- 去除标题栏 -->
<item name="android:windowNoTitle">true</item>
<!-- 背景透明(避免小米机型弹窗周围黑边) -->
<item name="android:windowBackground">@android:color/transparent</item>
<!-- 禁止弹窗全屏 -->
<item name="android:windowFullscreen">false</item>
<!-- 小米机型适配:弹窗大小自适应 -->
<item name="android:windowContentOverlay">@null</item>
<!-- 禁止触摸外部关闭(可选,避免误触) -->
<item name="android:windowCloseOnTouchOutside">false</item>
</style>
</resources>