Simplified changeColumnCount items array creating

This commit is contained in:
merkost 2023-07-22 22:43:15 +10:00
parent e3697eb349
commit 4ab95c4bb3
1 changed files with 4 additions and 3 deletions

View File

@ -248,12 +248,13 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
}
private fun changeColumnCount() {
val items = (1..CONTACTS_GRID_MAX_COLUMNS_COUNT).map {
RadioItem(it, resources.getQuantityString(R.plurals.column_counts, it, it))
val items = ArrayList<RadioItem>()
for (i in 1..CONTACTS_GRID_MAX_COLUMNS_COUNT) {
items.add(RadioItem(i, resources.getQuantityString(R.plurals.column_counts, i, i)))
}
val currentColumnCount = config.contactsGridColumnCount
RadioGroupDialog(this, ArrayList(items), currentColumnCount) {
RadioGroupDialog(this, items, currentColumnCount) {
val newColumnCount = it as Int
if (currentColumnCount != newColumnCount) {
config.contactsGridColumnCount = newColumnCount