From bebc02dee5f1ba176dff6bc8c5d54539e4b51eff Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 20 Nov 2016 21:20:54 +0100 Subject: [PATCH] fix storing max video resolution --- .../com/simplemobiletools/camera/Config.kt | 24 ++----------------- .../camera/activities/SettingsActivity.kt | 3 +-- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/Config.kt b/app/src/main/kotlin/com/simplemobiletools/camera/Config.kt index f3fa2df5..b88fbafb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/Config.kt @@ -32,32 +32,12 @@ class Config(context: Context) { get() = mPrefs.getBoolean(FORCE_RATIO, true) set(enabled) = mPrefs.edit().putBoolean(FORCE_RATIO, enabled).apply() - // todo: delete this - val maxResolution: Int - get() = mPrefs.getInt(MAX_RESOLUTION, -1) - var maxPhotoResolution: Int - get() = mPrefs.getInt(MAX_PHOTO_RESOLUTION, oldDefaultResolution) + get() = mPrefs.getInt(MAX_PHOTO_RESOLUTION, FIVE_MPX) set(maxRes) = mPrefs.edit().putInt(MAX_PHOTO_RESOLUTION, maxRes).apply() - private val oldDefaultResolution: Int - get() { - return when (maxResolution) { - 1 -> EIGHT_MPX - 2 -> 0 - else -> FIVE_MPX - } - } - var maxVideoResolution: Int - get() { - val maxRes = mPrefs.getInt(MAX_VIDEO_RESOLUTION, P720) - return when (maxRes) { - 0 -> P480 - 2 -> P1080 - else -> P720 - } - } + get() = mPrefs.getInt(MAX_VIDEO_RESOLUTION, P720) set(maxRes) = mPrefs.edit().putInt(MAX_VIDEO_RESOLUTION, maxRes).apply() var isSoundEnabled: Boolean diff --git a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt index a5a2feda..33cfe278 100644 --- a/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/camera/activities/SettingsActivity.kt @@ -176,8 +176,7 @@ class SettingsActivity : SimpleActivity() { } private fun getMaxVideoSelection(): Int { - val maxRes = config.maxVideoResolution - return when (maxRes) { + return when (config.maxVideoResolution) { P480 -> 0 P720 -> 1 P1080 -> 2