|
|
|
@ -36,54 +36,45 @@ data class SearchBook( |
|
|
|
|
var time: Long = System.currentTimeMillis(), |
|
|
|
|
var variable: String? = null, |
|
|
|
|
var originOrder: Int = 0 |
|
|
|
|
) : Parcelable, BaseBook, Comparable<SearchBook> { |
|
|
|
|
|
|
|
|
|
): Parcelable, BaseBook, Comparable<SearchBook> { |
|
|
|
|
|
|
|
|
|
@Ignore |
|
|
|
|
@IgnoredOnParcel |
|
|
|
|
override var infoHtml: String? = null |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Ignore |
|
|
|
|
@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 hashCode(): Int { |
|
|
|
|
return bookUrl.hashCode() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun equals(other: Any?) = other is SearchBook && other.bookUrl == bookUrl |
|
|
|
|
|
|
|
|
|
override fun hashCode() = bookUrl.hashCode() |
|
|
|
|
|
|
|
|
|
override fun compareTo(other: SearchBook): Int { |
|
|
|
|
return other.originOrder - this.originOrder |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@delegate:Transient |
|
|
|
|
@delegate:Ignore |
|
|
|
|
@IgnoredOnParcel |
|
|
|
|
override val variableMap by lazy { |
|
|
|
|
GSON.fromJsonObject<HashMap<String, String>>(variable) ?: HashMap() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun putVariable(key: String, value: String) { |
|
|
|
|
variableMap[key] = value |
|
|
|
|
variable = GSON.toJson(variableMap) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@delegate:Transient |
|
|
|
|
@delegate:Ignore |
|
|
|
|
@IgnoredOnParcel |
|
|
|
|
val origins: LinkedHashSet<String> by lazy { linkedSetOf(origin) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun addOrigin(origin: String) { |
|
|
|
|
origins.add(origin) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun getDisplayLastChapterTitle(): String { |
|
|
|
|
latestChapterTitle?.let { |
|
|
|
|
if (it.isNotEmpty()) { |
|
|
|
@ -92,26 +83,24 @@ data class SearchBook( |
|
|
|
|
} |
|
|
|
|
return "无最新章节" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun toBook(): Book { |
|
|
|
|
return Book( |
|
|
|
|
name = name, |
|
|
|
|
author = author, |
|
|
|
|
kind = kind, |
|
|
|
|
bookUrl = bookUrl, |
|
|
|
|
origin = origin, |
|
|
|
|
originName = originName, |
|
|
|
|
type = type, |
|
|
|
|
wordCount = wordCount, |
|
|
|
|
latestChapterTitle = latestChapterTitle, |
|
|
|
|
coverUrl = coverUrl, |
|
|
|
|
intro = intro, |
|
|
|
|
tocUrl = tocUrl, |
|
|
|
|
originOrder = originOrder, |
|
|
|
|
variable = variable |
|
|
|
|
).apply { |
|
|
|
|
this.infoHtml = this@SearchBook.infoHtml |
|
|
|
|
this.tocUrl = this@SearchBook.tocUrl |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fun toBook() = Book( |
|
|
|
|
name = name, |
|
|
|
|
author = author, |
|
|
|
|
kind = kind, |
|
|
|
|
bookUrl = bookUrl, |
|
|
|
|
origin = origin, |
|
|
|
|
originName = originName, |
|
|
|
|
type = type, |
|
|
|
|
wordCount = wordCount, |
|
|
|
|
latestChapterTitle = latestChapterTitle, |
|
|
|
|
coverUrl = coverUrl, |
|
|
|
|
intro = intro, |
|
|
|
|
tocUrl = tocUrl, |
|
|
|
|
originOrder = originOrder, |
|
|
|
|
variable = variable |
|
|
|
|
).apply { |
|
|
|
|
this.infoHtml = this@SearchBook.infoHtml |
|
|
|
|
this.tocUrl = this@SearchBook.tocUrl |
|
|
|
|
} |
|
|
|
|
} |