diff --git a/CHANGELOG.md b/CHANGELOG.md index ef5297bea..f57cd5492 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ finished saving - Fixed crash when search filter mode was changed - Fixed shuffle button appearing below playback bar on Android 10 and lower - Fixed incorrect song being shown in the notification in some cases [#179] +- Fixed issue where toolbar will be clipped on Lollipop devices #### What's Changed - Reworked typography and iconography to be more aligned with material design guidelines diff --git a/app/src/main/java/org/oxycblt/auxio/ui/M3Toolbar.kt b/app/src/main/java/org/oxycblt/auxio/ui/M3Toolbar.kt new file mode 100644 index 000000000..ed3028ddf --- /dev/null +++ b/app/src/main/java/org/oxycblt/auxio/ui/M3Toolbar.kt @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Auxio Project + * + * 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.content.Context +import android.util.AttributeSet +import androidx.annotation.AttrRes +import androidx.core.view.updatePaddingRelative +import com.google.android.material.appbar.MaterialToolbar +import org.oxycblt.auxio.R +import org.oxycblt.auxio.util.getDimenSizeSafe + +/** [MaterialToolbar] that automatically fixes padding in order to align with the M3 specs. */ +class M3Toolbar : MaterialToolbar { + constructor(context: Context) : super(context) + + constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) + + constructor( + context: Context, + attrs: AttributeSet?, + @AttrRes defStyleAttr: Int + ) : super(context, attrs, defStyleAttr) + init { + val tinySpacing = context.getDimenSizeSafe(R.dimen.spacing_tiny) + + if (navigationIcon != null) { + updatePaddingRelative(start = tinySpacing) + } + + if (menu != null) { + updatePaddingRelative(end = tinySpacing) + } + } +} diff --git a/app/src/main/res/layout-land/fragment_playback_panel.xml b/app/src/main/res/layout-land/fragment_playback_panel.xml index d4b57ab6e..19a8330b0 100644 --- a/app/src/main/res/layout-land/fragment_playback_panel.xml +++ b/app/src/main/res/layout-land/fragment_playback_panel.xml @@ -5,9 +5,9 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - - - diff --git a/app/src/main/res/layout/fragment_detail.xml b/app/src/main/res/layout/fragment_detail.xml index 82b0d6181..8ce707c66 100644 --- a/app/src/main/res/layout/fragment_detail.xml +++ b/app/src/main/res/layout/fragment_detail.xml @@ -15,9 +15,9 @@ app:liftOnScroll="true" app:liftOnScrollTargetViewId="@id/detail_recycler"> - + style="@style/Widget.Auxio.Toolbar.Icon" /> diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 4f5242bd9..e9fab0c52 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -11,9 +11,10 @@ style="@style/Widget.Auxio.AppBarLayout" app:liftOnScroll="true"> - diff --git a/app/src/main/res/layout/fragment_playback_panel.xml b/app/src/main/res/layout/fragment_playback_panel.xml index 15acb60d8..46958ec2f 100644 --- a/app/src/main/res/layout/fragment_playback_panel.xml +++ b/app/src/main/res/layout/fragment_playback_panel.xml @@ -5,9 +5,9 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - - + diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml index 3ee3f8af6..df8894536 100644 --- a/app/src/main/res/layout/fragment_settings.xml +++ b/app/src/main/res/layout/fragment_settings.xml @@ -13,7 +13,7 @@ android:focusable="true" app:liftOnScroll="true"> - diff --git a/app/src/main/res/values-sw600dp/styles_ui.xml b/app/src/main/res/values-sw600dp/styles_ui.xml deleted file mode 100644 index 487c594b1..000000000 --- a/app/src/main/res/values-sw600dp/styles_ui.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values-sw640dp/styles_ui.xml b/app/src/main/res/values-sw640dp/styles_ui.xml index 16109db61..0eb4a5e8a 100644 --- a/app/src/main/res/values-sw640dp/styles_ui.xml +++ b/app/src/main/res/values-sw640dp/styles_ui.xml @@ -1,7 +1,10 @@ - + + \ No newline at end of file diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index d5b76a386..3002f61a8 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -55,6 +55,4 @@ 110dp @dimen/widget_width_min @dimen/widget_height_min - - 4dp \ No newline at end of file diff --git a/app/src/main/res/values/styles_ui.xml b/app/src/main/res/values/styles_ui.xml index bdb9222c1..a8fea2827 100644 --- a/app/src/main/res/values/styles_ui.xml +++ b/app/src/main/res/values/styles_ui.xml @@ -13,30 +13,14 @@ wrap_content - - - - - - - - +