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
|
## dev
|
||||||
|
|
||||||
|
#### What's New
|
||||||
|
- Detail UI now displays the type of item shown (ex. the release type)
|
||||||
|
|
||||||
#### What's Fixed
|
#### What's Fixed
|
||||||
- Fixed incorrect font being used in the queue title
|
- Fixed incorrect font being used in the queue title
|
||||||
- Fixed missing fast scroll indicator with date added scrolling
|
- Fixed missing fast scroll indicator with date added scrolling
|
||||||
|
|
|
@ -77,14 +77,17 @@ class AlbumListFragment : HomeListFragment<Album>() {
|
||||||
is Sort.Mode.ByCount -> album.songs.size.toString()
|
is Sort.Mode.ByCount -> album.songs.size.toString()
|
||||||
|
|
||||||
// Last added -> Format as date
|
// Last added -> Format as date
|
||||||
is Sort.Mode.ByDateAdded ->
|
is Sort.Mode.ByDateAdded -> {
|
||||||
(album.songs.minOf { it.dateAdded } * 1000).let {
|
val dateAddedMillis = album.dateAdded * 1000
|
||||||
// Emulate formatDateTime with our own formatter instance to save memory.
|
formatterSb.setLength(0)
|
||||||
formatterSb.setLength(0)
|
DateUtils.formatDateRange(
|
||||||
DateUtils.formatDateRange(
|
context,
|
||||||
context, formatter, it, it, DateUtils.FORMAT_ABBREV_ALL)
|
formatter,
|
||||||
.toString()
|
dateAddedMillis,
|
||||||
}
|
dateAddedMillis,
|
||||||
|
DateUtils.FORMAT_ABBREV_ALL)
|
||||||
|
.toString()
|
||||||
|
}
|
||||||
|
|
||||||
// Unsupported sort, error gracefully
|
// Unsupported sort, error gracefully
|
||||||
else -> null
|
else -> null
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.oxycblt.auxio.ui
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
@ -67,16 +66,8 @@ abstract class AuxioSheetBehavior<V : View>(context: Context, attributeSet: Attr
|
||||||
|
|
||||||
if (!setup) {
|
if (!setup) {
|
||||||
child.apply {
|
child.apply {
|
||||||
|
translationZ = context.getDimen(R.dimen.elevation_normal)
|
||||||
background = createBackground(context)
|
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)
|
setOnApplyWindowInsetsListener(::applyWindowInsets)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
android:id="@+id/playback_sheet"
|
android:id="@+id/playback_sheet"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
style="@style/Widget.Auxio.DisableDropShadows"
|
||||||
app:layout_behavior="org.oxycblt.auxio.playback.PlaybackSheetBehavior">
|
app:layout_behavior="org.oxycblt.auxio.playback.PlaybackSheetBehavior">
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<androidx.fragment.app.FragmentContainerView
|
||||||
|
@ -41,6 +42,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
style="@style/Widget.Auxio.DisableDropShadows"
|
||||||
app:layout_behavior="org.oxycblt.auxio.playback.queue.QueueSheetBehavior">
|
app:layout_behavior="org.oxycblt.auxio.playback.queue.QueueSheetBehavior">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
style="@style/Widget.Auxio.DisableDropShadows"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,12 @@
|
||||||
<item name="android:paddingBottom">@dimen/recycler_fab_space_normal</item>
|
<item name="android:paddingBottom">@dimen/recycler_fab_space_normal</item>
|
||||||
</style>
|
</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="">
|
<style name="ThemeOverlay.Accent" parent="">
|
||||||
<item name="colorOnPrimary">?attr/colorSurface</item>
|
<item name="colorOnPrimary">?attr/colorSurface</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue