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() {
|
private fun changeColumnCount() {
|
||||||
val items = (CONTACTS_GRID_MIN_COLUMNS_COUNT..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
|
||||||
|
@ -351,7 +351,7 @@ class ContactsAdapter(
|
|||||||
val layoutManager = recyclerView.layoutManager
|
val layoutManager = recyclerView.layoutManager
|
||||||
if (layoutManager is GridLayoutManager) {
|
if (layoutManager is GridLayoutManager) {
|
||||||
val currentSpanCount = layoutManager.spanCount
|
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
|
layoutManager.spanCount = newSpanCount
|
||||||
recyclerView.requestLayout()
|
recyclerView.requestLayout()
|
||||||
onSpanCountListener(newSpanCount)
|
onSpanCountListener(newSpanCount)
|
||||||
@ -362,7 +362,7 @@ class ContactsAdapter(
|
|||||||
val layoutManager = recyclerView.layoutManager
|
val layoutManager = recyclerView.layoutManager
|
||||||
if (layoutManager is GridLayoutManager) {
|
if (layoutManager is GridLayoutManager) {
|
||||||
val currentSpanCount = layoutManager.spanCount
|
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
|
layoutManager.spanCount = newSpanCount
|
||||||
recyclerView.requestLayout()
|
recyclerView.requestLayout()
|
||||||
onSpanCountListener(newSpanCount)
|
onSpanCountListener(newSpanCount)
|
||||||
|
Reference in New Issue
Block a user