Aperture: Use nonNullablePropertyDelegate for screen rotation LiveData
Change-Id: I42db24f74e3c66bb3c97d6f56c5493fe8508e337
diff --git a/app/src/main/java/org/lineageos/aperture/CameraActivity.kt b/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
index 29706c2..d77a370 100644
--- a/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
@@ -208,8 +208,7 @@
private var cameraMode by nonNullablePropertyDelegate { model.cameraMode }
private var singleCaptureMode by nonNullablePropertyDelegate { model.inSingleCaptureMode }
private var cameraState by nonNullablePropertyDelegate { model.cameraState }
- private val screenRotation
- get() = model.screenRotation
+ private var screenRotation by nonNullablePropertyDelegate { model.screenRotation }
private var gridMode by nonNullablePropertyDelegate { model.gridMode }
private var flashMode by nonNullablePropertyDelegate { model.flashMode }
private var timerMode by nonNullablePropertyDelegate { model.timerMode }
@@ -421,8 +420,8 @@
val rotation = Rotation.fromDegreesInAperture(orientation)
- if (screenRotation.value != rotation) {
- screenRotation.value = rotation
+ if (screenRotation != rotation) {
+ screenRotation = rotation
}
}
}
diff --git a/app/src/main/java/org/lineageos/aperture/camera/CameraViewModel.kt b/app/src/main/java/org/lineageos/aperture/camera/CameraViewModel.kt
index c3bd4a9..4752ff2 100644
--- a/app/src/main/java/org/lineageos/aperture/camera/CameraViewModel.kt
+++ b/app/src/main/java/org/lineageos/aperture/camera/CameraViewModel.kt
@@ -48,7 +48,7 @@
/**
* Current screen rotation.
*/
- val screenRotation = MutableLiveData<Rotation>()
+ val screenRotation = MutableLiveData(Rotation.ROTATION_0)
// General