select the proper item at settings spinner

This commit is contained in:
tibbi 2016-12-27 01:09:56 +01:00
parent fe85ef685b
commit 4e75a84660

View File

@ -55,10 +55,15 @@ class SettingsActivity : SimpleActivity() {
} }
private fun setupShowMedia() { private fun setupShowMedia() {
var isInitialSetup = true
settings_show_media.setSelection(config.showMedia) settings_show_media.setSelection(config.showMedia)
settings_show_media.onItemSelectedListener = object : AdapterView.OnItemSelectedListener { settings_show_media.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
if (isInitialSetup)
settings_show_media.setSelection(config.showMedia)
else
config.showMedia = settings_show_media.selectedItemPosition config.showMedia = settings_show_media.selectedItemPosition
isInitialSetup = false
} }
override fun onNothingSelected(parent: AdapterView<*>?) { override fun onNothingSelected(parent: AdapterView<*>?) {