Changed CONTACTS_GRID_MIN_COLUMNS_COUNT to 1

This commit is contained in:
merkost 2023-07-22 10:22:46 +10:00
parent fd24f1ed6c
commit 9de68501f7
2 changed files with 3 additions and 3 deletions

View file

@ -248,7 +248,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
}
private fun changeColumnCount() {
val items = (CONTACTS_GRID_MIN_COLUMNS_COUNT..CONTACTS_GRID_MAX_COLUMNS_COUNT).map {
val items = (1..CONTACTS_GRID_MAX_COLUMNS_COUNT).map {
RadioItem(it, resources.getQuantityString(R.plurals.column_counts, it, it))
}

View file

@ -496,7 +496,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()
onColumnCountListener(newSpanCount)
@ -507,7 +507,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()
onColumnCountListener(newSpanCount)