diff --git a/app/src/main/java/org/oxycblt/auxio/playback/PlaybackPanelFragment.kt b/app/src/main/java/org/oxycblt/auxio/playback/PlaybackPanelFragment.kt index a0277fe71..3145dcb51 100644 --- a/app/src/main/java/org/oxycblt/auxio/playback/PlaybackPanelFragment.kt +++ b/app/src/main/java/org/oxycblt/auxio/playback/PlaybackPanelFragment.kt @@ -299,7 +299,8 @@ class PlaybackPanelFragment : private fun updatePager(queue: PagerQueue) { // Right now there's easily 140ms of frame skipping when going next/prev. This is primarily // the fault of specifically the nested bottom sheet UI setup, which is intractable to - // optimize. If I don't do multiple remeasures/relayouts on every slightest state instability + // optimize. If I don't do multiple remeasures/relayouts on every slightest state + // instability // I will suddenly encounter insane issues where the sheet fails to measure, appears below // the sidebar, flies away, not changing with ui scale, etc, often only on third-party OEM // ROMs that randomly mangle SDK APIs and the SystemUI chrome for no reason. @@ -369,10 +370,7 @@ class PlaybackPanelFragment : if (command.update == null && abs(delta) == 1) { binding.playbackPager.smoothScrollByPageTo(command.scroll) } else { - binding.playbackPager.setCurrentItem( - command.scroll, - false, - ) + binding.playbackPager.setCurrentItem(command.scroll, false) } } } diff --git a/app/src/main/java/org/oxycblt/auxio/playback/ui/button/ScaledPlaybackButton.kt b/app/src/main/java/org/oxycblt/auxio/playback/ui/button/ScaledPlaybackButton.kt index b416fa491..9aff7dd25 100644 --- a/app/src/main/java/org/oxycblt/auxio/playback/ui/button/ScaledPlaybackButton.kt +++ b/app/src/main/java/org/oxycblt/auxio/playback/ui/button/ScaledPlaybackButton.kt @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2026 Auxio Project + * ScaledPlaybackButton.kt is part of Auxio. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package org.oxycblt.auxio.playback.ui.button import android.annotation.SuppressLint @@ -13,9 +31,9 @@ import com.google.android.material.shape.RelativeCornerSize import com.google.android.material.shape.ShapeAppearance import com.google.android.material.shape.ShapeAppearanceModel import com.google.android.material.shape.StateListShapeAppearanceModel -import org.oxycblt.auxio.util.lazyReflectedMethod import java.lang.reflect.Method import kotlin.math.max +import org.oxycblt.auxio.util.lazyReflectedMethod /** * Companion scalable button to [ScaledPlaybackButtonGroup], see that. @@ -39,19 +57,20 @@ constructor( // so that our scaling applies to the correct dimens val contentWidth = paddingStart + paddingEnd + iconSize val contentHeight = paddingTop + paddingBottom + iconSize - baseMetrics = BaseMetrics( - width = max(minimumWidth, contentWidth), - height = max(minimumHeight, contentHeight), - minimumWidth = minimumWidth, - minimumHeight = minimumHeight, - paddingStart = paddingStart, - paddingTop = paddingTop, - paddingEnd = paddingEnd, - paddingBottom = paddingBottom, - iconSize = iconSize, - strokeWidth = strokeWidth, - shapeAppearance = shapeAppearance - ) + baseMetrics = + BaseMetrics( + width = max(minimumWidth, contentWidth), + height = max(minimumHeight, contentHeight), + minimumWidth = minimumWidth, + minimumHeight = minimumHeight, + paddingStart = paddingStart, + paddingTop = paddingTop, + paddingEnd = paddingEnd, + paddingBottom = paddingBottom, + iconSize = iconSize, + strokeWidth = strokeWidth, + shapeAppearance = shapeAppearance, + ) } val baseWidth: Int @@ -99,7 +118,8 @@ constructor( // Scale stroke width if necessary // A bit inaccurate (they actually step from 3, 2, 1) but better to interpolate honestly - strokeWidth = if (baseMetrics.strokeWidth > 0) max(1, baseMetrics.strokeWidth.scale(scale)) else 0 + strokeWidth = + if (baseMetrics.strokeWidth > 0) max(1, baseMetrics.strokeWidth.scale(scale)) else 0 shapeAppearance = baseMetrics.shapeAppearance.scale(scale) } @@ -108,11 +128,9 @@ constructor( private fun ShapeAppearance.scale(scale: Float): ShapeAppearance = when (this) { - is StateListShapeAppearanceModel -> - withTransformedCornerSizes { it.scale(scale) } + is StateListShapeAppearanceModel -> withTransformedCornerSizes { it.scale(scale) } - is ShapeAppearanceModel -> - withTransformedCornerSizes { it.scale(scale) } + is ShapeAppearanceModel -> withTransformedCornerSizes { it.scale(scale) } else -> this } @@ -140,6 +158,6 @@ constructor( private companion object { private val METHOD_RECOVER_ORIG_PARAMS: Method by - lazyReflectedMethod(MaterialButton::class, "recoverOriginalLayoutParams") + lazyReflectedMethod(MaterialButton::class, "recoverOriginalLayoutParams") } } diff --git a/app/src/main/java/org/oxycblt/auxio/playback/ui/button/ScaledPlaybackButtonGroup.kt b/app/src/main/java/org/oxycblt/auxio/playback/ui/button/ScaledPlaybackButtonGroup.kt index 2d0364087..4f00a0d76 100644 --- a/app/src/main/java/org/oxycblt/auxio/playback/ui/button/ScaledPlaybackButtonGroup.kt +++ b/app/src/main/java/org/oxycblt/auxio/playback/ui/button/ScaledPlaybackButtonGroup.kt @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2026 Auxio Project + * ScaledPlaybackButtonGroup.kt is part of Auxio. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package org.oxycblt.auxio.playback.ui.button import android.content.Context @@ -9,11 +27,11 @@ import com.google.android.material.button.MaterialButtonGroup import kotlin.math.min /** - * A [com.google.android.material.button.MaterialButtonGroup] that scales playback controls down - * to actually fit mid-sized screens. + * A [com.google.android.material.button.MaterialButtonGroup] that scales playback controls down to + * actually fit mid-sized screens. * - * M3 Expressive for some reason only has "Large" and then massively smaller "Medium"/"Small" - * size classes. So either you clip on smaller phones or jump to an unusable button row sizing. + * M3 Expressive for some reason only has "Large" and then massively smaller "Medium"/"Small" size + * classes. So either you clip on smaller phones or jump to an unusable button row sizing. * * Fix this by just force-scaling down buttons. * diff --git a/app/src/main/java/org/oxycblt/auxio/playback/ui/button/WidthFixMaterialButton.kt b/app/src/main/java/org/oxycblt/auxio/playback/ui/button/WidthFixMaterialButton.kt index 649442e16..9fa7069c9 100644 --- a/app/src/main/java/org/oxycblt/auxio/playback/ui/button/WidthFixMaterialButton.kt +++ b/app/src/main/java/org/oxycblt/auxio/playback/ui/button/WidthFixMaterialButton.kt @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2026 Auxio Project + * WidthFixMaterialButton.kt is part of Auxio. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package org.oxycblt.auxio.playback.ui.button import android.content.Context @@ -8,8 +26,8 @@ import com.google.android.material.R import org.oxycblt.auxio.ui.RippleFixMaterialButton /** - * [org.oxycblt.auxio.ui.RippleFixMaterialButton] that works around another bug where switching the icon during a press - * breaks width expansion animations. + * [org.oxycblt.auxio.ui.RippleFixMaterialButton] that works around another bug where switching the + * icon during a press breaks width expansion animations. * * @author Alexander Capehart (OxygenCobalt) * @@ -54,4 +72,4 @@ constructor( pendingIconRes = null appliedIconRes = null } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/oxycblt/auxio/util/FrameworkUtil.kt b/app/src/main/java/org/oxycblt/auxio/util/FrameworkUtil.kt index 563b0dfb7..6f5c3ba91 100644 --- a/app/src/main/java/org/oxycblt/auxio/util/FrameworkUtil.kt +++ b/app/src/main/java/org/oxycblt/auxio/util/FrameworkUtil.kt @@ -156,9 +156,7 @@ fun ViewPager2.dampen() { RV_TOUCH_SLOP_FIELD.set(recycler, slop * 3) } -/** - * Reflect into a [ViewPager2]'s internal [RecyclerView]. - */ +/** Reflect into a [ViewPager2]'s internal [RecyclerView]. */ fun ViewPager2.recycler() = (VP_RECYCLER_FIELD.get(this) as RecyclerView) /**