优化颜色拾取流程
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue Dec 16 09:46:41 GMT 2025
|
||||
#Tue Dec 16 11:58:30 GMT 2025
|
||||
stageCount=7
|
||||
libraryProject=
|
||||
baseVersion=15.14
|
||||
publishVersion=15.14.6
|
||||
buildCount=52
|
||||
buildCount=63
|
||||
baseBetaVersion=15.14.7
|
||||
|
||||
@@ -668,7 +668,7 @@ public class ColorPaletteDialog extends Dialog implements View.OnClickListener,
|
||||
showSystemColorPicker(); // 打开系统颜色选择器
|
||||
} if (id == R.id.iv_color_scaler) {
|
||||
//ToastUtils.show("iv_color_scale");
|
||||
openColorPickerDialog(mCurrentColor); // 打开系统颜色选择器
|
||||
openColorScalerDialog(mCurrentColor); // 打开系统颜色选择器
|
||||
} else if (id == R.id.tv_confirm) {
|
||||
mListener.onColorSelected(mCurrentColor); // 确认选择,回调颜色
|
||||
LogUtils.d(TAG, "confirm color | 回调颜色:" + String.format("#%08X", mCurrentColor));
|
||||
@@ -683,11 +683,10 @@ public class ColorPaletteDialog extends Dialog implements View.OnClickListener,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void openColorPickerDialog(int nColor){
|
||||
void openColorScalerDialog(int nColor) {
|
||||
//ToastUtils.show("openColorPickerDialog");
|
||||
ColorPickerDialog dlg = new ColorPickerDialog(getContext(), nColor);
|
||||
final ColorScalerDialog dlg = new ColorScalerDialog(getContext(), nColor);
|
||||
dlg.setOnColorChangedListener(new com.a4455jkjh.colorpicker.view.OnColorChangedListener() {
|
||||
|
||||
@Override
|
||||
@@ -696,37 +695,53 @@ public class ColorPaletteDialog extends Dialog implements View.OnClickListener,
|
||||
|
||||
@Override
|
||||
public void onColorChanged(int color) {
|
||||
if (!isAppSelfUpdatingColor) {
|
||||
isAppSelfUpdatingColor = true;
|
||||
try {
|
||||
mOriginalAlpha = Color.alpha(color);
|
||||
mOriginalAlphaPercent = alpha2Percent(mOriginalAlpha);
|
||||
mOriginalR = Color.red(color);
|
||||
mOriginalG = Color.green(color);
|
||||
mOriginalB = Color.blue(color);
|
||||
mCurrentAlpha = mOriginalAlpha;
|
||||
mCurrentAlphaPercent = mOriginalAlphaPercent;
|
||||
mCurrentR = mOriginalR;
|
||||
mCurrentG = mOriginalG;
|
||||
mCurrentB = mOriginalB;
|
||||
mCurrentBrightnessPercent = DEFAULT_BRIGHTNESS;
|
||||
mCurrentColor = color;
|
||||
updateAllViews();
|
||||
LogUtils.d(TAG, "select system color | 选择颜色:" + String.format("#%08X", color)
|
||||
+ " | 透明度:" + mCurrentAlphaPercent + "%");
|
||||
} finally {
|
||||
isAppSelfUpdatingColor = false;
|
||||
}
|
||||
}
|
||||
dlg.currentColorScalerDialogColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterColorChanged() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
dlg.show();
|
||||
}
|
||||
|
||||
class ColorScalerDialog extends ColorPickerDialog {
|
||||
public int currentColorScalerDialogColor = 0;
|
||||
public ColorScalerDialog(Context context, int p) {
|
||||
super(context, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
int color = currentColorScalerDialogColor;
|
||||
ToastUtils.show(String.format("dismiss color %d", color));
|
||||
if (!isAppSelfUpdatingColor) {
|
||||
isAppSelfUpdatingColor = true;
|
||||
try {
|
||||
mOriginalAlpha = Color.alpha(color);
|
||||
mOriginalAlphaPercent = alpha2Percent(mOriginalAlpha);
|
||||
mOriginalR = Color.red(color);
|
||||
mOriginalG = Color.green(color);
|
||||
mOriginalB = Color.blue(color);
|
||||
mCurrentAlpha = mOriginalAlpha;
|
||||
mCurrentAlphaPercent = mOriginalAlphaPercent;
|
||||
mCurrentR = mOriginalR;
|
||||
mCurrentG = mOriginalG;
|
||||
mCurrentB = mOriginalB;
|
||||
mCurrentBrightnessPercent = DEFAULT_BRIGHTNESS;
|
||||
mCurrentColor = color;
|
||||
updateAllViews();
|
||||
LogUtils.d(TAG, "select system color | 选择颜色:" + String.format("#%08X", color)
|
||||
+ " | 透明度:" + mCurrentAlphaPercent + "%");
|
||||
} finally {
|
||||
isAppSelfUpdatingColor = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user