Convert ListHeader to a data class
This commit is contained in:
committed by
Koitharu
parent
bfad632b8c
commit
bf1b8e8b75
@@ -4,7 +4,7 @@ import android.content.Context
|
||||
import androidx.annotation.StringRes
|
||||
import org.koitharu.kotatsu.core.ui.model.DateTimeAgo
|
||||
|
||||
class ListHeader private constructor(
|
||||
data class ListHeader private constructor(
|
||||
private val text: CharSequence?,
|
||||
@StringRes private val textRes: Int,
|
||||
private val dateTimeAgo: DateTimeAgo?,
|
||||
@@ -39,26 +39,4 @@ class ListHeader private constructor(
|
||||
override fun areItemsTheSame(other: ListModel): Boolean {
|
||||
return other is ListHeader && text == other.text && dateTimeAgo == other.dateTimeAgo && textRes == other.textRes
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as ListHeader
|
||||
|
||||
if (text != other.text) return false
|
||||
if (textRes != other.textRes) return false
|
||||
if (dateTimeAgo != other.dateTimeAgo) return false
|
||||
if (buttonTextRes != other.buttonTextRes) return false
|
||||
return payload == other.payload
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = text?.hashCode() ?: 0
|
||||
result = 31 * result + textRes
|
||||
result = 31 * result + (dateTimeAgo?.hashCode() ?: 0)
|
||||
result = 31 * result + buttonTextRes
|
||||
result = 31 * result + (payload?.hashCode() ?: 0)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user