pull/32/head
kunfei 5 years ago
parent d033b4e68d
commit f82a313874
  1. 6
      app/src/main/java/io/legado/app/data/entities/SearchBook.kt
  2. 1
      app/src/main/java/io/legado/app/ui/changesource/ChangeSourceViewModel.kt

@ -30,7 +30,7 @@ data class SearchBook(
var variable: String? = null,
var bookInfoHtml: String? = null,
var originOrder: Int = 0
) : Parcelable, BaseBook {
) : Parcelable, BaseBook, Comparable<SearchBook> {
override fun equals(other: Any?): Boolean {
if (other is SearchBook) {
@ -45,6 +45,10 @@ data class SearchBook(
return bookUrl.hashCode()
}
override fun compareTo(other: SearchBook): Int {
return other.originOrder - this.originOrder
}
@IgnoredOnParcel
@Ignore
override var variableMap: HashMap<String, String>? = null

@ -34,6 +34,7 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
execute {
callBack?.adapter()?.let {
val books = searchBooks.toList()
books.sorted()
val diffResult = DiffUtil.calculateDiff(DiffCallBack(it.getItems(), searchBooks.toList()))
withContext(Main) {
synchronized(this) {

Loading…
Cancel
Save