Changed CONTACTS_GRID_MIN_COLUMNS_COUNT to 1
This commit is contained in:
parent
fd24f1ed6c
commit
9de68501f7
2 changed files with 3 additions and 3 deletions
|
@ -248,7 +248,7 @@ class MainActivity : SimpleActivity(), RefreshContactsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun changeColumnCount() {
|
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))
|
RadioItem(it, resources.getQuantityString(R.plurals.column_counts, it, it))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -496,7 +496,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()
|
||||||
onColumnCountListener(newSpanCount)
|
onColumnCountListener(newSpanCount)
|
||||||
|
@ -507,7 +507,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()
|
||||||
onColumnCountListener(newSpanCount)
|
onColumnCountListener(newSpanCount)
|
||||||
|
|
Loading…
Reference in a new issue