fix storing max video resolution

This commit is contained in:
tibbi 2016-11-20 21:20:54 +01:00
parent 40166e0556
commit bebc02dee5
2 changed files with 3 additions and 24 deletions

View File

@ -32,32 +32,12 @@ class Config(context: Context) {
get() = mPrefs.getBoolean(FORCE_RATIO, true) get() = mPrefs.getBoolean(FORCE_RATIO, true)
set(enabled) = mPrefs.edit().putBoolean(FORCE_RATIO, enabled).apply() set(enabled) = mPrefs.edit().putBoolean(FORCE_RATIO, enabled).apply()
// todo: delete this
val maxResolution: Int
get() = mPrefs.getInt(MAX_RESOLUTION, -1)
var maxPhotoResolution: Int 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() 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 var maxVideoResolution: Int
get() { get() = mPrefs.getInt(MAX_VIDEO_RESOLUTION, P720)
val maxRes = mPrefs.getInt(MAX_VIDEO_RESOLUTION, P720)
return when (maxRes) {
0 -> P480
2 -> P1080
else -> P720
}
}
set(maxRes) = mPrefs.edit().putInt(MAX_VIDEO_RESOLUTION, maxRes).apply() set(maxRes) = mPrefs.edit().putInt(MAX_VIDEO_RESOLUTION, maxRes).apply()
var isSoundEnabled: Boolean var isSoundEnabled: Boolean

View File

@ -176,8 +176,7 @@ class SettingsActivity : SimpleActivity() {
} }
private fun getMaxVideoSelection(): Int { private fun getMaxVideoSelection(): Int {
val maxRes = config.maxVideoResolution return when (config.maxVideoResolution) {
return when (maxRes) {
P480 -> 0 P480 -> 0
P720 -> 1 P720 -> 1
P1080 -> 2 P1080 -> 2