recycler: improve fast-scroller truncation
Make fast-scroller truncation more aggressive, mostly because on my new ROM it seems like display calculations become a little wonky and cause slight indicator cutoff. May as well add padding then so that indicators [and the thumb by extension] actually fit and won't get clipped.
This commit is contained in:
@@ -58,12 +58,12 @@ private val ID3_GENRES = arrayOf(
|
||||
*/
|
||||
fun String.getGenreNameCompat(): String? {
|
||||
if (isDigitsOnly()) {
|
||||
// ID3 v1, just parse as an integer
|
||||
// ID3v1, just parse as an integer
|
||||
return ID3_GENRES.getOrNull(toInt())
|
||||
}
|
||||
|
||||
if (startsWith('(') && endsWith(')')) {
|
||||
// ID3 v2+, parse out the parentheses and get the integer
|
||||
// ID3v2.3/ID3v2.4, parse out the parentheses and get the integer
|
||||
// Any genres formatted as "(CHARS)" will be ignored.
|
||||
val genreInt = substring(1 until lastIndex).toIntOrNull()
|
||||
|
||||
|
||||
@@ -157,10 +157,13 @@ class FastScrollView @JvmOverloads constructor(
|
||||
)
|
||||
|
||||
// If the scroller size is too small to contain all the entries, truncate entries
|
||||
// so that the fast scroller entries fit.
|
||||
val maxEntries = height / textHeight
|
||||
// so that the fast scroller entries fit. Include the thumb in here so it isn't cut
|
||||
// off.
|
||||
val maxEntries = (height - (binding.scrollThumb.height * 2)) / textHeight
|
||||
|
||||
if (indicators.size > maxEntries.toInt()) {
|
||||
logD("${ceil(indicators.size / maxEntries).toInt()}")
|
||||
|
||||
if (indicators.size > maxEntries) {
|
||||
val truncateInterval = ceil(indicators.size / maxEntries).toInt()
|
||||
|
||||
check(truncateInterval > 1) {
|
||||
|
||||
Reference in New Issue
Block a user