diff --git a/app/src/main/java/org/oxycblt/auxio/home/list/CookieImageView.kt b/app/src/main/java/org/oxycblt/auxio/home/list/CookieImageView.kt
index de2ea29aa..154c633c7 100644
--- a/app/src/main/java/org/oxycblt/auxio/home/list/CookieImageView.kt
+++ b/app/src/main/java/org/oxycblt/auxio/home/list/CookieImageView.kt
@@ -1,11 +1,31 @@
+/*
+ * Copyright (c) 2026 Auxio Project
+ * CookieImageView.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.home.list
import android.content.Context
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatImageView
-import org.oxycblt.auxio.home.list.CookieShapeDrawable
-/** A placeholder [androidx.appcompat.widget.AppCompatImageView] with a 6-sided cookie expressive background shape. */
+/**
+ * A placeholder [androidx.appcompat.widget.AppCompatImageView] with a 6-sided cookie expressive
+ * background shape.
+ */
class CookieImageView
@JvmOverloads
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
@@ -14,4 +34,4 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
background = CookieShapeDrawable(context)
scaleType = ScaleType.CENTER_INSIDE
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/org/oxycblt/auxio/home/list/ListUtil.kt b/app/src/main/java/org/oxycblt/auxio/home/list/ListUtil.kt
index 02220cc54..b765871a1 100644
--- a/app/src/main/java/org/oxycblt/auxio/home/list/ListUtil.kt
+++ b/app/src/main/java/org/oxycblt/auxio/home/list/ListUtil.kt
@@ -31,13 +31,13 @@ import android.graphics.RectF
import android.graphics.drawable.Drawable
import androidx.core.text.isDigitsOnly
import com.google.android.material.R
-import org.oxycblt.auxio.ui.ExpressiveShapes
-import org.oxycblt.auxio.util.getAttrColorCompat
-import org.oxycblt.musikr.tag.Name
import kotlin.math.hypot
import kotlin.math.max
import kotlin.math.min
import kotlin.math.roundToInt
+import org.oxycblt.auxio.ui.ExpressiveShapes
+import org.oxycblt.auxio.util.getAttrColorCompat
+import org.oxycblt.musikr.tag.Name
fun Name.thumb() =
when (this) {
@@ -143,4 +143,4 @@ class CookieShapeDrawable(context: Context) : Drawable() {
return maxRadius
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/org/oxycblt/auxio/list/recycler/SoftBurstImageView.kt b/app/src/main/java/org/oxycblt/auxio/list/recycler/SoftBurstImageView.kt
index ea1424ce6..d0f132a40 100644
--- a/app/src/main/java/org/oxycblt/auxio/list/recycler/SoftBurstImageView.kt
+++ b/app/src/main/java/org/oxycblt/auxio/list/recycler/SoftBurstImageView.kt
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-
+
package org.oxycblt.auxio.list.recycler
import android.content.Context
diff --git a/app/src/main/java/org/oxycblt/auxio/list/recycler/SoftBurstShapeDrawable.kt b/app/src/main/java/org/oxycblt/auxio/list/recycler/SoftBurstShapeDrawable.kt
index 3fedd17db..483145c39 100644
--- a/app/src/main/java/org/oxycblt/auxio/list/recycler/SoftBurstShapeDrawable.kt
+++ b/app/src/main/java/org/oxycblt/auxio/list/recycler/SoftBurstShapeDrawable.kt
@@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
-
+
package org.oxycblt.auxio.list.recycler
import android.content.Context
@@ -29,12 +29,12 @@ import android.graphics.PixelFormat
import android.graphics.Rect
import android.graphics.RectF
import android.graphics.drawable.Drawable
-import org.oxycblt.auxio.ui.ExpressiveShapes
import com.google.android.material.R as MR
import kotlin.math.hypot
import kotlin.math.max
import kotlin.math.min
import kotlin.math.roundToInt
+import org.oxycblt.auxio.ui.ExpressiveShapes
import org.oxycblt.auxio.util.getAttrColorCompat
/**
diff --git a/app/src/main/java/org/oxycblt/auxio/ui/ButtonGroupToolbar.kt b/app/src/main/java/org/oxycblt/auxio/ui/ButtonGroupToolbar.kt
new file mode 100644
index 000000000..2e70b9be7
--- /dev/null
+++ b/app/src/main/java/org/oxycblt/auxio/ui/ButtonGroupToolbar.kt
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2026 Auxio Project
+ * ButtonGroupToolbar.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.ui
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.util.AttributeSet
+import android.view.Gravity
+import android.view.Menu
+import android.view.MenuInflater
+import android.view.MenuItem
+import android.view.View
+import android.widget.LinearLayout
+import androidx.annotation.AttrRes
+import androidx.annotation.MenuRes
+import androidx.appcompat.view.menu.MenuBuilder
+import androidx.appcompat.view.menu.MenuItemImpl
+import androidx.appcompat.widget.PopupMenu
+import com.google.android.material.R as MR
+import com.google.android.material.appbar.MaterialToolbar
+import com.google.android.material.button.MaterialButtonGroup
+import org.oxycblt.auxio.R
+
+/**
+ * A [MaterialToolbar] that replaces the standard
+ * [ActionMenuView][androidx.appcompat.widget.ActionMenuView] action items with a
+ * [MaterialButtonGroup] containing [RippleFixMaterialButton] instances. This enables M3 Expressive
+ * shape morphing and width animation behavior for toolbar action buttons.
+ *
+ * Since [MaterialToolbar] has no integration with [MaterialButtonGroup], this class intercepts menu
+ * inflation and constructs its own button group from the menu resource, hiding the internal
+ * [ActionMenuView][androidx.appcompat.widget.ActionMenuView] entirely. This is fragile, but the
+ * relevant internal APIs haven't changed in years.
+ *
+ * @author Alexander Capehart (OxygenCobalt)
+ */
+class ButtonGroupToolbar
+@JvmOverloads
+constructor(
+ context: Context,
+ attrs: AttributeSet? = null,
+ @AttrRes defStyleAttr: Int = androidx.appcompat.R.attr.toolbarStyle,
+) : MaterialToolbar(context, attrs, defStyleAttr) {
+ private var menuItemClickListener: OnMenuItemClickListener? = null
+ private var overflowClickListener: ((View) -> Unit)? = null
+ private var buttonGroup: MaterialButtonGroup? = null
+ @SuppressLint("RestrictedApi") private var menuBuilder: MenuBuilder? = null
+ private var isInitialized = false
+
+ // Intercept inflateMenu calls from the super constructor to prevent ActionMenuView creation.
+ // During the super constructor, isInitialized is false so this is a no-op. After
+ // construction, this delegates to buildButtonGroup.
+ override fun inflateMenu(@MenuRes resId: Int) {
+ if (isInitialized) {
+ buildButtonGroup(resId)
+ }
+ }
+
+ init {
+ // Read the menu attribute ourselves since we suppressed inflateMenu during the super
+ // constructor. This uses the same Toolbar_menu styleable that Toolbar reads internally.
+ val a =
+ context.obtainStyledAttributes(
+ attrs,
+ androidx.appcompat.R.styleable.Toolbar,
+ defStyleAttr,
+ 0,
+ )
+ val menuResId = a.getResourceId(androidx.appcompat.R.styleable.Toolbar_menu, 0)
+ a.recycle()
+
+ isInitialized = true
+ if (menuResId != 0) {
+ buildButtonGroup(menuResId)
+ }
+ }
+
+ @SuppressLint("RestrictedApi")
+ override fun getMenu(): Menu {
+ return menuBuilder ?: super.getMenu()
+ }
+
+ override fun setOnMenuItemClickListener(listener: OnMenuItemClickListener?) {
+ menuItemClickListener = listener
+ }
+
+ /**
+ * Override the overflow button's click behavior. When set, the overflow button will call
+ * [block] instead of showing the default popup menu.
+ */
+ fun overrideOnOverflowMenuClick(block: (View) -> Unit) {
+ overflowClickListener = block
+ }
+
+ @SuppressLint("RestrictedApi")
+ private fun buildButtonGroup(@MenuRes resId: Int) {
+ // Inflate the menu into a MenuBuilder, re-using the same pattern as MenuDialogFragment.
+ // Since we don't have (and don't want) a dummy view to inflate this menu, just
+ // depend on the AndroidX Toolbar internal API and hope for the best.
+ val builder = MenuBuilder(context)
+ MenuInflater(context).inflate(resId, builder)
+ menuBuilder = builder
+
+ // Separate action items from overflow items based on showAsAction flags.
+ val actionItems = mutableListOf()
+ val overflowItems = mutableListOf()
+ for (i in 0 until builder.size()) {
+ val item = builder.getItem(i) as MenuItemImpl
+ if (!item.isVisible) continue
+ if (item.requiresActionButton() || item.requestsActionButton()) {
+ actionItems.add(item)
+ } else {
+ overflowItems.add(item)
+ }
+ }
+
+ // Remove old button group if one exists.
+ buttonGroup?.let { removeView(it) }
+
+ // Create new button group using the theme-configured style.
+ val group =
+ MaterialButtonGroup(context, null, MR.attr.materialButtonGroupStyle).apply {
+ layoutParams =
+ LayoutParams(
+ LayoutParams.WRAP_CONTENT,
+ LayoutParams.WRAP_CONTENT,
+ Gravity.END or Gravity.CENTER_VERTICAL,
+ )
+ }
+
+ // Create a MaterialButton for each action item.
+ for (item in actionItems) {
+ val button =
+ RippleFixMaterialButton(context, null, MR.attr.materialIconButtonStyle).apply {
+ layoutParams =
+ LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ )
+ id = item.itemId
+ icon = item.icon
+ contentDescription = item.title
+ setOnClickListener { menuItemClickListener?.onMenuItemClick(item) }
+ }
+ group.addView(button)
+ }
+
+ // Add an overflow button if there are overflow items.
+ if (overflowItems.isNotEmpty()) {
+ val overflowButton =
+ RippleFixMaterialButton(context, null, MR.attr.materialIconButtonStyle).apply {
+ layoutParams =
+ LinearLayout.LayoutParams(
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ LinearLayout.LayoutParams.WRAP_CONTENT,
+ )
+ setIconResource(R.drawable.ic_more_24)
+ contentDescription = context.getString(R.string.lbl_more)
+ setOnClickListener { view ->
+ val customListener = overflowClickListener
+ if (customListener != null) {
+ customListener(view)
+ } else {
+ showOverflowPopup(view, overflowItems)
+ }
+ }
+ }
+ group.addView(overflowButton)
+ }
+
+ addView(group)
+ buttonGroup = group
+ }
+
+ private fun showOverflowPopup(anchor: View, items: List