优化搜索

pull/737/head
gedoor 4 years ago
parent 883fa65263
commit 65facf0706
  1. 11
      app/src/main/java/io/legado/app/ui/book/search/SearchAdapter.kt

@ -28,19 +28,11 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
} }
override fun areContentsTheSame(oldItem: SearchBook, newItem: SearchBook): Boolean { override fun areContentsTheSame(oldItem: SearchBook, newItem: SearchBook): Boolean {
return when { return false
oldItem.origins.size != newItem.origins.size -> false
oldItem.coverUrl != newItem.coverUrl -> false
oldItem.kind != newItem.kind -> false
oldItem.latestChapterTitle != newItem.latestChapterTitle -> false
oldItem.intro != newItem.intro -> false
else -> true
}
} }
override fun getChangePayload(oldItem: SearchBook, newItem: SearchBook): Any? { override fun getChangePayload(oldItem: SearchBook, newItem: SearchBook): Any? {
val payload = Bundle() val payload = Bundle()
if (oldItem.origins.size != newItem.origins.size)
payload.putInt("origins", newItem.origins.size) payload.putInt("origins", newItem.origins.size)
if (oldItem.coverUrl != newItem.coverUrl) if (oldItem.coverUrl != newItem.coverUrl)
payload.putString("cover", newItem.coverUrl) payload.putString("cover", newItem.coverUrl)
@ -50,7 +42,6 @@ class SearchAdapter(context: Context, val callBack: CallBack) :
payload.putString("last", newItem.latestChapterTitle) payload.putString("last", newItem.latestChapterTitle)
if (oldItem.intro != newItem.intro) if (oldItem.intro != newItem.intro)
payload.putString("intro", newItem.intro) payload.putString("intro", newItem.intro)
if (payload.isEmpty) return null
return payload return payload
} }

Loading…
Cancel
Save