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 266d002..e82a02b 100644
--- a/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/CameraActivity.kt
@@ -216,8 +216,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 }
@@ -419,8 +418,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 25dea45..a8d30a5 100644
--- a/app/src/main/java/org/lineageos/aperture/camera/CameraViewModel.kt
+++ b/app/src/main/java/org/lineageos/aperture/camera/CameraViewModel.kt
@@ -58,7 +58,7 @@
/**
* Current screen rotation.
*/
- val screenRotation = MutableLiveData<Rotation>()
+ val screenRotation = MutableLiveData(Rotation.ROTATION_0)
/**
* Captured media [Uri]s