Twelve: Switch ListItem container to MaterialCardView
We get free hovering support this way
Also drop bogus background color, it wasn't applied anyway
Change-Id: I7c6ab328f267ad040f85ec27ac3805f8e79ca696
diff --git a/app/src/main/java/org/lineageos/twelve/ui/views/ListItem.kt b/app/src/main/java/org/lineageos/twelve/ui/views/ListItem.kt
index 206f76f..c8ec810 100644
--- a/app/src/main/java/org/lineageos/twelve/ui/views/ListItem.kt
+++ b/app/src/main/java/org/lineageos/twelve/ui/views/ListItem.kt
@@ -7,6 +7,7 @@
import android.content.Context
import android.graphics.Bitmap
+import android.graphics.Color
import android.graphics.drawable.Drawable
import android.graphics.drawable.Icon
import android.net.Uri
@@ -20,8 +21,8 @@
import androidx.annotation.DrawableRes
import androidx.annotation.LayoutRes
import androidx.annotation.StringRes
-import androidx.annotation.StyleRes
import androidx.core.view.isVisible
+import com.google.android.material.card.MaterialCardView
import org.lineageos.twelve.R
/**
@@ -32,8 +33,7 @@
context: Context,
attrs: AttributeSet? = null,
@AttrRes defStyleAttr: Int = 0,
- @StyleRes defStyleRes: Int = 0,
-) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) {
+) : MaterialCardView(context, attrs, defStyleAttr) {
private val headlineTextView by lazy { findViewById<TextView>(R.id.headlineTextView) }
private val leadingIconImageView by lazy { findViewById<ImageView>(R.id.leadingIconImageView) }
private val leadingTextView by lazy { findViewById<TextView>(R.id.leadingTextView) }
@@ -104,6 +104,9 @@
}
init {
+ setCardBackgroundColor(Color.TRANSPARENT)
+ cardElevation = 0f
+
inflate(context, R.layout.list_item, this)
context.obtainStyledAttributes(attrs, R.styleable.ListItem, 0, 0).apply {
diff --git a/app/src/main/res/layout/list_item.xml b/app/src/main/res/layout/list_item.xml
index 21fbc59..5955f72 100644
--- a/app/src/main/res/layout/list_item.xml
+++ b/app/src/main/res/layout/list_item.xml
@@ -8,8 +8,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:backgroundTint="?attr/colorSurface"
- android:foreground="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingHorizontal="16dp"