From fb3cafddf33452b172d6c15eb75d84ffc5e8d661 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 25 Nov 2021 17:55:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/changecover/DiffCallBack.kt | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 app/src/main/java/io/legado/app/ui/book/changecover/DiffCallBack.kt diff --git a/app/src/main/java/io/legado/app/ui/book/changecover/DiffCallBack.kt b/app/src/main/java/io/legado/app/ui/book/changecover/DiffCallBack.kt deleted file mode 100644 index 65d6fdd36..000000000 --- a/app/src/main/java/io/legado/app/ui/book/changecover/DiffCallBack.kt +++ /dev/null @@ -1,54 +0,0 @@ -package io.legado.app.ui.book.changecover - -import android.os.Bundle -import androidx.recyclerview.widget.DiffUtil -import io.legado.app.data.entities.SearchBook - -class DiffCallBack( - private val oldItems: List, - private val newItems: List -) : DiffUtil.Callback() { - - override fun getOldListSize(): Int { - return oldItems.size - } - - override fun getNewListSize(): Int { - return newItems.size - } - - override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { - val oldItem = oldItems[oldItemPosition] - val newItem = newItems[newItemPosition] - return oldItem.bookUrl == newItem.bookUrl - } - - override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean { - val oldItem = oldItems[oldItemPosition] - val newItem = newItems[newItemPosition] - if (oldItem.originName != newItem.originName) { - return false - } - if (oldItem.coverUrl != newItem.coverUrl) { - return false - } - return true - } - - override fun getChangePayload(oldItemPosition: Int, newItemPosition: Int): Any? { - val oldItem = oldItems[oldItemPosition] - val newItem = newItems[newItemPosition] - val payload = Bundle() - if (oldItem.originName != newItem.originName) { - payload.putString("name", newItem.originName) - } - if (oldItem.coverUrl != newItem.coverUrl) { - payload.putString("coverUrl", newItem.coverUrl) - } - if (payload.isEmpty) { - return null - } - return payload - } - -} \ No newline at end of file