Aperture: Add label for zoom level
Change-Id: I2477d6ccfe44cdfdafef08a3beb449442dc4ff29
diff --git a/app/build.gradle b/app/build.gradle
index 6544606..3b5842f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -34,8 +34,10 @@
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
- implementation 'com.google.android.material:material:1.6.1'
+ implementation 'com.google.android.material:material:1.7.0-alpha03'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
+ implementation 'androidx.lifecycle:lifecycle-viewmodel:2.5.1'
+ implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.preference:preference:1.2.0'
// CameraX core library using the camera2 implementation
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index 3c647c4..01179b1 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -53,6 +53,7 @@
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import com.google.android.material.chip.Chip
+import com.google.android.material.slider.LabelFormatter
import com.google.android.material.slider.Slider
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@@ -166,6 +167,7 @@
cameraController.setZoomRatio(value)
}
}
+ zoomLevel.setLabelFormatter { "%.1fx".format(it) }
photoModeButton.setOnClickListener { changeCameraMode(CameraMode.PHOTO) }
videoModeButton.setOnClickListener { changeCameraMode(CameraMode.VIDEO) }
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 3c264a5..11dbc7b 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -176,7 +176,7 @@
android:layout_width="250dp"
android:layout_height="0dp"
android:visibility="gone"
- app:labelBehavior="gone"
+ app:labelBehavior="visible"
app:layout_constraintBottom_toBottomOf="@+id/viewFinder"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />