0
0
mirror of https://github.com/florisboard/florisboard.git synced 2024-09-20 03:52:18 +02:00

Fix color dialog cache problem in theme editor (#237)

This commit is contained in:
Patrick Goldinger 2021-01-25 18:44:31 +01:00
parent 7e84f71464
commit a3e5ae9337
2 changed files with 9 additions and 4 deletions

View File

@ -160,7 +160,7 @@ class ThemeAttrView : LinearLayout {
ThemeValue.Reference("", "")
}
ThemeValue.SolidColor::class.simpleName -> {
ThemeValue.SolidColor(0)
ThemeValue.SolidColor(Color.BLACK)
}
ThemeValue.LinearGradient::class.simpleName -> {
ThemeValue.LinearGradient(0)
@ -242,6 +242,8 @@ class ThemeAttrView : LinearLayout {
is ThemeValue.SolidColor -> {
dialogView.attrValueSolidColor.isVisible = true
dialogView.attrValueSolidColorInt.text = value.toString()
dialogView.attrValueSolidColorEditBtn.background.setTint(value.color)
dialogView.attrValueSolidColorEditBtn.drawable.setTint(value.complimentaryTextColor().color)
dialogView.attrValueSolidColorEditBtn.setOnClickListener {
// Method on how to create a dialog which does not have a listener in the
// Activity taken from the original source code for the PreferenceCompat class.
@ -252,7 +254,9 @@ class ThemeAttrView : LinearLayout {
}.create()
colorPickerDialog.setColorPickerDialogListener(object : ColorPickerDialogListener {
override fun onColorSelected(dialogId: Int, color: Int) {
dialogView.attrValueSolidColorInt.text = ThemeValue.SolidColor(color).toString()
val tempSolidColor = ThemeValue.SolidColor(color)
dialogView.attrValueSolidColorInt.text = tempSolidColor.toString()
configureDialogUi(dialogView, tempSolidColor)
}
override fun onDialogDismissed(dialogId: Int) {

View File

@ -118,8 +118,9 @@
<ImageButton
android:id="@+id/attr_value_solid_color_edit_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="@drawable/shape_rect_rounded"
android:src="@drawable/ic_edit"
android:contentDescription="@string/assets__action__edit"/>