Aperture: Add ripple animation for QR CardView
Change-Id: I53f8fc280712731f3b22d43a3d15df817497e46a
diff --git a/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt b/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt
index 555d9e3..1b3fe00 100644
--- a/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt
+++ b/app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt
@@ -25,6 +25,7 @@
import androidx.appcompat.widget.LinearLayoutCompat.LayoutParams
import androidx.camera.core.ImageAnalysis
import androidx.camera.core.ImageProxy
+import androidx.cardview.widget.CardView
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.button.MaterialButton
import com.google.zxing.BinaryBitmap
@@ -39,6 +40,9 @@
setContentView(R.layout.qr_bottom_sheet_dialog)
}
}
+ private val bottomSheetDialogCardView by lazy {
+ bottomSheetDialog.findViewById<CardView>(R.id.cardView)!!
+ }
private val bottomSheetDialogTitle by lazy {
bottomSheetDialog.findViewById<TextView>(R.id.title)!!
}
@@ -103,7 +107,7 @@
textClassification.actions.isNotEmpty()
) {
with(textClassification.actions[0]) {
- bottomSheetDialogData.setOnClickListener { this.actionIntent.send() }
+ bottomSheetDialogCardView.setOnClickListener { actionIntent.send() }
bottomSheetDialogTitle.text = this.title
this.icon.loadDrawableAsync(activity, {
bottomSheetDialogIcon.setImageDrawable(it)
@@ -122,7 +126,7 @@
})
}
} else {
- bottomSheetDialogData.setOnClickListener {}
+ bottomSheetDialogCardView.setOnClickListener {}
bottomSheetDialogTitle.text = activity.resources.getText(R.string.qr_text)
bottomSheetDialogIcon.setImageDrawable(
AppCompatResources.getDrawable(activity, R.drawable.ic_qr_type_text)
diff --git a/app/src/main/res/layout/qr_bottom_sheet_dialog.xml b/app/src/main/res/layout/qr_bottom_sheet_dialog.xml
index aa68fdb..3d2181a 100644
--- a/app/src/main/res/layout/qr_bottom_sheet_dialog.xml
+++ b/app/src/main/res/layout/qr_bottom_sheet_dialog.xml
@@ -30,6 +30,8 @@
android:layout_width="match_parent"
android:layout_height="72dp"
android:layout_marginTop="12dp"
+ android:clickable="true"
+ android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@color/gray_60"
app:cardCornerRadius="12dp"
app:cardElevation="0dp"