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:
OxygenCobalt 2021-07-29 11:31:21 -06:00
parent ec4ca16658
commit 6d9c9f65c2
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
4 changed files with 10 additions and 7 deletions

View file

@ -63,7 +63,7 @@ fun String.getGenreNameCompat(): String? {
} }
if (startsWith('(') && endsWith(')')) { 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. // Any genres formatted as "(CHARS)" will be ignored.
val genreInt = substring(1 until lastIndex).toIntOrNull() val genreInt = substring(1 until lastIndex).toIntOrNull()

View file

@ -157,10 +157,13 @@ class FastScrollView @JvmOverloads constructor(
) )
// If the scroller size is too small to contain all the entries, truncate entries // If the scroller size is too small to contain all the entries, truncate entries
// so that the fast scroller entries fit. // so that the fast scroller entries fit. Include the thumb in here so it isn't cut
val maxEntries = height / textHeight // 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() val truncateInterval = ceil(indicators.size / maxEntries).toInt()
check(truncateInterval > 1) { check(truncateInterval > 1) {

View file

@ -10,7 +10,7 @@ Here are the music formats that Auxio supports, as per the [Supported ExoPlayer
| Format | Supported | Comments | | Format | Supported | Comments |
|--------|-----------|----------- |--------|-----------|-----------
| M4A | ✅ | | | MP4 | ✅ | |
| MP3 | ✅ | | | MP3 | ✅ | |
| MKA | ✅ | | | MKA | ✅ | |
| OGG | ✅ | Containing Vorbis, Opus, and FLAC | | OGG | ✅ | Containing Vorbis, Opus, and FLAC |