Colorpicker: preserve entered color

This commit is contained in:
M66B 2023-01-19 20:24:01 +01:00
parent 6aa8dc98ac
commit 3aab01aee3
2 changed files with 12 additions and 1 deletions

View File

@ -343,6 +343,17 @@ public class ColorPickerView extends View {
return Utils.adjustAlpha(this.alpha, color);
}
public int getEnteredColor() {
if (this.colorEdit != null)
try {
return Color.parseColor(this.colorEdit.getText().toString());
} catch (Throwable ex) {
return Color.TRANSPARENT;
}
else
return getSelectedColor();
}
public Integer[] getAllColors() {
return initialColors;
}

View File

@ -289,7 +289,7 @@ public class ColorPickerDialogBuilder {
}
private void positiveButtonOnClick(DialogInterface dialog, ColorPickerClickListener onClickListener) {
int selectedColor = colorPickerView.getSelectedColor();
int selectedColor = colorPickerView.getEnteredColor();
Integer[] allColors = colorPickerView.getAllColors();
onClickListener.onClick(dialog, selectedColor, allColors);
}