From 6d9c9f65c26e0b5602e6131e938bcc28f7cb42e8 Mon Sep 17 00:00:00 2001 From: OxygenCobalt Date: Thu, 29 Jul 2021 11:31:21 -0600 Subject: [PATCH] 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. --- app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt | 4 ++-- .../java/org/oxycblt/auxio/recycler/FastScrollView.kt | 9 ++++++--- info/ADDITIONS.md | 2 +- info/FORMATS.md | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt b/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt index 471f13ff9..82c819730 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt @@ -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() diff --git a/app/src/main/java/org/oxycblt/auxio/recycler/FastScrollView.kt b/app/src/main/java/org/oxycblt/auxio/recycler/FastScrollView.kt index c52c572b1..798ca4883 100644 --- a/app/src/main/java/org/oxycblt/auxio/recycler/FastScrollView.kt +++ b/app/src/main/java/org/oxycblt/auxio/recycler/FastScrollView.kt @@ -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) { diff --git a/info/ADDITIONS.md b/info/ADDITIONS.md index 6659917a5..1d735679b 100644 --- a/info/ADDITIONS.md +++ b/info/ADDITIONS.md @@ -23,6 +23,6 @@ Feel free to fork Auxio to add your own feature set however. #### Additions that have already been rejected: - Lyrics [#19] -- Recently added list[#18] +- Recently added list [#18] - Folder View/Grouping [#10] - ReplayGain [#7] diff --git a/info/FORMATS.md b/info/FORMATS.md index 2d9cf8f7f..aa94eb709 100644 --- a/info/FORMATS.md +++ b/info/FORMATS.md @@ -10,7 +10,7 @@ Here are the music formats that Auxio supports, as per the [Supported ExoPlayer | Format | Supported | Comments | |--------|-----------|----------- -| M4A | ✅ | | +| MP4 | ✅ | | | MP3 | ✅ | | | MKA | ✅ | | | OGG | ✅ | Containing Vorbis, Opus, and FLAC |