summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuK1337 <priv.luk@gmail.com>2023-01-31 22:13:31 +0100
committerƁukasz Patron <priv.luk@gmail.com>2023-01-31 23:35:09 +0100
commitd2bb8408a3f2c1772fb1f54bb88a55e40da85dc6 (patch)
tree34056d53a7f4bbd452cb94c0f2ec5ca6ea7e9284
parentaf8d7dee97bb91cbc0ffe479e5ee8568337bfdd7 (diff)
Aperture: Add ripple animation for QR CardView
Change-Id: I53f8fc280712731f3b22d43a3d15df817497e46a
-rw-r--r--app/src/main/java/org/lineageos/aperture/QrImageAnalyzer.kt8
-rw-r--r--app/src/main/res/layout/qr_bottom_sheet_dialog.xml2
2 files changed, 8 insertions, 2 deletions
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.content.res.AppCompatResources
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 @@ class QrImageAnalyzer(private val activity: Activity) : ImageAnalysis.Analyzer {
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 @@ class QrImageAnalyzer(private val activity: Activity) : ImageAnalysis.Analyzer {
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 @@ class QrImageAnalyzer(private val activity: Activity) : ImageAnalysis.Analyzer {
})
}
} 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"