playback: autoscale buttons
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
package org.oxycblt.auxio.playback.ui.button
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.AttrRes
|
||||
import com.google.android.material.R
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import org.oxycblt.auxio.util.lazyReflectedMethod
|
||||
import java.lang.reflect.Method
|
||||
import kotlin.math.max
|
||||
|
||||
/**
|
||||
* Companion scalable button to [ScaledPlaybackButtonGroup], see that.
|
||||
*
|
||||
* @author Codex w/cleanup + cognitive ownership by Alexander Capehart (OxygenCobalt)
|
||||
*/
|
||||
class ScaledPlaybackButton
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
@AttrRes defStyleAttr: Int = R.attr.materialButtonStyle,
|
||||
) : WidthFixMaterialButton(context, attrs, defStyleAttr) {
|
||||
private var baseMetrics: BaseMetrics
|
||||
private var lastScale: Float? = null
|
||||
|
||||
init {
|
||||
// We need to capture the buttons original state w /o any transforms
|
||||
// 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,
|
||||
)
|
||||
}
|
||||
|
||||
val baseWidth: Int
|
||||
get() = baseMetrics.width
|
||||
|
||||
val baseHeight: Int
|
||||
get() = baseMetrics.height
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
}
|
||||
|
||||
fun applyPlaybackScale(scale: Float) {
|
||||
val scaledWidth = baseMetrics.width.scale(scale)
|
||||
val scaledHeight = baseMetrics.height.scale(scale)
|
||||
// MaterialButtonGroup mutates child widths while pressed so neighbors can shrink/grow.
|
||||
// Only rewrite the baseline when the scale itself changes.
|
||||
if (lastScale == scale) {
|
||||
// Nothing to change
|
||||
return
|
||||
}
|
||||
lastScale = scale
|
||||
|
||||
METHOD_RECOVER_ORIG_PARAMS.invoke(this)
|
||||
val recoveredParams = layoutParams
|
||||
if (recoveredParams != null) {
|
||||
// Existing LayoutParams, update
|
||||
recoveredParams.width = scaledWidth
|
||||
recoveredParams.height = scaledHeight
|
||||
} else {
|
||||
// Otherwise make new LayoutParams
|
||||
layoutParams = ViewGroup.LayoutParams(scaledWidth, scaledHeight)
|
||||
}
|
||||
|
||||
// Scale minimum width/height
|
||||
minimumWidth = minOf(baseMetrics.minimumWidth.scale(scale), scaledWidth)
|
||||
minimumHeight = minOf(baseMetrics.minimumHeight.scale(scale), scaledHeight)
|
||||
|
||||
// Scale padding
|
||||
setPaddingRelative(
|
||||
baseMetrics.paddingStart.scale(scale),
|
||||
baseMetrics.paddingTop.scale(scale),
|
||||
baseMetrics.paddingEnd.scale(scale),
|
||||
baseMetrics.paddingBottom.scale(scale),
|
||||
)
|
||||
|
||||
// Scale icon size
|
||||
iconSize = baseMetrics.iconSize.scale(scale)
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
private fun Int.scale(scale: Float) = (this * scale).toInt()
|
||||
|
||||
private data class BaseMetrics(
|
||||
val width: Int,
|
||||
val height: Int,
|
||||
val minimumWidth: Int,
|
||||
val minimumHeight: Int,
|
||||
val paddingStart: Int,
|
||||
val paddingTop: Int,
|
||||
val paddingEnd: Int,
|
||||
val paddingBottom: Int,
|
||||
val iconSize: Int,
|
||||
val strokeWidth: Int,
|
||||
)
|
||||
|
||||
private companion object {
|
||||
private val METHOD_RECOVER_ORIG_PARAMS: Method by lazyReflectedMethod(MaterialButton::class, "recoverOriginalLayoutParams")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package org.oxycblt.auxio.playback.ui.button
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.core.view.children
|
||||
import com.google.android.material.R
|
||||
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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @author Alexander Capehart (OxygenCobalt)
|
||||
*/
|
||||
class ScaledPlaybackButtonGroup
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
@AttrRes defStyleAttr: Int = R.attr.materialButtonGroupStyle,
|
||||
) : MaterialButtonGroup(context, attrs, defStyleAttr) {
|
||||
private val baseSpacing = spacing
|
||||
private var lastAppliedSpacing = baseSpacing
|
||||
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
var scale = 1f
|
||||
|
||||
val spbChildren = children.filterIsInstance<ScaledPlaybackButton>().toList()
|
||||
if (spbChildren.isEmpty()) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||
return
|
||||
}
|
||||
|
||||
// Must equally space/distribute children across the row equally
|
||||
val rowWidth = spbChildren.sumOf { it.baseWidth } + baseSpacing * (spbChildren.size - 1)
|
||||
// Must still fit to the highest child (when scaled)
|
||||
val rowHeight = spbChildren.maxOf { it.baseHeight }
|
||||
|
||||
// Build a scaling coefficient that fits exactly within the bounds but still
|
||||
// scales down 1:1.
|
||||
val widthMode = MeasureSpec.getMode(widthMeasureSpec)
|
||||
val widthSize = MeasureSpec.getSize(widthMeasureSpec) - paddingLeft - paddingRight
|
||||
if (widthMode != MeasureSpec.UNSPECIFIED && widthSize > 0 && rowWidth > widthSize) {
|
||||
scale = min(scale, widthSize.toFloat() / rowWidth)
|
||||
}
|
||||
|
||||
val heightMode = MeasureSpec.getMode(heightMeasureSpec)
|
||||
val heightSize = MeasureSpec.getSize(heightMeasureSpec) - paddingTop - paddingBottom
|
||||
if (heightMode != MeasureSpec.UNSPECIFIED && heightSize > 0 && rowHeight > heightSize) {
|
||||
scale = min(scale, heightSize.toFloat() / rowHeight)
|
||||
}
|
||||
|
||||
// Then apply the scaling
|
||||
val spacing = (baseSpacing * scale).toInt()
|
||||
if (lastAppliedSpacing != spacing) {
|
||||
lastAppliedSpacing = spacing
|
||||
setSpacing(spacing)
|
||||
}
|
||||
spbChildren.forEach { it.applyPlaybackScale(scale) }
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||
}
|
||||
}
|
||||
+5
-22
@@ -1,38 +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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.oxycblt.auxio.ui
|
||||
package org.oxycblt.auxio.playback.ui.button
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.DrawableRes
|
||||
import com.google.android.material.R
|
||||
import org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
|
||||
/**
|
||||
* [RippleFixMaterialButton] that works around another bug where switching the icon during a press
|
||||
* [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)
|
||||
*
|
||||
* TODO: Should animate icon transitions to make this look less bad.
|
||||
*/
|
||||
class WidthFixMaterialButton
|
||||
open class WidthFixMaterialButton
|
||||
@JvmOverloads
|
||||
constructor(
|
||||
context: Context,
|
||||
@@ -71,4 +54,4 @@ constructor(
|
||||
pendingIconRes = null
|
||||
appliedIconRes = null
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,85 +107,59 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<com.google.android.material.button.MaterialButtonGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:spacing="@dimen/spacing_small">
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButtonGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:spacing="@dimen/spacing_small">
|
||||
|
||||
<org.oxycblt.auxio.ui.WidthFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_repeat"
|
||||
style="@style/Widget.Auxio.Button.Playback.Toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_change_repeat"
|
||||
app:icon="@drawable/ic_repeat_off_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Small" />
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_skip_prev"
|
||||
style="@style/Widget.Auxio.Button.Playback.Skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_skip_prev"
|
||||
app:icon="@drawable/ic_skip_prev_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_repeat"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium.Narrow" />
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large.Narrow" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_play_pause"
|
||||
style="@style/Widget.Auxio.Button.Playback.PlayPause"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_play_pause"
|
||||
app:icon="@drawable/sel_playing_state_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_skip_next"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_skip_prev"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large"
|
||||
tools:icon="@drawable/ic_play_24" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_skip_next"
|
||||
style="@style/Widget.Auxio.Button.Playback.Skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_skip_next"
|
||||
app:icon="@drawable/ic_skip_next_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_shuffle"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_play_pause"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium.Narrow" />
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large.Narrow" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_shuffle"
|
||||
style="@style/Widget.Auxio.Button.Playback.Toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_shuffle"
|
||||
app:icon="@drawable/sel_shuffle_state_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_skip_next"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Small"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium"
|
||||
app:tint="@color/sel_activatable_icon" />
|
||||
|
||||
</com.google.android.material.button.MaterialButtonGroup>
|
||||
</org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButtonGroup>
|
||||
|
||||
</org.oxycblt.auxio.playback.ui.ForcedLTRFrameLayout>
|
||||
|
||||
|
||||
@@ -110,79 +110,59 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintWidth_max="400dp">
|
||||
|
||||
<com.google.android.material.button.MaterialButtonGroup
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButtonGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:spacing="@dimen/spacing_small">
|
||||
|
||||
<org.oxycblt.auxio.ui.WidthFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_repeat"
|
||||
style="@style/Widget.Auxio.Button.Playback.Toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_change_repeat"
|
||||
app:icon="@drawable/ic_repeat_off_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Small" />
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_skip_prev"
|
||||
style="@style/Widget.Auxio.Button.Playback.Skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_skip_prev"
|
||||
app:icon="@drawable/ic_skip_prev_24"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_repeat"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium.Narrow" />
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large.Narrow" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_play_pause"
|
||||
style="@style/Widget.Auxio.Button.Playback.PlayPause"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_play_pause"
|
||||
app:icon="@drawable/sel_playing_state_24"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_skip_next"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_skip_prev"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large"
|
||||
tools:icon="@drawable/ic_play_24" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_skip_next"
|
||||
style="@style/Widget.Auxio.Button.Playback.Skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_skip_next"
|
||||
app:icon="@drawable/ic_skip_next_24"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_shuffle"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_play_pause"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium.Narrow" />
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large.Narrow" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_shuffle"
|
||||
style="@style/Widget.Auxio.Button.Playback.Toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_shuffle"
|
||||
app:icon="@drawable/sel_shuffle_state_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_skip_next"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Small"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium"
|
||||
app:tint="@color/sel_activatable_icon" />
|
||||
|
||||
</com.google.android.material.button.MaterialButtonGroup>
|
||||
</org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButtonGroup>
|
||||
</org.oxycblt.auxio.playback.ui.ForcedLTRFrameLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -1,188 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<org.oxycblt.auxio.ui.AuxioToolbar
|
||||
android:id="@+id/playback_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:menu="@menu/toolbar_playback"
|
||||
app:navigationIcon="@drawable/ic_down_24"
|
||||
app:subtitleCentered="true"
|
||||
app:subtitleTextAppearance="?attr/textAppearanceBodySmall"
|
||||
app:title="@string/lbl_playback"
|
||||
app:titleCentered="true"
|
||||
app:titleTextAppearance="?attr/textAppearanceLabelLargeEmphasized"
|
||||
tools:subtitle="@string/lbl_all_songs" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/playback_pager"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_margin="@dimen/spacing_medium"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
app:layout_constraintDimensionRatio="1"
|
||||
app:layout_constraintBottom_toTopOf="@+id/playback_info_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/playback_toolbar"
|
||||
app:layout_constraintVertical_chainStyle="packed" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/playback_info_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/spacing_medium"
|
||||
android:layout_marginEnd="@dimen/spacing_medium"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toTopOf="@+id/playback_seek_bar"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_more"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/playback_toolbar"
|
||||
app:layout_constraintVertical_bias="1.0"
|
||||
app:layout_constraintVertical_chainStyle="packed">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/playback_song"
|
||||
style="@style/Widget.Auxio.TextView.Primary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fallbackLineSpacing="false"
|
||||
tools:text="Song Name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/playback_artist"
|
||||
style="@style/Widget.Auxio.TextView.Secondary.Marquee"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fallbackLineSpacing="false"
|
||||
tools:text="Artist Name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/playback_album"
|
||||
style="@style/Widget.Auxio.TextView.Secondary.Marquee"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fallbackLineSpacing="false"
|
||||
tools:text="Album Name" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
android:id="@+id/playback_more"
|
||||
style="@style/Widget.Auxio.Button.Playback.More"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/spacing_medium"
|
||||
app:icon="@drawable/ic_more_24"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/playback_info_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/playback_info_container" />
|
||||
|
||||
<org.oxycblt.auxio.playback.ui.StyledSeekBar
|
||||
android:id="@+id/playback_seek_bar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@+id/playback_controls_container"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/playback_info_container" />
|
||||
|
||||
<org.oxycblt.auxio.playback.ui.ForcedLTRFrameLayout
|
||||
android:id="@+id/playback_controls_container"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/spacing_medium"
|
||||
android:layout_marginEnd="@dimen/spacing_medium"
|
||||
android:layout_marginBottom="@dimen/spacing_medium"
|
||||
app:layout_constraintTop_toBottomOf="@+id/playback_seek_bar"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintWidth_max="400dp">
|
||||
|
||||
<com.google.android.material.button.MaterialButtonGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:spacing="@dimen/spacing_small">
|
||||
|
||||
<org.oxycblt.auxio.ui.WidthFixMaterialButton
|
||||
android:id="@+id/playback_repeat"
|
||||
style="@style/Widget.Auxio.Button.Playback.Toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_change_repeat"
|
||||
app:icon="@drawable/ic_repeat_off_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
android:id="@+id/playback_skip_prev"
|
||||
style="@style/Widget.Auxio.Button.Playback.Skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_skip_prev"
|
||||
app:icon="@drawable/ic_skip_prev_24"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_repeat"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large.Narrow" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
android:id="@+id/playback_play_pause"
|
||||
style="@style/Widget.Auxio.Button.Playback.PlayPause"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_play_pause"
|
||||
app:icon="@drawable/sel_playing_state_24"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_skip_next"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_skip_prev"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large"
|
||||
tools:icon="@drawable/ic_play_24" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
android:id="@+id/playback_skip_next"
|
||||
style="@style/Widget.Auxio.Button.Playback.Skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_skip_next"
|
||||
app:icon="@drawable/ic_skip_next_24"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_shuffle"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_play_pause"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large.Narrow" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
android:id="@+id/playback_shuffle"
|
||||
style="@style/Widget.Auxio.Button.Playback.Toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_shuffle"
|
||||
app:icon="@drawable/sel_shuffle_state_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_skip_next"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium"
|
||||
app:tint="@color/sel_activatable_icon" />
|
||||
|
||||
</com.google.android.material.button.MaterialButtonGroup>
|
||||
</org.oxycblt.auxio.playback.ui.ForcedLTRFrameLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -73,7 +73,7 @@
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Small"
|
||||
app:icon="@drawable/sel_playing_state_24" />
|
||||
|
||||
<org.oxycblt.auxio.ui.WidthFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.WidthFixMaterialButton
|
||||
android:id="@+id/playback_secondary_action"
|
||||
style="@style/Widget.Material3Expressive.Button.IconButton.Outlined"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Small"
|
||||
|
||||
@@ -76,87 +76,59 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_pager"
|
||||
app:layout_constraintTop_toBottomOf="@+id/playback_info_container">
|
||||
|
||||
<com.google.android.material.button.MaterialButtonGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:spacing="@dimen/spacing_tiny">
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButtonGroup
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:spacing="@dimen/spacing_tiny">
|
||||
|
||||
|
||||
<org.oxycblt.auxio.ui.WidthFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_repeat"
|
||||
style="@style/Widget.Auxio.Button.Playback.Toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_change_repeat"
|
||||
app:icon="@drawable/ic_repeat_off_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_skip_prev"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Xsmall" />
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_skip_prev"
|
||||
style="@style/Widget.Auxio.Button.Playback.Skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_skip_prev"
|
||||
app:icon="@drawable/ic_skip_prev_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_play_pause"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_repeat"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Small.Narrow" />
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large.Narrow" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_play_pause"
|
||||
style="@style/Widget.Auxio.Button.Playback.PlayPause"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_play_pause"
|
||||
app:icon="@drawable/sel_playing_state_24"
|
||||
android:layout_marginHorizontal="@dimen/spacing_tiny"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_skip_next"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_skip_prev"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Small"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large"
|
||||
tools:icon="@drawable/ic_play_24" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_skip_next"
|
||||
style="@style/Widget.Auxio.Button.Playback.Skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_skip_next"
|
||||
app:icon="@drawable/ic_skip_next_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/playback_shuffle"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_play_pause"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Small.Narrow" />
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Large.Narrow" />
|
||||
|
||||
<org.oxycblt.auxio.ui.RippleFixMaterialButton
|
||||
<org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButton
|
||||
android:id="@+id/playback_shuffle"
|
||||
style="@style/Widget.Auxio.Button.Playback.Toggle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/desc_shuffle"
|
||||
app:icon="@drawable/sel_shuffle_state_24"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/playback_skip_next"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Xsmall"
|
||||
app:materialSizeOverlay="@style/SizeOverlay.Material3Expressive.Button.IconButton.Medium"
|
||||
app:tint="@color/sel_activatable_icon" />
|
||||
|
||||
</com.google.android.material.button.MaterialButtonGroup>
|
||||
</org.oxycblt.auxio.playback.ui.button.ScaledPlaybackButtonGroup>
|
||||
|
||||
</org.oxycblt.auxio.playback.ui.ForcedLTRFrameLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user