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:
@@ -77,14 +77,17 @@ 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.
|
||||
formatterSb.setLength(0)
|
||||
DateUtils.formatDateRange(
|
||||
context, formatter, it, it, DateUtils.FORMAT_ABBREV_ALL)
|
||||
.toString()
|
||||
}
|
||||
is Sort.Mode.ByDateAdded -> {
|
||||
val dateAddedMillis = album.dateAdded * 1000
|
||||
formatterSb.setLength(0)
|
||||
DateUtils.formatDateRange(
|
||||
context,
|
||||
formatter,
|
||||
dateAddedMillis,
|
||||
dateAddedMillis,
|
||||
DateUtils.FORMAT_ABBREV_ALL)
|
||||
.toString()
|
||||
}
|
||||
|
||||
// Unsupported sort, error gracefully
|
||||
else -> null
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user