Simplified changeColumnCount items array creating
This commit is contained in:
parent
e3697eb349
commit
4ab95c4bb3
|
@ -248,12 +248,13 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun changeColumnCount() {
|
private fun changeColumnCount() {
|
||||||
val items = (1..CONTACTS_GRID_MAX_COLUMNS_COUNT).map {
|
val items = ArrayList<RadioItem>()
|
||||||
RadioItem(it, resources.getQuantityString(R.plurals.column_counts, it, it))
|
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
|
val currentColumnCount = config.contactsGridColumnCount
|
||||||
RadioGroupDialog(this, ArrayList(items), currentColumnCount) {
|
RadioGroupDialog(this, items, currentColumnCount) {
|
||||||
val newColumnCount = it as Int
|
val newColumnCount = it as Int
|
||||||
if (currentColumnCount != newColumnCount) {
|
if (currentColumnCount != newColumnCount) {
|
||||||
config.contactsGridColumnCount = newColumnCount
|
config.contactsGridColumnCount = newColumnCount
|
||||||
|
|
Loading…
Reference in New Issue