Browse Source

Fix source item flashing when pinning

arkon 4 years ago
parent
commit
26d5a87bef
1 changed files with 11 additions and 0 deletions
  1. 11 0
      app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceItem.kt

+ 11 - 0
app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceItem.kt

@@ -46,4 +46,15 @@ data class SourceItem(
     ) {
         holder.bind(this)
     }
+
+    override fun equals(other: Any?): Boolean {
+        if (other is SourceItem) {
+            return source.id == other.source.id && getHeader()?.code == other.getHeader()?.code
+        }
+        return false
+    }
+
+    override fun hashCode(): Int {
+        return source.id.hashCode() + (getHeader()?.code?.hashCode() ?: 0).toInt()
+    }
 }