diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt index 30271b244..57584222a 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt @@ -212,17 +212,8 @@ class SetStatusDialogFragment : binding.emoji.disableKeyboardInput(popup) binding.emoji.forceSingleEmoji() - val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item) - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) - adapter.add(getString(R.string.dontClear)) - adapter.add(getString(R.string.thirtyMinutes)) - adapter.add(getString(R.string.oneHour)) - adapter.add(getString(R.string.fourHours)) - adapter.add(getString(R.string.today)) - adapter.add(getString(R.string.thisWeek)) - binding.clearStatusAfterSpinner.apply { - this.adapter = adapter + this.adapter = createClearTimesArrayAdapter() onItemSelectedListener = object : OnItemSelectedListener { override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) { setClearStatusAfterValue(position) @@ -244,6 +235,18 @@ class SetStatusDialogFragment : } } + private fun createClearTimesArrayAdapter(): ArrayAdapter { + val adapter = ArrayAdapter(requireContext(), android.R.layout.simple_spinner_item) + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) + adapter.add(getString(R.string.dontClear)) + adapter.add(getString(R.string.thirtyMinutes)) + adapter.add(getString(R.string.oneHour)) + adapter.add(getString(R.string.fourHours)) + adapter.add(getString(R.string.today)) + adapter.add(getString(R.string.thisWeek)) + return adapter + } + @Suppress("ComplexMethod") private fun setClearStatusAfterValue(item: Int) {