Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable save image and video as previewed setting by default #455

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions app/src/main/java/app/grapheneos/camera/CamConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""

Expand Down Expand Up @@ -734,13 +734,36 @@ 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,
SettingValues.Default.SAVE_IMAGE_AS_PREVIEW
)
}

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)
Expand Down