mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 11:47:48 +01:00
LibraryItem: Fix equality check (#7999)
Proper equality check is needed by compose for state changes.
This commit is contained in:
parent
9e5d79aec3
commit
7270c48f26
1 changed files with 22 additions and 5 deletions
|
@ -67,13 +67,30 @@ class LibraryItem(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (other is LibraryItem) {
|
if (this === other) return true
|
||||||
return manga.id == other.manga.id
|
if (javaClass != other?.javaClass) return false
|
||||||
}
|
|
||||||
return false
|
other as LibraryItem
|
||||||
|
|
||||||
|
if (manga != other.manga) return false
|
||||||
|
if (sourceManager != other.sourceManager) return false
|
||||||
|
if (displayMode != other.displayMode) return false
|
||||||
|
if (downloadCount != other.downloadCount) return false
|
||||||
|
if (unreadCount != other.unreadCount) return false
|
||||||
|
if (isLocal != other.isLocal) return false
|
||||||
|
if (sourceLanguage != other.sourceLanguage) return false
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return manga.id!!.hashCode()
|
var result = manga.hashCode()
|
||||||
|
result = 31 * result + sourceManager.hashCode()
|
||||||
|
result = 31 * result + displayMode.hashCode()
|
||||||
|
result = 31 * result + downloadCount
|
||||||
|
result = 31 * result + unreadCount
|
||||||
|
result = 31 * result + isLocal.hashCode()
|
||||||
|
result = 31 * result + sourceLanguage.hashCode()
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue