diff --git a/app/src/main/java/org/oxycblt/auxio/music/model/Library.kt b/app/src/main/java/org/oxycblt/auxio/music/model/Library.kt index b952efba8..54c99a084 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/model/Library.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/model/Library.kt @@ -100,6 +100,21 @@ private class LibraryImpl(rawSongs: List, settings: MusicSettings) : Li genres.forEach { put(it.uid, it.finalize()) } } + override fun equals(other: Any?) = + other is Library && + other.songs == songs && + other.albums == albums && + other.artists == artists && + other.genres == genres + + override fun hashCode(): Int { + var hashCode = songs.hashCode() + hashCode = hashCode * 31 + albums.hashCode() + hashCode = hashCode * 31 + artists.hashCode() + hashCode = hashCode * 31 + genres.hashCode() + return hashCode + } + /** * Finds a [Music] item [T] in the library by it's [Music.UID]. * @param uid The [Music.UID] to search for. diff --git a/app/src/main/java/org/oxycblt/auxio/settings/Settings.kt b/app/src/main/java/org/oxycblt/auxio/settings/Settings.kt index 1552becd3..5bc4448b9 100644 --- a/app/src/main/java/org/oxycblt/auxio/settings/Settings.kt +++ b/app/src/main/java/org/oxycblt/auxio/settings/Settings.kt @@ -85,6 +85,7 @@ interface Settings { sharedPreferences: SharedPreferences, key: String ) { + // FIXME: Settings initialization firing the listener. onSettingChanged(key, unlikelyToBeNull(listener)) }