From f4f427dd2aef87d87d715ad61274e63efe05e9ef Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 8 Jan 2020 21:31:32 -0500 Subject: [PATCH] Restore equals/hashCode in ChapterTransition (closes #2461) --- .../tachiyomi/ui/reader/model/ChapterTransition.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ChapterTransition.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ChapterTransition.kt index d963371f21..892eceab04 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ChapterTransition.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ChapterTransition.kt @@ -12,6 +12,20 @@ sealed class ChapterTransition { override val from: ReaderChapter, override val to: ReaderChapter? ) : ChapterTransition() + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is ChapterTransition) return false + if (from == other.from && to == other.to) return true + if (from == other.to && to == other.from) return true + return false + } + + override fun hashCode(): Int { + var result = from.hashCode() + result = 31 * result + (to?.hashCode() ?: 0) + return result + } + override fun toString(): String { return "${javaClass.simpleName}(from=${from.chapter.url}, to=${to?.chapter?.url})" }