simplify the settings spinner initialization

This commit is contained in:
tibbi 2017-01-06 21:08:34 +01:00
parent 8a1deddc55
commit e7c9964d4a

View file

@ -64,15 +64,10 @@ class SettingsActivity : SimpleActivity() {
}
private fun setupShowMedia() {
var isInitialSetup = true
settings_show_media.setSelection(config.showMedia)
settings_show_media.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
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
isInitialSetup = false
config.showMedia = settings_show_media.selectedItemPosition
}
override fun onNothingSelected(parent: AdapterView<*>?) {