Aperture: Initial UI revamp

Signed-off-by: Luca Stefani <luca.stefani.ge1@gmail.com>
Change-Id: I5bd5005327bac7fc9dc2da96eaaf00fef9dcc2a0
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index 7e013c0..d95ec77 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -58,6 +58,7 @@
 import androidx.core.view.isVisible
 import androidx.lifecycle.lifecycleScope
 import androidx.preference.PreferenceManager
+import com.google.android.material.button.MaterialButton
 import com.google.android.material.chip.Chip
 import com.google.android.material.slider.Slider
 import kotlinx.coroutines.delay
@@ -83,15 +84,15 @@
     private val galleryButton by lazy { findViewById<ImageView>(R.id.galleryButton) }
     private val gridButton by lazy { findViewById<ImageButton>(R.id.gridButton) }
     private val gridView by lazy { findViewById<GridView>(R.id.gridView) }
-    private val photoModeButton by lazy { findViewById<ImageButton>(R.id.photoModeButton) }
-    private val qrModeButton by lazy { findViewById<ImageButton>(R.id.qrModeButton) }
+    private val photoModeButton by lazy { findViewById<MaterialButton>(R.id.photoModeButton) }
+    private val qrModeButton by lazy { findViewById<MaterialButton>(R.id.qrModeButton) }
     private val recordChip by lazy { findViewById<Chip>(R.id.recordChip) }
     private val settingsButton by lazy { findViewById<ImageButton>(R.id.settingsButton) }
     private val shutterButton by lazy { findViewById<ImageButton>(R.id.shutterButton) }
     private val timerButton by lazy { findViewById<ImageButton>(R.id.timerButton) }
     private val timerChip by lazy { findViewById<Chip>(R.id.timerChip) }
     private val torchButton by lazy { findViewById<ImageButton>(R.id.torchButton) }
-    private val videoModeButton by lazy { findViewById<ImageButton>(R.id.videoModeButton) }
+    private val videoModeButton by lazy { findViewById<MaterialButton>(R.id.videoModeButton) }
     private val viewFinder by lazy { findViewById<PreviewView>(R.id.viewFinder) }
     private val viewFinderFocus by lazy { findViewById<ImageView>(R.id.viewFinderFocus) }
     private val zoomLevel by lazy { findViewById<Slider>(R.id.zoomLevel) }
diff --git a/app/src/main/res/drawable/layout_camera_mode.xml b/app/src/main/res/drawable/layout_camera_mode.xml
deleted file mode 100644
index 1ba2445..0000000
--- a/app/src/main/res/drawable/layout_camera_mode.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<shape xmlns:android="http://schemas.android.com/apk/res/android">
-    <solid android:color="#525252" />
-    <corners android:radius="50dp" />
-    <padding
-        android:bottom="0dp"
-        android:left="0dp"
-        android:right="0dp"
-        android:top="0dp" />
-</shape>
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 10a120c..d33eec2 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -195,10 +195,11 @@
     <androidx.constraintlayout.widget.ConstraintLayout
         android:id="@+id/bottomButtonsLayout"
         android:layout_width="0dp"
-        android:layout_height="150dp"
-        app:layout_constraintBottom_toBottomOf="parent"
+        android:layout_height="120dp"
+        app:layout_constraintBottom_toTopOf="@+id/mode_selector_layout"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent">
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/viewFinder">
 
         <ImageButton
             android:id="@+id/shutterButton"
@@ -222,8 +223,8 @@
             android:scaleType="fitXY"
             app:cardCornerRadius="30dp"
             app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toEndOf="@+id/shutterButton"
+            app:layout_constraintEnd_toStartOf="@+id/shutterButton"
+            app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent">
 
             <ImageView
@@ -234,78 +235,73 @@
                 android:scaleType="centerCrop" />
         </androidx.cardview.widget.CardView>
 
+        <ImageButton
+            android:id="@+id/flipCameraButton"
+            style="@style/ApertureFlipCameraButton"
+            android:layout_width="50dp"
+            android:layout_height="50dp"
+            android:contentDescription="@string/flip_camera_button_description"
+            android:scaleType="center"
+            android:src="@drawable/ic_flip_camera_anim"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toEndOf="@+id/shutterButton"
+            app:layout_constraintTop_toTopOf="parent" />
+
         <androidx.constraintlayout.widget.ConstraintLayout
             android:layout_width="0dp"
             android:layout_height="0dp"
             app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toStartOf="@+id/shutterButton"
-            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toEndOf="@+id/shutterButton"
             app:layout_constraintTop_toTopOf="parent">
 
-            <ImageButton
-                android:id="@+id/flipCameraButton"
-                style="@style/ApertureFlipCameraButton"
-                android:layout_width="50dp"
-                android:layout_height="50dp"
-                android:contentDescription="@string/flip_camera_button_description"
-                android:scaleType="center"
-                android:src="@drawable/ic_flip_camera_anim"
-                app:layout_constraintBottom_toBottomOf="parent"
-                app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintHorizontal_bias="0.5"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toBottomOf="@+id/constraintLayout" />
-
-            <androidx.constraintlayout.widget.ConstraintLayout
-                android:id="@+id/constraintLayout"
-                android:layout_width="135dp"
-                android:layout_height="50dp"
-                android:background="@drawable/layout_camera_mode"
-                app:layout_constraintBottom_toTopOf="@+id/flipCameraButton"
-                app:layout_constraintEnd_toEndOf="parent"
-                app:layout_constraintHorizontal_bias="0.5"
-                app:layout_constraintStart_toStartOf="parent"
-                app:layout_constraintTop_toTopOf="parent">
-
-                <ImageButton
-                    android:id="@+id/qrModeButton"
-                    style="@style/ApertureCameraModeButton"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:contentDescription="@string/qr_mode_button_description"
-                    app:layout_constraintBottom_toBottomOf="parent"
-                    app:layout_constraintEnd_toStartOf="@+id/photoModeButton"
-                    app:layout_constraintHorizontal_bias="0.5"
-                    app:layout_constraintStart_toStartOf="parent"
-                    app:layout_constraintTop_toTopOf="parent"
-                    app:srcCompat="@drawable/ic_qr" />
-
-                <ImageButton
-                    android:id="@+id/photoModeButton"
-                    style="@style/ApertureCameraModeButton"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:contentDescription="@string/photo_mode_button_description"
-                    app:layout_constraintBottom_toBottomOf="parent"
-                    app:layout_constraintEnd_toStartOf="@+id/videoModeButton"
-                    app:layout_constraintHorizontal_bias="0.5"
-                    app:layout_constraintStart_toEndOf="@+id/qrModeButton"
-                    app:layout_constraintTop_toTopOf="parent"
-                    app:srcCompat="@drawable/ic_photo" />
-
-                <ImageButton
-                    android:id="@+id/videoModeButton"
-                    style="@style/ApertureCameraModeButton"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:contentDescription="@string/video_mode_button_description"
-                    app:layout_constraintBottom_toBottomOf="parent"
-                    app:layout_constraintEnd_toEndOf="parent"
-                    app:layout_constraintHorizontal_bias="0.5"
-                    app:layout_constraintStart_toEndOf="@+id/photoModeButton"
-                    app:layout_constraintTop_toTopOf="parent"
-                    app:srcCompat="@drawable/ic_video" />
-            </androidx.constraintlayout.widget.ConstraintLayout>
         </androidx.constraintlayout.widget.ConstraintLayout>
     </androidx.constraintlayout.widget.ConstraintLayout>
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/mode_selector_layout"
+        android:layout_width="match_parent"
+        android:layout_height="50dp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent">
+
+        <Button
+            android:id="@+id/photoModeButton"
+            style="@style/Widget.Material3.Button.TonalButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:contentDescription="@string/photo_mode_button_description"
+            android:text="@string/selector_photo"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toStartOf="@+id/videoModeButton"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <Button
+            android:id="@+id/videoModeButton"
+            style="@style/Widget.Material3.Button.TonalButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:contentDescription="@string/video_mode_button_description"
+            android:text="@string/select_video"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toStartOf="@+id/qrModeButton"
+            app:layout_constraintStart_toEndOf="@+id/photoModeButton"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <Button
+            android:id="@+id/qrModeButton"
+            style="@style/Widget.Material3.Button.TonalButton"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:contentDescription="@string/qr_mode_button_description"
+            android:text="@string/select_scan"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toEndOf="@+id/videoModeButton"
+            app:layout_constraintTop_toTopOf="parent" />
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
 </androidx.constraintlayout.widget.ConstraintLayout>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 01b8446..8f4e8e2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -16,6 +16,11 @@
     <string name="shutter_button_description">Shutter</string>
     <string name="gallery_button_description">Gallery</string>
 
+    <!-- Selector chip -->
+    <string name="selector_photo">PHOTO</string>
+    <string name="select_video">VIDEO</string>
+    <string name="select_scan">SCAN</string>
+
     <!-- Record chip -->
     <string translatable="false" name="record_chip_default_text">00:00:00</string>
 
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 29dea38..732890b 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -35,12 +35,6 @@
         <item name="android:scaleType">fitXY</item>
     </style>
 
-    <!-- Camera mode selector button theme -->
-    <style name="ApertureCameraModeButton">
-        <item name="tint">@color/camera_mode_selector_icon</item>
-        <item name="android:background">@drawable/camera_mode_button</item>
-    </style>
-
     <!-- Flip camera button theme -->
     <style name="ApertureFlipCameraButton">
         <item name="tint">?attr/colorOnPrimary</item>