Refactor ListModel
This commit is contained in:
@@ -10,6 +10,10 @@ class ScrobblerManga(
|
||||
val url: String,
|
||||
) : ListModel {
|
||||
|
||||
override fun areItemsTheSame(other: ListModel): Boolean {
|
||||
return other is ScrobblerManga && other.id == id
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
@@ -16,6 +16,10 @@ class ScrobblingInfo(
|
||||
val externalUrl: String,
|
||||
) : ListModel {
|
||||
|
||||
override fun areItemsTheSame(other: ListModel): Boolean {
|
||||
return other is ScrobblingInfo && other.scrobbler == scrobbler
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
@@ -4,10 +4,9 @@ import org.koitharu.kotatsu.list.ui.model.ListModel
|
||||
|
||||
enum class ScrobblingStatus : ListModel {
|
||||
|
||||
PLANNED,
|
||||
READING,
|
||||
RE_READING,
|
||||
COMPLETED,
|
||||
ON_HOLD,
|
||||
DROPPED,
|
||||
PLANNED, READING, RE_READING, COMPLETED, ON_HOLD, DROPPED;
|
||||
|
||||
override fun areItemsTheSame(other: ListModel): Boolean {
|
||||
return other is ScrobblingStatus && other.ordinal == ordinal
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@ class ScrobblerHint(
|
||||
@StringRes val actionStringRes: Int,
|
||||
) : ListModel {
|
||||
|
||||
override fun areItemsTheSame(other: ListModel): Boolean {
|
||||
return other is ScrobblerHint && other.textPrimary == textPrimary
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
@@ -22,9 +26,7 @@ class ScrobblerHint(
|
||||
if (textPrimary != other.textPrimary) return false
|
||||
if (textSecondary != other.textSecondary) return false
|
||||
if (error != other.error) return false
|
||||
if (actionStringRes != other.actionStringRes) return false
|
||||
|
||||
return true
|
||||
return actionStringRes == other.actionStringRes
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
|
||||
Reference in New Issue
Block a user