all: fix version-specific issues

Fix a few version-specific issues so that I don't make a critical
blunder like I did in 2.4.0.
This commit is contained in:
OxygenCobalt 2022-07-12 12:13:23 -06:00
parent f3aca45690
commit ae00a308fe
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
4 changed files with 14 additions and 3 deletions

View file

@ -104,6 +104,11 @@ class HomeFragment : ViewBindingFragment<FragmentHomeBinding>(), Toolbar.OnMenuI
binding.homeToolbar.setOnMenuItemClickListener(this@HomeFragment)
binding.homeIndexingContainer.setOnApplyWindowInsetsListener { v, insets ->
logD("do basics you retard")
insets
}
updateTabConfiguration()
// Load the track color in manually as it's unclear whether the track actually supports
@ -129,6 +134,11 @@ class HomeFragment : ViewBindingFragment<FragmentHomeBinding>(), Toolbar.OnMenuI
TabLayoutMediator(binding.homeTabs, this, AdaptiveTabStrategy(context, homeModel))
.attach()
// ViewPager2 will nominally consume window insets, which will then break the window
// insets applied to the indexing view before API 30. Fix this by overriding the
// callback with a no-op listener.
setOnApplyWindowInsetsListener { _, insets -> insets }
}
binding.homeFab.setOnClickListener { playbackModel.shuffleAll() }

View file

@ -69,14 +69,14 @@ val String.plainTrackNo: Int?
* invalid.
*/
val Int.packedTrackNo: Int?
get() = div(1000).nonZeroOrNull()
get() = mod(1000).nonZeroOrNull()
/**
* Parse out the disc number field as if the given Int is formatted as DTTT, where D Is the disc and
* T is the track number. Values of zero will be ignored under the assumption that they are invalid.
*/
val Int.packedDiscNo: Int?
get() = mod(1000).nonZeroOrNull()
get() = div(1000).nonZeroOrNull()
/**
* Parse out the number field from an NN/TT string that is typically found in DISC_NUMBER and

View file

@ -454,6 +454,7 @@ class Api21MediaStoreBackend : MediaStoreBackend() {
val rawTrack = cursor.getIntOrNull(trackIndex)
if (rawTrack != null) {
logD(rawTrack)
rawTrack.packedTrackNo?.let {
logD(it)
audio.track = it

View file

@ -52,7 +52,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_medium"
android:visibility="invisible"
android:layout_gravity="center">
<com.google.android.material.card.MaterialCardView
@ -106,6 +105,7 @@
</com.google.android.material.card.MaterialCardView>
</org.oxycblt.auxio.home.EdgeFrameLayout>
</FrameLayout>
<org.oxycblt.auxio.home.EdgeFrameLayout