Convert ListHeader to a data class

pull/442/head
Isira Seneviratne 3 years ago
parent 73e6f730e1
commit 5c5bc5e5d5

@ -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
}
}

Loading…
Cancel
Save