SearchBook.kt: Modify function with assigning method

Signed-off-by: 1552980358 <1552980358@qq.com>
pull/369/head
1552980358 5 years ago
parent e6bb108818
commit 763bc1585e
  1. 17
      app/src/main/java/io/legado/app/data/entities/SearchBook.kt

@ -46,18 +46,9 @@ data class SearchBook(
@IgnoredOnParcel
override var tocHtml: String? = null
override fun equals(other: Any?): Boolean {
if (other is SearchBook) {
if (other.bookUrl == bookUrl) {
return true
}
}
return false
}
override fun equals(other: Any?) = other is SearchBook && other.bookUrl == bookUrl
override fun hashCode(): Int {
return bookUrl.hashCode()
}
override fun hashCode() = bookUrl.hashCode()
override fun compareTo(other: SearchBook): Int {
return other.originOrder - this.originOrder
@ -93,8 +84,7 @@ data class SearchBook(
return "无最新章节"
}
fun toBook(): Book {
return Book(
fun toBook() = Book(
name = name,
author = author,
kind = kind,
@ -114,4 +104,3 @@ data class SearchBook(
this.tocUrl = this@SearchBook.tocUrl
}
}
}
Loading…
Cancel
Save