mirror of
https://github.com/SimpleMobileTools/Simple-Dialer.git
synced 2025-06-05 21:49:23 +02:00
Changed MIN_COLUMNS_COUNT value to 1 and improved readability of created items in changeColumnCount
This commit is contained in:
@ -217,8 +217,9 @@ class MainActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
private fun changeColumnCount() {
|
||||
val items = (CONTACTS_GRID_MIN_COLUMNS_COUNT..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
|
||||
|
@ -351,7 +351,7 @@ class ContactsAdapter(
|
||||
val layoutManager = recyclerView.layoutManager
|
||||
if (layoutManager is GridLayoutManager) {
|
||||
val currentSpanCount = layoutManager.spanCount
|
||||
val newSpanCount = (currentSpanCount - 1).coerceIn(CONTACTS_GRID_MIN_COLUMNS_COUNT, CONTACTS_GRID_MAX_COLUMNS_COUNT)
|
||||
val newSpanCount = (currentSpanCount - 1).coerceIn(1, CONTACTS_GRID_MAX_COLUMNS_COUNT)
|
||||
layoutManager.spanCount = newSpanCount
|
||||
recyclerView.requestLayout()
|
||||
onSpanCountListener(newSpanCount)
|
||||
@ -362,7 +362,7 @@ class ContactsAdapter(
|
||||
val layoutManager = recyclerView.layoutManager
|
||||
if (layoutManager is GridLayoutManager) {
|
||||
val currentSpanCount = layoutManager.spanCount
|
||||
val newSpanCount = (currentSpanCount + 1).coerceIn(CONTACTS_GRID_MIN_COLUMNS_COUNT, CONTACTS_GRID_MAX_COLUMNS_COUNT)
|
||||
val newSpanCount = (currentSpanCount + 1).coerceIn(1, CONTACTS_GRID_MAX_COLUMNS_COUNT)
|
||||
layoutManager.spanCount = newSpanCount
|
||||
recyclerView.requestLayout()
|
||||
onSpanCountListener(newSpanCount)
|
||||
|
Reference in New Issue
Block a user