|
|
|
|
@ -1,13 +1,24 @@
|
|
|
|
|
package org.koitharu.kotatsu.details.ui.model
|
|
|
|
|
|
|
|
|
|
import java.text.DateFormat
|
|
|
|
|
import org.koitharu.kotatsu.parsers.model.MangaChapter
|
|
|
|
|
|
|
|
|
|
class ChapterListItem(
|
|
|
|
|
val chapter: MangaChapter,
|
|
|
|
|
val flags: Int,
|
|
|
|
|
val uploadDate: String?,
|
|
|
|
|
private val uploadDateMs: Long,
|
|
|
|
|
private val dateFormat: DateFormat,
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
var uploadDate: String? = null
|
|
|
|
|
private set
|
|
|
|
|
get() {
|
|
|
|
|
if (field != null) return field
|
|
|
|
|
if (uploadDateMs == 0L) return null
|
|
|
|
|
field = dateFormat.format(uploadDateMs)
|
|
|
|
|
return field
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val status: Int
|
|
|
|
|
get() = flags and MASK_STATUS
|
|
|
|
|
|
|
|
|
|
@ -32,7 +43,8 @@ class ChapterListItem(
|
|
|
|
|
|
|
|
|
|
if (chapter != other.chapter) return false
|
|
|
|
|
if (flags != other.flags) return false
|
|
|
|
|
if (uploadDate != other.uploadDate) return false
|
|
|
|
|
if (uploadDateMs != other.uploadDateMs) return false
|
|
|
|
|
if (dateFormat != other.dateFormat) return false
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
@ -40,7 +52,8 @@ class ChapterListItem(
|
|
|
|
|
override fun hashCode(): Int {
|
|
|
|
|
var result = chapter.hashCode()
|
|
|
|
|
result = 31 * result + flags
|
|
|
|
|
result = 31 * result + (uploadDate?.hashCode() ?: 0)
|
|
|
|
|
result = 31 * result + uploadDateMs.hashCode()
|
|
|
|
|
result = 31 * result + dateFormat.hashCode()
|
|
|
|
|
return result
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|