OmniControl: ripple my color preset softly
Change-Id: I2a68879aa6ca5a59643493aefc9561fb79c72c18
diff --git a/app/src/main/java/org/omnirom/control/ColorBrowseActivity.kt b/app/src/main/java/org/omnirom/control/ColorBrowseActivity.kt
index 7768fdf..735976d 100644
--- a/app/src/main/java/org/omnirom/control/ColorBrowseActivity.kt
+++ b/app/src/main/java/org/omnirom/control/ColorBrowseActivity.kt
@@ -92,10 +92,10 @@
for (presetColor in PRESET_COLORS) {
val colorPresetItem: View = layoutInflater.inflate(R.layout.color_preset_item, null)
val colorPresetItemView =
- colorPresetItem.findViewById<View>(R.id.color_preset_item_view)
+ colorPresetItem.findViewById<View>(R.id.color_preset_item_view) as ImageView
colorPresetItemView.outlineProvider = outlineProvider
colorPresetItemView.clipToOutline = true
- colorPresetItemView.background = ColorDrawable(presetColor)
+ colorPresetItemView.setImageDrawable(ColorDrawable(presetColor))
val layoutParams = GridLayout.LayoutParams(
GridLayout.spec(GridLayout.UNDEFINED, 1f),
@@ -108,9 +108,9 @@
colorPresetItem.layoutParams = layoutParams
colorPresetView.addView(colorPresetItem)
- colorPresetItem.setOnClickListener { v ->
+ colorPresetItemView.setOnClickListener { v ->
val presetColor =
- (colorPresetItemView.background as ColorDrawable).color
+ (colorPresetItemView.drawable as ColorDrawable).color
mColorPicker.setColor(presetColor, true)
}
}
@@ -193,4 +193,4 @@
true
)
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/res/layout/color_preset_item.xml b/app/src/main/res/layout/color_preset_item.xml
index ce8edfd..25dde05 100644
--- a/app/src/main/res/layout/color_preset_item.xml
+++ b/app/src/main/res/layout/color_preset_item.xml
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="?android:attr/selectableItemBackground">
+ android:layout_height="match_parent">
- <View
+ <ImageView
android:id="@+id/color_preset_item_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_margin="4dp" />
+ android:layout_margin="4dp"
+ android:clickable="true"
+ android:foreground="?android:attr/selectableItemBackground" />
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>