Aperture: Fix crash on no zoom capabilities
* On a cheap Allwinner tablet that I have minZoomRatio and maxZoomRatio returns 1.0 on front camera and BaseSlider isn't happy about it
Change-Id: If5a363ed767c34cf59d4fec9eabcd0d85c2a35df
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index 4828856..6c758ad 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -451,6 +451,10 @@
// Observe zoom state
cameraController.zoomState.removeObservers(this)
cameraController.zoomState.observe(this) {
+ if (it.minZoomRatio == it.maxZoomRatio) {
+ return@observe
+ }
+
zoomLevel.valueFrom = it.minZoomRatio
zoomLevel.valueTo = it.maxZoomRatio
zoomLevel.value = it.zoomRatio