From c7d662c8bd070b63b07b3784a198c9680a57400a Mon Sep 17 00:00:00 2001 From: MHShetty Date: Sun, 28 Jul 2024 12:36:41 +0530 Subject: [PATCH 1/2] Enable save image and video as previewed setting by default --- app/src/main/java/app/grapheneos/camera/CamConfig.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/grapheneos/camera/CamConfig.kt b/app/src/main/java/app/grapheneos/camera/CamConfig.kt index 7cf74d3fe..51318c5cf 100644 --- a/app/src/main/java/app/grapheneos/camera/CamConfig.kt +++ b/app/src/main/java/app/grapheneos/camera/CamConfig.kt @@ -138,9 +138,9 @@ class CamConfig(private val mActivity: MainActivity) { const val SCAN_ALL_CODES = false - const val SAVE_IMAGE_AS_PREVIEW = false + const val SAVE_IMAGE_AS_PREVIEW = true - const val SAVE_VIDEO_AS_PREVIEW = false + const val SAVE_VIDEO_AS_PREVIEW = true const val STORAGE_LOCATION = "" From a5904cc291f1383b6dcda01a554d9ad6213cb1a9 Mon Sep 17 00:00:00 2001 From: MHShetty Date: Sat, 3 Aug 2024 02:09:25 +0530 Subject: [PATCH 2/2] Workaround inconsistent behavior of default value of save image/video as previewed --- .../java/app/grapheneos/camera/CamConfig.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/src/main/java/app/grapheneos/camera/CamConfig.kt b/app/src/main/java/app/grapheneos/camera/CamConfig.kt index 51318c5cf..f2a91c04c 100644 --- a/app/src/main/java/app/grapheneos/camera/CamConfig.kt +++ b/app/src/main/java/app/grapheneos/camera/CamConfig.kt @@ -734,6 +734,22 @@ class CamConfig(private val mActivity: MainActivity) { editor.putBoolean(SettingValues.Key.CAMERA_SOUNDS, SettingValues.Default.CAMERA_SOUNDS) } + // Note: This is a workaround to keep save image/video as previewed 'on' by + // default starting from v73 and 'off' by default for versions before that + // + // If its not a fresh install (before v73) + if (commonPref.contains(SettingValues.Key.SAVE_IMAGE_AS_PREVIEW)) { + // If save video as previewed was not previously set + if (!commonPref.contains(SettingValues.Key.SAVE_VIDEO_AS_PREVIEW)) { + // Explicitly set the value for this setting as false for them + // to ensure consistent behavior + editor.putBoolean( + SettingValues.Key.SAVE_VIDEO_AS_PREVIEW, + false + ) + } + } + if (!commonPref.contains(SettingValues.Key.SAVE_IMAGE_AS_PREVIEW)) { editor.putBoolean( SettingValues.Key.SAVE_IMAGE_AS_PREVIEW, @@ -741,6 +757,13 @@ class CamConfig(private val mActivity: MainActivity) { ) } + if (!commonPref.contains(SettingValues.Key.SAVE_IMAGE_AS_PREVIEW)) { + editor.putBoolean( + SettingValues.Key.SAVE_VIDEO_AS_PREVIEW, + SettingValues.Default.SAVE_VIDEO_AS_PREVIEW + ) + } + if (!commonPref.contains(SettingValues.Key.GRID)) { // Index for Grid.values() Default: NONE editor.putInt(SettingValues.Key.GRID, SettingValues.Default.GRID_TYPE_INDEX)