Colorpicker: preserve entered color

pull/212/head
M66B 2 years ago
parent 6aa8dc98ac
commit 3aab01aee3

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

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

Loading…
Cancel
Save