mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-26 06:55:42 +03:00
shorten method to comply with detekt
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
4685bced16
commit
47a02a93a0
1 changed files with 13 additions and 10 deletions
|
@ -212,17 +212,8 @@ class SetStatusDialogFragment :
|
||||||
binding.emoji.disableKeyboardInput(popup)
|
binding.emoji.disableKeyboardInput(popup)
|
||||||
binding.emoji.forceSingleEmoji()
|
binding.emoji.forceSingleEmoji()
|
||||||
|
|
||||||
val adapter = ArrayAdapter<String>(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 {
|
binding.clearStatusAfterSpinner.apply {
|
||||||
this.adapter = adapter
|
this.adapter = createClearTimesArrayAdapter()
|
||||||
onItemSelectedListener = object : OnItemSelectedListener {
|
onItemSelectedListener = object : OnItemSelectedListener {
|
||||||
override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
|
override fun onItemSelected(parent: AdapterView<*>, view: View, position: Int, id: Long) {
|
||||||
setClearStatusAfterValue(position)
|
setClearStatusAfterValue(position)
|
||||||
|
@ -244,6 +235,18 @@ class SetStatusDialogFragment :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createClearTimesArrayAdapter(): ArrayAdapter<String> {
|
||||||
|
val adapter = ArrayAdapter<String>(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")
|
@Suppress("ComplexMethod")
|
||||||
private fun setClearStatusAfterValue(item: Int) {
|
private fun setClearStatusAfterValue(item: Int) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue