From bf1b8e8b751604a94c4899bd8a5476786f45835a Mon Sep 17 00:00:00 2001 From: Isira Seneviratne Date: Tue, 1 Aug 2023 06:58:27 +0530 Subject: [PATCH] Convert ListHeader to a data class --- .../kotatsu/list/ui/model/ListHeader.kt | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/model/ListHeader.kt b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/model/ListHeader.kt index c35baf93f..805eba6b1 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/model/ListHeader.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/list/ui/model/ListHeader.kt @@ -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 - } }