Aperture: Theme mode switcher buttons via enable/disable
Signed-off-by: Luca Stefani <luca.stefani.ge1@gmail.com>
Change-Id: I4c4e2062c81f89954f9a2c67a8ac1f5f7bd1e975
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index 8985d5a..094218f 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -655,17 +655,9 @@
* Update the camera mode buttons reflecting the current mode
*/
private fun updateCameraModeButtons() {
- val background = listOf(
- qrModeButton.background,
- photoModeButton.background,
- videoModeButton.background
- ).first {
- it != null
- }
-
- qrModeButton.background = if (cameraMode == CameraMode.QR) background else null
- photoModeButton.background = if (cameraMode == CameraMode.PHOTO) background else null
- videoModeButton.background = if (cameraMode == CameraMode.VIDEO) background else null
+ qrModeButton.isEnabled = cameraMode != CameraMode.QR
+ photoModeButton.isEnabled = cameraMode != CameraMode.PHOTO
+ videoModeButton.isEnabled = cameraMode != CameraMode.VIDEO
}
@androidx.camera.camera2.interop.ExperimentalCamera2Interop
diff --git a/app/src/main/res/color/camera_mode_selector_icon.xml b/app/src/main/res/color/camera_mode_selector_icon.xml
index ff55303..a80b3b4 100644
--- a/app/src/main/res/color/camera_mode_selector_icon.xml
+++ b/app/src/main/res/color/camera_mode_selector_icon.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:color="?attr/colorPrimary" android:state_enabled="true" />
- <item android:color="?attr/colorOnPrimary" android:state_enabled="false" />
- <item android:color="?attr/colorPrimary" />
+ <item android:color="@android:color/transparent" android:state_enabled="true" />
+ <item android:color="?attr/colorSecondaryContainer" android:state_enabled="false" />
</selector>
\ No newline at end of file
diff --git a/app/src/main/res/drawable/camera_mode_button.xml b/app/src/main/res/drawable/camera_mode_button.xml
deleted file mode 100644
index 51e2b46..0000000
--- a/app/src/main/res/drawable/camera_mode_button.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:state_enabled="true">
- <shape>
- <corners android:radius="25dp" />
- <padding android:bottom="7dp" android:left="7dp" android:right="7dp" android:top="7dp" />
- </shape>
- </item>
-
- <item android:state_enabled="false">
- <shape>
- <solid android:color="?attr/colorPrimary" />
- <corners android:radius="25dp" />
- <padding android:bottom="7dp" android:left="7dp" android:right="7dp" android:top="7dp" />
- </shape>
- </item>
-
- <item>
- <shape>
- <corners android:radius="25dp" />
- <padding android:bottom="7dp" android:left="7dp" android:right="7dp" android:top="7dp" />
- </shape>
- </item>
-</selector>
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index cffbd69..af19b30 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -34,6 +34,8 @@
<!-- Bottom bar icons theme -->
<style name="ApertureModeSelectorButton" parent="@style/Widget.Material3.Button.TonalButton">
+ <item name="android:backgroundTint">@color/camera_mode_selector_icon</item>
+ <item name="android:textColor">?attr/colorPrimary</item>
<item name="android:textStyle">bold</item>
<item name="android:typeface">monospace</item>
</style>