add a new max photo resolution limit of 2 mpx

This commit is contained in:
tibbi
2016-11-06 12:46:29 +01:00
parent 0bdfb7802f
commit 945b845a44
5 changed files with 41 additions and 18 deletions

View File

@ -127,17 +127,36 @@ class SettingsActivity : SimpleActivity() {
}
private fun setupMaxPhotoResolution() {
settings_max_photo_resolution.setSelection(mConfig.maxPhotoResolution)
settings_max_photo_resolution.setSelection(getMaxPhotoSelection())
settings_max_photo_resolution.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onNothingSelected(parent: AdapterView<*>?) {
}
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
mConfig.maxPhotoResolution = settings_max_photo_resolution.selectedItemPosition
mConfig.maxPhotoResolution = getMaxPhotoPx(settings_max_photo_resolution.selectedItemPosition)
}
}
}
private fun getMaxPhotoSelection(): Int {
val maxRes = mConfig.maxPhotoResolution
return when (maxRes) {
3000000 -> 0
6000000 -> 1
9000000 -> 2
else -> 3
}
}
private fun getMaxPhotoPx(index: Int): Int {
return when (index) {
0 -> 3000000
1 -> 6000000
2 -> 9000000
else -> 0
}
}
private fun setupMaxVideoResolution() {
settings_max_video_resolution.setSelection(mConfig.maxVideoResolution)
settings_max_video_resolution.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {