ui: refactor shadow management
Make the shadow disabling workaround an XML style. Doing it this way is more elegant than disabling it in-code.
This commit is contained in:
parent
bcc16fb88c
commit
83d1e4eae4
6 changed files with 24 additions and 18 deletions
|
@ -2,6 +2,9 @@
|
|||
|
||||
## dev
|
||||
|
||||
#### What's New
|
||||
- Detail UI now displays the type of item shown (ex. the release type)
|
||||
|
||||
#### What's Fixed
|
||||
- Fixed incorrect font being used in the queue title
|
||||
- Fixed missing fast scroll indicator with date added scrolling
|
||||
|
|
|
@ -77,12 +77,15 @@ class AlbumListFragment : HomeListFragment<Album>() {
|
|||
is Sort.Mode.ByCount -> album.songs.size.toString()
|
||||
|
||||
// Last added -> Format as date
|
||||
is Sort.Mode.ByDateAdded ->
|
||||
(album.songs.minOf { it.dateAdded } * 1000).let {
|
||||
// Emulate formatDateTime with our own formatter instance to save memory.
|
||||
is Sort.Mode.ByDateAdded -> {
|
||||
val dateAddedMillis = album.dateAdded * 1000
|
||||
formatterSb.setLength(0)
|
||||
DateUtils.formatDateRange(
|
||||
context, formatter, it, it, DateUtils.FORMAT_ABBREV_ALL)
|
||||
context,
|
||||
formatter,
|
||||
dateAddedMillis,
|
||||
dateAddedMillis,
|
||||
DateUtils.FORMAT_ABBREV_ALL)
|
||||
.toString()
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.oxycblt.auxio.ui
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
@ -67,16 +66,8 @@ abstract class AuxioSheetBehavior<V : View>(context: Context, attributeSet: Attr
|
|||
|
||||
if (!setup) {
|
||||
child.apply {
|
||||
translationZ = context.getDimen(R.dimen.elevation_normal)
|
||||
background = createBackground(context)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
// Shadows aren't disabled by default, do that.
|
||||
val transparent =
|
||||
context.getColorCompat(android.R.color.transparent).defaultColor
|
||||
outlineAmbientShadowColor = transparent
|
||||
outlineSpotShadowColor = transparent
|
||||
}
|
||||
|
||||
setOnApplyWindowInsetsListener(::applyWindowInsets)
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
android:id="@+id/playback_sheet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
style="@style/Widget.Auxio.DisableDropShadows"
|
||||
app:layout_behavior="org.oxycblt.auxio.playback.PlaybackSheetBehavior">
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
|
@ -41,6 +42,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
style="@style/Widget.Auxio.DisableDropShadows"
|
||||
app:layout_behavior="org.oxycblt.auxio.playback.queue.QueueSheetBehavior">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
<FrameLayout 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"
|
||||
style="@style/Widget.Auxio.DisableDropShadows"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
|
|
@ -93,6 +93,12 @@
|
|||
<item name="android:paddingBottom">@dimen/recycler_fab_space_normal</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Auxio.DisableDropShadows" parent="">
|
||||
<!-- API 28+ Only -->
|
||||
<item name="android:outlineAmbientShadowColor" tools:ignore="NewApi">@android:color/transparent</item>
|
||||
<item name="android:outlineSpotShadowColor" tools:ignore="NewApi">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="ThemeOverlay.Accent" parent="">
|
||||
<item name="colorOnPrimary">?attr/colorSurface</item>
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue