From 21fd4de70b0844153a3619df42aa14c46766c169 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 26 Dec 2016 22:32:15 +0100 Subject: [PATCH] properly notify the main spinner change listener of change --- .../simplemobiletools/commons/views/MyAppCompatSpinner.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/views/MyAppCompatSpinner.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/views/MyAppCompatSpinner.kt index 17017e408..7ad2ea289 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/views/MyAppCompatSpinner.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/views/MyAppCompatSpinner.kt @@ -29,12 +29,14 @@ class MyAppCompatSpinner : AppCompatSpinner { val padding = resources.getDimension(R.dimen.activity_margin).toInt() adapter = MyArrayAdapter(context, android.R.layout.simple_spinner_item, items, textColor, backgroundColor, padding) + val superListener = onItemSelectedListener onItemSelectedListener = object : OnItemSelectedListener { - override fun onNothingSelected(p0: AdapterView<*>?) { - } - override fun onItemSelected(parent: AdapterView<*>, arg1: View?, arg2: Int, arg3: Long) { (parent.getChildAt(0) as TextView).setTextColor(textColor) + superListener.onItemSelected(parent, arg1, arg2, arg3) + } + + override fun onNothingSelected(p0: AdapterView<*>?) { } } background.setColorFilter(textColor, PorterDuff.Mode.SRC_ATOP)