This commit is contained in:
merkost
2023-07-13 23:03:08 +10:00
parent a4130cd948
commit d0c9daa3ce
3 changed files with 11 additions and 11 deletions

View File

@@ -31,8 +31,8 @@ import com.simplemobiletools.dialer.extensions.areMultipleSIMsAvailable
import com.simplemobiletools.dialer.extensions.callContactWithSim
import com.simplemobiletools.dialer.extensions.config
import com.simplemobiletools.dialer.extensions.startContactDetailsIntent
import com.simplemobiletools.dialer.helpers.GRID_MAX_SPAN_COUNT
import com.simplemobiletools.dialer.helpers.GRID_MIN_SPAN_COUNT
import com.simplemobiletools.dialer.helpers.GRID_MAX_COLUMNS_COUNT
import com.simplemobiletools.dialer.helpers.GRID_MIN_COLUMNS_COUNT
import com.simplemobiletools.dialer.interfaces.RefreshItemsListener
import java.util.*
@@ -351,7 +351,7 @@ class ContactsAdapter(
val layoutManager = recyclerView.layoutManager
if (layoutManager is GridLayoutManager) {
val currentSpanCount = layoutManager.spanCount
val newSpanCount = (currentSpanCount - 1).coerceIn(GRID_MIN_SPAN_COUNT, GRID_MAX_SPAN_COUNT)
val newSpanCount = (currentSpanCount - 1).coerceIn(GRID_MIN_COLUMNS_COUNT, 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(GRID_MIN_SPAN_COUNT, GRID_MAX_SPAN_COUNT)
val newSpanCount = (currentSpanCount + 1).coerceIn(GRID_MIN_COLUMNS_COUNT, GRID_MAX_COLUMNS_COUNT)
layoutManager.spanCount = newSpanCount
recyclerView.requestLayout()
onSpanCountListener(newSpanCount)

View File

@@ -95,8 +95,8 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getInt(VIEW_TYPE, VIEW_TYPE_LIST)
set(viewType) = prefs.edit().putInt(VIEW_TYPE, viewType).apply()
var gridLayoutSpanCount: Int
get() = prefs.getInt(GRID_LAYOUT_SPAN_COUNT, GRID_DEFAULT_SPAN_COUNT)
set(gridLayoutSpanCount) = prefs.edit().putInt(GRID_LAYOUT_SPAN_COUNT, gridLayoutSpanCount).apply()
var favoritesColumnCnt: Int
get() = prefs.getInt(FAVOURITES_COLUMN_COUNT, GRID_DEFAULT_COLUMNS_COUNT)
set(gridLayoutSpanCount) = prefs.edit().putInt(FAVOURITES_COLUMN_COUNT, gridLayoutSpanCount).apply()
}

View File

@@ -20,7 +20,7 @@ const val DIALPAD_BEEPS = "dialpad_beeps"
const val HIDE_DIALPAD_NUMBERS = "hide_dialpad_numbers"
const val ALWAYS_SHOW_FULLSCREEN = "always_show_fullscreen"
const val VIEW_TYPE = "view_type"
const val GRID_LAYOUT_SPAN_COUNT = "grid_layout_span_count"
const val FAVOURITES_COLUMN_COUNT = "grid_layout_span_count"
const val ALL_TABS_MASK = TAB_CONTACTS or TAB_FAVORITES or TAB_CALL_HISTORY
@@ -35,6 +35,6 @@ const val DIALPAD_TONE_LENGTH_MS = 150L // The length of DTMF tones in milliseco
const val MIN_RECENTS_THRESHOLD = 30
const val GRID_DEFAULT_SPAN_COUNT = 3
const val GRID_MIN_SPAN_COUNT = 2
const val GRID_MAX_SPAN_COUNT = 6
const val GRID_DEFAULT_COLUMNS_COUNT = 3
const val GRID_MIN_COLUMNS_COUNT = 2
const val GRID_MAX_COLUMNS_COUNT = 6