music: sort songs by individual date first
While still falling back to the album date for libraries that have the same date for all songs (like mine) Resolves #797.
This commit is contained in:
parent
f116d551da
commit
368c8cf00f
2 changed files with 10 additions and 2 deletions
|
@ -6,6 +6,9 @@
|
||||||
- New app branding and icon
|
- New app branding and icon
|
||||||
- Refreshed playback design
|
- Refreshed playback design
|
||||||
|
|
||||||
|
#### What's Improved
|
||||||
|
- Sorting songs by date now uses songs date first, before the earliest album date
|
||||||
|
|
||||||
#### What's Fixed
|
#### What's Fixed
|
||||||
- Music loader no longer spawns thousands of threads when scanning
|
- Music loader no longer spawns thousands of threads when scanning
|
||||||
- Excessive CPU no longer spent showing music loading process
|
- Excessive CPU no longer spent showing music loading process
|
||||||
|
|
|
@ -18,9 +18,10 @@
|
||||||
|
|
||||||
package org.oxycblt.auxio.list.sort
|
package org.oxycblt.auxio.list.sort
|
||||||
|
|
||||||
import kotlin.math.max
|
|
||||||
import org.oxycblt.auxio.IntegerTable
|
import org.oxycblt.auxio.IntegerTable
|
||||||
import org.oxycblt.auxio.R
|
import org.oxycblt.auxio.R
|
||||||
|
import org.oxycblt.auxio.list.sort.Sort.Direction
|
||||||
|
import org.oxycblt.auxio.list.sort.Sort.Mode
|
||||||
import org.oxycblt.auxio.music.Album
|
import org.oxycblt.auxio.music.Album
|
||||||
import org.oxycblt.auxio.music.Artist
|
import org.oxycblt.auxio.music.Artist
|
||||||
import org.oxycblt.auxio.music.Genre
|
import org.oxycblt.auxio.music.Genre
|
||||||
|
@ -29,6 +30,7 @@ import org.oxycblt.auxio.music.Playlist
|
||||||
import org.oxycblt.auxio.music.Song
|
import org.oxycblt.auxio.music.Song
|
||||||
import org.oxycblt.auxio.music.info.Date
|
import org.oxycblt.auxio.music.info.Date
|
||||||
import org.oxycblt.auxio.music.info.Disc
|
import org.oxycblt.auxio.music.info.Disc
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A sorting method.
|
* A sorting method.
|
||||||
|
@ -284,7 +286,7 @@ data class Sort(val mode: Mode, val direction: Direction) {
|
||||||
|
|
||||||
override fun getSongComparator(direction: Direction): Comparator<Song> =
|
override fun getSongComparator(direction: Direction): Comparator<Song> =
|
||||||
MultiComparator(
|
MultiComparator(
|
||||||
compareByDynamic(direction, NullableComparator.DATE_RANGE) { it.album.dates },
|
compareByDynamic(direction, NullableComparator.DATE) { it.date },
|
||||||
compareByDescending(BasicComparator.ALBUM) { it.album },
|
compareByDescending(BasicComparator.ALBUM) { it.album },
|
||||||
compareBy(NullableComparator.DISC) { it.disc },
|
compareBy(NullableComparator.DISC) { it.disc },
|
||||||
compareBy(NullableComparator.INT) { it.track },
|
compareBy(NullableComparator.INT) { it.track },
|
||||||
|
@ -624,5 +626,8 @@ private class NullableComparator<T : Comparable<T>> private constructor() : Comp
|
||||||
val DISC = NullableComparator<Disc>()
|
val DISC = NullableComparator<Disc>()
|
||||||
/** A re-usable instance configured for [Date.Range]s. */
|
/** A re-usable instance configured for [Date.Range]s. */
|
||||||
val DATE_RANGE = NullableComparator<Date.Range>()
|
val DATE_RANGE = NullableComparator<Date.Range>()
|
||||||
|
|
||||||
|
/** A re-usable instance configured for [Date]s. */
|
||||||
|
val DATE = NullableComparator<Date>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue