music: fix broken equality
Fix broken MusicParent equality that failed to properly compare types.
This commit is contained in:
@@ -22,6 +22,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
|||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import org.oxycblt.auxio.music.*
|
import org.oxycblt.auxio.music.*
|
||||||
import org.oxycblt.auxio.music.library.Library
|
import org.oxycblt.auxio.music.library.Library
|
||||||
|
import org.oxycblt.auxio.util.logD
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A [ViewModel] that manages the current selection.
|
* A [ViewModel] that manages the current selection.
|
||||||
|
|||||||
@@ -319,7 +319,8 @@ class RealAlbum(val raw: Raw, override val songs: List<RealSong>) : Album {
|
|||||||
// Note: Append song contents to MusicParent equality so that Groups with
|
// Note: Append song contents to MusicParent equality so that Groups with
|
||||||
// the same UID but different contents are not equal.
|
// the same UID but different contents are not equal.
|
||||||
override fun hashCode() = 31 * uid.hashCode() + songs.hashCode()
|
override fun hashCode() = 31 * uid.hashCode() + songs.hashCode()
|
||||||
override fun equals(other: Any?) = other is Album && uid == other.uid && songs == other.songs
|
override fun equals(other: Any?) =
|
||||||
|
other is RealAlbum && uid == other.uid && songs == other.songs
|
||||||
|
|
||||||
private val _artists = mutableListOf<RealArtist>()
|
private val _artists = mutableListOf<RealArtist>()
|
||||||
override val artists: List<Artist>
|
override val artists: List<Artist>
|
||||||
@@ -455,7 +456,8 @@ class RealArtist constructor(private val raw: Raw, songAlbums: List<Music>) : Ar
|
|||||||
// Note: Append song contents to MusicParent equality so that Groups with
|
// Note: Append song contents to MusicParent equality so that Groups with
|
||||||
// the same UID but different contents are not equal.
|
// the same UID but different contents are not equal.
|
||||||
override fun hashCode() = 31 * uid.hashCode() + songs.hashCode()
|
override fun hashCode() = 31 * uid.hashCode() + songs.hashCode()
|
||||||
override fun equals(other: Any?) = other is Album && uid == other.uid && songs == other.songs
|
override fun equals(other: Any?) =
|
||||||
|
other is RealArtist && uid == other.uid && songs == other.songs
|
||||||
|
|
||||||
override lateinit var genres: List<Genre>
|
override lateinit var genres: List<Genre>
|
||||||
override fun resolveGenreContents(context: Context) = resolveNames(context, genres)
|
override fun resolveGenreContents(context: Context) = resolveNames(context, genres)
|
||||||
@@ -581,7 +583,8 @@ class RealGenre constructor(private val raw: Raw, override val songs: List<RealS
|
|||||||
// Note: Append song contents to MusicParent equality so that Groups with
|
// Note: Append song contents to MusicParent equality so that Groups with
|
||||||
// the same UID but different contents are not equal.
|
// the same UID but different contents are not equal.
|
||||||
override fun hashCode() = 31 * uid.hashCode() + songs.hashCode()
|
override fun hashCode() = 31 * uid.hashCode() + songs.hashCode()
|
||||||
override fun equals(other: Any?) = other is Album && uid == other.uid && songs == other.songs
|
override fun equals(other: Any?) =
|
||||||
|
other is RealGenre && uid == other.uid && songs == other.songs
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val distinctAlbums = mutableSetOf<Album>()
|
val distinctAlbums = mutableSetOf<Album>()
|
||||||
|
|||||||
Reference in New Issue
Block a user