home: add indicator to date added sorting
Add a fast-scroll indicator for date added sorting. Forgot to add this initially.
This commit is contained in:
parent
3c3b9ac7cc
commit
75e80a7253
7 changed files with 44 additions and 11 deletions
|
@ -2,11 +2,13 @@
|
|||
|
||||
## dev
|
||||
|
||||
#### What's Changed
|
||||
- Use X-axis transitions instead of Z-axis (Avoids visual clipping)
|
||||
|
||||
#### What's Fixed
|
||||
- Fixed incorrect font being used in the queue title
|
||||
- Fixed missing fast scroll indicator with date added scrolling
|
||||
|
||||
#### What's Changed
|
||||
- Use X-axis transitions instead of Z-axis (Avoids visual clipping)
|
||||
- Queue no longer has rounded corners for consistency
|
||||
|
||||
## 2.6.0
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ private class AlbumDetailViewHolder private constructor(private val binding: Ite
|
|||
|
||||
override fun bind(item: Album, listener: AlbumDetailAdapter.Listener) {
|
||||
binding.detailCover.bind(item)
|
||||
binding.detailType?.text =
|
||||
binding.detailType.text =
|
||||
binding.context.getString(item.releaseType?.stringRes ?: R.string.lbl_album)
|
||||
|
||||
binding.detailName.text = item.resolveName(binding.context)
|
||||
|
|
|
@ -123,7 +123,7 @@ private class ArtistDetailViewHolder private constructor(private val binding: It
|
|||
|
||||
override fun bind(item: Artist, listener: DetailAdapter.Listener) {
|
||||
binding.detailCover.bind(item)
|
||||
binding.detailType?.text = binding.context.getString(R.string.lbl_artist)
|
||||
binding.detailType.text = binding.context.getString(R.string.lbl_artist)
|
||||
binding.detailName.text = item.resolveName(binding.context)
|
||||
|
||||
// Get the genre that corresponds to the most songs in this artist, which would be
|
||||
|
|
|
@ -104,7 +104,7 @@ private class GenreDetailViewHolder private constructor(private val binding: Ite
|
|||
BindingViewHolder<Genre, DetailAdapter.Listener>(binding.root) {
|
||||
override fun bind(item: Genre, listener: DetailAdapter.Listener) {
|
||||
binding.detailCover.bind(item)
|
||||
binding.detailType?.text = binding.context.getString(R.string.lbl_genre)
|
||||
binding.detailType.text = binding.context.getString(R.string.lbl_genre)
|
||||
binding.detailName.text = item.resolveName(binding.context)
|
||||
binding.detailSubhead.text =
|
||||
binding.context.getPlural(R.plurals.fmt_song_count, item.songs.size)
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
package org.oxycblt.auxio.home.list
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.format.DateUtils
|
||||
import android.view.View
|
||||
import java.util.*
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentHomeListBinding
|
||||
import org.oxycblt.auxio.music.Album
|
||||
|
@ -40,6 +42,8 @@ import org.oxycblt.auxio.util.logEOrThrow
|
|||
*/
|
||||
class AlbumListFragment : HomeListFragment<Album>() {
|
||||
private val homeAdapter = AlbumAdapter(this)
|
||||
private val formatterSb = StringBuilder(50)
|
||||
private val formatter = Formatter(formatterSb)
|
||||
|
||||
override fun onBindingCreated(binding: FragmentHomeListBinding, savedInstanceState: Bundle?) {
|
||||
super.onBindingCreated(binding, savedInstanceState)
|
||||
|
@ -72,6 +76,16 @@ class AlbumListFragment : HomeListFragment<Album>() {
|
|||
// Count -> Use song count
|
||||
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()
|
||||
}
|
||||
|
||||
// Unsupported sort, error gracefully
|
||||
else -> null
|
||||
}
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
package org.oxycblt.auxio.home.list
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.format.DateUtils
|
||||
import android.view.View
|
||||
import java.util.Formatter
|
||||
import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.databinding.FragmentHomeListBinding
|
||||
import org.oxycblt.auxio.music.Song
|
||||
|
@ -42,6 +44,8 @@ import org.oxycblt.auxio.util.logEOrThrow
|
|||
class SongListFragment : HomeListFragment<Song>() {
|
||||
private val homeAdapter = SongsAdapter(this)
|
||||
private val settings: Settings by lifecycleObject { binding -> Settings(binding.context) }
|
||||
private val formatterSb = StringBuilder(50)
|
||||
private val formatter = Formatter(formatterSb)
|
||||
|
||||
override fun onBindingCreated(binding: FragmentHomeListBinding, savedInstanceState: Bundle?) {
|
||||
super.onBindingCreated(binding, savedInstanceState)
|
||||
|
@ -76,6 +80,19 @@ class SongListFragment : HomeListFragment<Song>() {
|
|||
// Duration -> Use formatted duration
|
||||
is Sort.Mode.ByDuration -> song.durationSecs.formatDuration(false)
|
||||
|
||||
// Last added -> Format as date
|
||||
is Sort.Mode.ByDateAdded -> {
|
||||
val dateAddedMillis = song.dateAdded * 1000
|
||||
formatterSb.setLength(0)
|
||||
DateUtils.formatDateRange(
|
||||
context,
|
||||
formatter,
|
||||
dateAddedMillis,
|
||||
dateAddedMillis,
|
||||
DateUtils.FORMAT_ABBREV_ALL)
|
||||
.toString()
|
||||
}
|
||||
|
||||
// Unsupported sort, error gracefully
|
||||
else -> null
|
||||
}
|
||||
|
|
|
@ -39,10 +39,10 @@ import org.oxycblt.auxio.util.systemBarInsetsCompat
|
|||
* 2. Over scrolling. Glow scrolls will not cut it, as the bottom glow will be caught under the bar,
|
||||
* and moving it above the insets will result in an incorrect glow position when the bar is not
|
||||
* shown. I have to emulate stretch scrolling below Android 12 instead. However, this is also
|
||||
* similarly distorted by the insets, and thus I must go further and modify the edge effect to be
|
||||
* at least somewhat clamped to the insets themselves.
|
||||
* 3. Touch events. Bottom sheets must always intercept touches in their bounds, or they will
|
||||
* click the now overlapping content view that is only inset by it and not unhidden by it.
|
||||
* similarly distorted by the insets, and thus I must go further and modify the edge effect to be at
|
||||
* least somewhat clamped to the insets themselves.
|
||||
* 3. Touch events. Bottom sheets must always intercept touches in their bounds, or they will click
|
||||
* the now overlapping content view that is only inset by it and not unhidden by it.
|
||||
*
|
||||
* @author OxygenCobalt
|
||||
*/
|
||||
|
@ -115,7 +115,7 @@ class BottomSheetContentBehavior<V : View>(context: Context, attributeSet: Attri
|
|||
layoutContent(child)
|
||||
|
||||
if (!setup) {
|
||||
child.setOnApplyWindowInsetsListener { v, insets ->
|
||||
child.setOnApplyWindowInsetsListener { _, insets ->
|
||||
lastInsets = insets
|
||||
val dep = dep ?: return@setOnApplyWindowInsetsListener insets
|
||||
val behavior = dep.coordinatorLayoutBehavior as NeoBottomSheetBehavior
|
||||
|
|
Loading…
Reference in a new issue