main: fix unusable fast scroll below fab

This commit is contained in:
Alexander Capehart 2025-01-08 13:14:53 -07:00
parent 4a08809e50
commit f8ec77e137
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
3 changed files with 17 additions and 3 deletions

View file

@ -190,6 +190,8 @@ class ThemedSpeedDialView : SpeedDialView {
val overlayColor = surfaceColor.defaultColor.withModulatedAlpha(0.87f)
overlayLayout.setBackgroundColor(overlayColor)
}
// Fix default margins added by library
(mainFab.layoutParams as LayoutParams).setMargins(0, 0, 0, 0)
}
private fun Int.withModulatedAlpha(
@ -230,13 +232,24 @@ class ThemedSpeedDialView : SpeedDialView {
return super.addActionItem(actionItem, position, animate)?.apply {
fab.apply {
updateLayoutParams<MarginLayoutParams> {
val horizontalMargin = context.getDimenPixels(R.dimen.spacing_mid_large)
setMargins(horizontalMargin, 0, horizontalMargin, 0)
val rightMargin = context.getDimenPixels(R.dimen.spacing_tiny)
if (position == actionItems.lastIndex) {
val bottomMargin = context.getDimenPixels(R.dimen.spacing_small)
setMargins(0, 0, rightMargin, bottomMargin)
} else {
setMargins(0, 0, rightMargin, 0)
}
}
useCompatPadding = false
}
labelBackground.apply {
updateLayoutParams<MarginLayoutParams> {
if (position == actionItems.lastIndex) {
val bottomMargin = context.getDimenPixels(R.dimen.spacing_small)
setMargins(0, 0, rightMargin, bottomMargin)
}
}
useCompatPadding = false
setContentPadding(spacingSmall, spacingSmall, spacingSmall, spacingSmall)
background =

View file

@ -28,6 +28,7 @@
android:layout_gravity="bottom|end"
android:clipChildren="false"
android:clipToPadding="false"
android:layout_margin="@dimen/spacing_medium"
app:layout_anchor="@id/home_content">
<org.oxycblt.auxio.home.ThemedSpeedDialView

View file

@ -33,6 +33,7 @@
android:layout_height="match_parent"
android:layout_gravity="bottom|end"
android:clipChildren="false"
android:layout_margin="@dimen/spacing_medium"
android:clipToPadding="false"
app:layout_anchor="@id/home_content">
@ -54,7 +55,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/spacing_medium"
android:contentDescription="@string/lbl_shuffle"
android:src="@drawable/ic_shuffle_off_24" />