From e6d60e670e2929748496936754a29171d432e382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Borcz?= Date: Fri, 18 Jan 2019 19:10:14 +0100 Subject: [PATCH] Fix crash on duplicate notes (#218) --- .../java/io/github/wulkanowy/ui/modules/note/NoteItem.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteItem.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteItem.kt index 97635a2c..71562fc4 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteItem.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/note/NoteItem.kt @@ -46,11 +46,14 @@ class NoteItem(val note: Note) : AbstractFlexibleItem() { other as NoteItem if (note != other.note) return false + if (note.id != other.note.id) return false return true } override fun hashCode(): Int { - return note.hashCode() + var result = note.hashCode() + result = 31 * result + note.id.toInt() + return result } class ViewHolder(val view: View, adapter: FlexibleAdapter<*>) : FlexibleViewHolder(view, adapter), LayoutContainer {