pull/32/head
kunfei 5 years ago
parent db62d46f13
commit 909c6028f2
  1. 5
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceAdapter.kt
  2. 2
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceViewModel.kt

@ -17,6 +17,7 @@ class ChangeSourceAdapter(context: Context) : SimpleRecyclerAdapter<SearchBook>(
override fun convert(holder: ItemViewHolder, item: SearchBook, payloads: MutableList<Any>) {
holder.itemView.apply {
if (payloads.isEmpty()) {
this.onClick {
callBack?.changeTo(item)
}
@ -29,6 +30,10 @@ class ChangeSourceAdapter(context: Context) : SimpleRecyclerAdapter<SearchBook>(
iv_checked.invisible()
}
} ?: iv_checked.invisible()
} else {
tv_origin.text = item.originName
tv_last.text = item.latestChapterTitle
}
}
}

@ -36,12 +36,14 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
val books = searchBooks.toList()
val diffResult = DiffUtil.calculateDiff(DiffCallBack(it.getItems(), searchBooks.toList()))
withContext(Main) {
synchronized(this) {
it.setItemsNoNotify(books)
diffResult.dispatchUpdatesTo(it)
}
}
}
}
}
fun search() {
execute {

Loading…
Cancel
Save