Remove sub-item sorting

Remove the sorting of the music models child items, its mostly redundant for now.
This commit is contained in:
OxygenCobalt 2020-09-22 20:18:18 -06:00
parent 6b56ce4ae8
commit f5d007267d
5 changed files with 12 additions and 23 deletions

View file

@ -35,9 +35,9 @@ fun ImageView.getCoverArt(album: Album) {
// Get the artist image
@BindingAdapter("artistImage")
fun ImageView.getArtistImage(artist: Artist) {
// If there are more than one albums, then create a mosaic of them.
val request: ImageRequest
// If there are more than one albums, then create a mosaic of them.
if (artist.numAlbums >= 4) {
val uris = mutableListOf<Uri>()

View file

@ -14,8 +14,4 @@ data class Album(
val songs = mutableListOf<Song>()
val numSongs: Int get() = songs.size
fun finalize() {
songs.sortBy { it.track }
}
}

View file

@ -10,16 +10,17 @@ data class Artist(
var genre = ""
val numAlbums: Int get() = albums.size
var numSongs = 0
fun finalize() {
albums.sortByDescending { it.year }
albums.forEach { album ->
numSongs += album.numSongs
val numSongs: Int get() {
var num = 0
albums.forEach {
num += it.numSongs
}
return num
}
// If the artist has more than one genre, pick the most used one.
fun finalizeGenre() {
// If the artist has more than one genre, pick the most "prominent" one.
// [Really just eliminate duplicates created from my hacky way of getting genres loaded but shhhh]
genre = if (genres.size > 1) {
val groupGenres = genres.groupBy { it.name }

View file

@ -5,8 +5,4 @@ data class Genre(
var name: String,
) {
val artists = mutableListOf<Artist>()
fun finalize() {
artists.sortByDescending { it.name }
}
}

View file

@ -146,12 +146,8 @@ class MusicSorter(
// Finalize music
private fun finalizeMusic() {
// Correct any empty names [""] with the proper placeholders [Unknown Album]
genres.forEach { it.finalize() }
artists.forEach { it.finalize() }
albums.forEach { it.finalize() }
// Finalize the genre for each artist
artists.forEach { it.finalizeGenre() }
// Then finally sort the music
genres.sortWith(