1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-21 23:32:51 +00:00

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);
}