Aperture: Get rid of unnecessary aspectRatio read/write
Change-Id: I47d2fd2f642e85fc4c98e5ab30b9b0158ddfe2b6
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index e4c8e66..8436d2f 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -133,7 +133,8 @@
private lateinit var audioConfig: AudioConfig
- private var aspectRatio: Int = AspectRatio.RATIO_4_3
+ private val aspectRatio: Int
+ get() = sharedPreferences.aspectRatio
private var extensionMode = ExtensionMode.NONE
private var supportedExtensionModes = listOf(extensionMode)
@@ -637,10 +638,6 @@
extensionMode = ExtensionMode.NONE
}
- // Get aspect ratio
- aspectRatio = sharedPreferences.aspectRatio
- val outputSize = CameraController.OutputSize(aspectRatio)
-
// Fallback to highest supported video quality
if (!camera.supportedVideoQualities.contains(sharedPreferences.videoQuality)) {
sharedPreferences.videoQuality = camera.supportedVideoQualities.first()
@@ -649,12 +646,12 @@
// Initialize the use case we want and set its properties
val cameraUseCases = when (cameraMode) {
CameraMode.QR -> {
- cameraController.imageAnalysisTargetSize = outputSize
+ cameraController.imageAnalysisTargetSize = CameraController.OutputSize(aspectRatio)
cameraController.setImageAnalysisAnalyzer(cameraExecutor, imageAnalyzer)
CameraController.IMAGE_ANALYSIS
}
CameraMode.PHOTO -> {
- cameraController.imageCaptureTargetSize = outputSize
+ cameraController.imageCaptureTargetSize = CameraController.OutputSize(aspectRatio)
CameraController.IMAGE_CAPTURE
}
CameraMode.VIDEO -> {