diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/cache/ContentCache.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/cache/ContentCache.kt index 0992360a8..0e42ddde2 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/cache/ContentCache.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/cache/ContentCache.kt @@ -20,25 +20,8 @@ interface ContentCache { fun putRelatedManga(source: MangaSource, url: String, related: SafeDeferred>) - class Key( + data class Key( val source: MangaSource, val url: String, - ) { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as Key - - if (source != other.source) return false - return url == other.url - } - - override fun hashCode(): Int { - var result = source.hashCode() - result = 31 * result + url.hashCode() - return result - } - } + ) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/entity/MangaWithTags.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/entity/MangaWithTags.kt index 61c5e34ca..5a28a10d3 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/db/entity/MangaWithTags.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/db/entity/MangaWithTags.kt @@ -4,7 +4,7 @@ import androidx.room.Embedded import androidx.room.Junction import androidx.room.Relation -class MangaWithTags( +data class MangaWithTags( @Embedded val manga: MangaEntity, @Relation( parentColumn = "manga_id", @@ -12,21 +12,4 @@ class MangaWithTags( associateBy = Junction(MangaTagsEntity::class) ) val tags: List, -) { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as MangaWithTags - - if (manga != other.manga) return false - return tags == other.tags - } - - override fun hashCode(): Int { - var result = manga.hashCode() - result = 31 * result + tags.hashCode() - return result - } -} +) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/github/VersionId.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/github/VersionId.kt index ec3a0eb71..56c931b24 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/github/VersionId.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/github/VersionId.kt @@ -2,7 +2,7 @@ package org.koitharu.kotatsu.core.github import java.util.* -class VersionId( +data class VersionId( val major: Int, val minor: Int, val build: Int, @@ -30,28 +30,6 @@ class VersionId( return variantNumber.compareTo(other.variantNumber) } - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as VersionId - - if (major != other.major) return false - if (minor != other.minor) return false - if (build != other.build) return false - if (variantType != other.variantType) return false - return variantNumber == other.variantNumber - } - - override fun hashCode(): Int { - var result = major - result = 31 * result + minor - result = 31 * result + build - result = 31 * result + variantType.hashCode() - result = 31 * result + variantNumber - return result - } - private fun variantWeight(variantType: String) = when (variantType.lowercase(Locale.ROOT)) { "a", "alpha" -> 1 "b", "beta" -> 2 diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/network/cookies/CookieWrapper.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/network/cookies/CookieWrapper.kt index 320e8ef91..8aa8ad1c1 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/network/cookies/CookieWrapper.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/network/cookies/CookieWrapper.kt @@ -8,7 +8,7 @@ import java.io.ObjectInputStream import java.io.ObjectOutputStream -class CookieWrapper( +data class CookieWrapper( val cookie: Cookie, ) { @@ -66,17 +66,4 @@ class CookieWrapper( fun key(): String { return (if (cookie.secure) "https" else "http") + "://" + cookie.domain + cookie.path + "|" + cookie.name } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as CookieWrapper - - return cookie == other.cookie - } - - override fun hashCode(): Int { - return cookie.hashCode() - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/image/TrimTransformation.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/image/TrimTransformation.kt index ad9e13009..ee37d0c9d 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/image/TrimTransformation.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/image/TrimTransformation.kt @@ -11,7 +11,7 @@ import coil.size.Size import coil.transform.Transformation import kotlin.math.abs -class TrimTransformation( +data class TrimTransformation( private val tolerance: Int = 20, ) : Transformation { @@ -104,17 +104,4 @@ class TrimTransformation( abs(a.blue - b.blue) <= tolerance && abs(a.alpha - b.alpha) <= tolerance } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as TrimTransformation - - return tolerance == other.tolerance - } - - override fun hashCode(): Int { - return tolerance - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/model/DateTimeAgo.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/model/DateTimeAgo.kt index cfb69a705..5dfe1045b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/model/DateTimeAgo.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/model/DateTimeAgo.kt @@ -20,41 +20,6 @@ sealed class DateTimeAgo { override fun equals(other: Any?): Boolean = other === JustNow } - class MinutesAgo(val minutes: Int) : DateTimeAgo() { - - override fun format(resources: Resources): String { - return resources.getQuantityString(R.plurals.minutes_ago, minutes, minutes) - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - other as MinutesAgo - return minutes == other.minutes - } - - override fun hashCode(): Int = minutes - - override fun toString() = "minutes_ago_$minutes" - } - - class HoursAgo(val hours: Int) : DateTimeAgo() { - override fun format(resources: Resources): String { - return resources.getQuantityString(R.plurals.hours_ago, hours, hours) - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - other as HoursAgo - return hours == other.hours - } - - override fun hashCode(): Int = hours - - override fun toString() = "hours_ago_$hours" - } - object Today : DateTimeAgo() { override fun format(resources: Resources): String { return resources.getString(R.string.today) @@ -75,25 +40,16 @@ sealed class DateTimeAgo { override fun equals(other: Any?): Boolean = other === Yesterday } - class DaysAgo(val days: Int) : DateTimeAgo() { + data class DaysAgo(val days: Int) : DateTimeAgo() { override fun format(resources: Resources): String { return resources.getQuantityString(R.plurals.days_ago, days, days) } - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - other as DaysAgo - return days == other.days - } - - override fun hashCode(): Int = days - override fun toString() = "days_ago_$days" } - class MonthsAgo(val months: Int) : DateTimeAgo() { + data class MonthsAgo(val months: Int) : DateTimeAgo() { override fun format(resources: Resources): String { return if (months == 0) { @@ -102,19 +58,6 @@ sealed class DateTimeAgo { resources.getQuantityString(R.plurals.months_ago, months, months) } } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as MonthsAgo - - return months == other.months - } - - override fun hashCode(): Int { - return months - } } class Absolute(private val date: Date) : DateTimeAgo() { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/ChipsView.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/ChipsView.kt index c2c526e91..c2689a1ed 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/ChipsView.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/ChipsView.kt @@ -139,39 +139,14 @@ class ChipsView @JvmOverloads constructor( } } - class ChipModel( + data class ChipModel( @ColorRes val tint: Int, val title: CharSequence, @DrawableRes val icon: Int, val isCheckable: Boolean, val isChecked: Boolean, val data: Any? = null, - ) { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as ChipModel - - if (tint != other.tint) return false - if (title != other.title) return false - if (icon != other.icon) return false - if (isCheckable != other.isCheckable) return false - if (isChecked != other.isChecked) return false - return data == other.data - } - - override fun hashCode(): Int { - var result = tint.hashCode() - result = 31 * result + title.hashCode() - result = 31 * result + icon.hashCode() - result = 31 * result + isCheckable.hashCode() - result = 31 * result + isChecked.hashCode() - result = 31 * result + (data?.hashCode() ?: 0) - return result - } - } + ) fun interface OnChipClickListener { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/SegmentedBarView.kt b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/SegmentedBarView.kt index 6550dadf5..78ca6ad48 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/SegmentedBarView.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/core/ui/widgets/SegmentedBarView.kt @@ -118,27 +118,10 @@ class SegmentedBarView @JvmOverloads constructor( segmentsSizes.add(w) } - class Segment( + data class Segment( @FloatRange(from = 0.0, to = 1.0) val percent: Float, @ColorInt val color: Int, - ) { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as Segment - - if (percent != other.percent) return false - return color == other.color - } - - override fun hashCode(): Int { - var result = percent.hashCode() - result = 31 * result + color - return result - } - } + ) private class OutlineProvider : ViewOutlineProvider() { override fun getOutline(view: View, outline: Outline) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/ChapterListItem.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/ChapterListItem.kt index cece102e9..609f6ad09 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/ChapterListItem.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/ChapterListItem.kt @@ -4,7 +4,7 @@ import android.text.format.DateUtils import org.koitharu.kotatsu.list.ui.model.ListModel import org.koitharu.kotatsu.parsers.model.MangaChapter -class ChapterListItem( +data class ChapterListItem( val chapter: MangaChapter, val flags: Int, private val uploadDateMs: Long, @@ -66,24 +66,6 @@ class ChapterListItem( } } - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as ChapterListItem - - if (chapter != other.chapter) return false - if (flags != other.flags) return false - return uploadDateMs == other.uploadDateMs - } - - override fun hashCode(): Int { - var result = chapter.hashCode() - result = 31 * result + flags - result = 31 * result + uploadDateMs.hashCode() - return result - } - companion object { const val FLAG_UNREAD = 2 diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/HistoryInfo.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/HistoryInfo.kt index 72e2f7837..66fa2d922 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/HistoryInfo.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/HistoryInfo.kt @@ -3,35 +3,14 @@ package org.koitharu.kotatsu.details.ui.model import org.koitharu.kotatsu.core.model.MangaHistory import org.koitharu.kotatsu.parsers.model.Manga -class HistoryInfo( +data class HistoryInfo( val totalChapters: Int, val currentChapter: Int, val history: MangaHistory?, val isIncognitoMode: Boolean, ) { - val isValid: Boolean get() = totalChapters >= 0 - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as HistoryInfo - - if (totalChapters != other.totalChapters) return false - if (currentChapter != other.currentChapter) return false - if (history != other.history) return false - return isIncognitoMode == other.isIncognitoMode - } - - override fun hashCode(): Int { - var result = totalChapters - result = 31 * result + currentChapter - result = 31 * result + (history?.hashCode() ?: 0) - result = 31 * result + isIncognitoMode.hashCode() - return result - } } fun HistoryInfo( diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/MangaBranch.kt b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/MangaBranch.kt index dfe1f7d66..841621277 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/MangaBranch.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/details/ui/model/MangaBranch.kt @@ -3,7 +3,7 @@ package org.koitharu.kotatsu.details.ui.model import org.koitharu.kotatsu.list.ui.ListModelDiffCallback import org.koitharu.kotatsu.list.ui.model.ListModel -class MangaBranch( +data class MangaBranch( val name: String?, val count: Int, val isSelected: Boolean, @@ -21,24 +21,6 @@ class MangaBranch( } } - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as MangaBranch - - if (name != other.name) return false - if (count != other.count) return false - return isSelected == other.isSelected - } - - override fun hashCode(): Int { - var result = name.hashCode() - result = 31 * result + count - result = 31 * result + isSelected.hashCode() - return result - } - override fun toString(): String { return "$name: $count" } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadItemModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadItemModel.kt index 2a4e5a613..42305f769 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadItemModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/download/ui/list/DownloadItemModel.kt @@ -7,7 +7,7 @@ import org.koitharu.kotatsu.parsers.model.Manga import java.util.Date import java.util.UUID -class DownloadItemModel( +data class DownloadItemModel( val id: UUID, val workState: WorkInfo.State, val isIndeterminate: Boolean, @@ -64,38 +64,4 @@ class DownloadItemModel( else -> super.getChangePayload(previousState) } } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as DownloadItemModel - - if (id != other.id) return false - if (workState != other.workState) return false - if (isIndeterminate != other.isIndeterminate) return false - if (isPaused != other.isPaused) return false - if (manga != other.manga) return false - if (error != other.error) return false - if (max != other.max) return false - if (totalChapters != other.totalChapters) return false - if (progress != other.progress) return false - if (eta != other.eta) return false - return timestamp == other.timestamp - } - - override fun hashCode(): Int { - var result = id.hashCode() - result = 31 * result + workState.hashCode() - result = 31 * result + isIndeterminate.hashCode() - result = 31 * result + isPaused.hashCode() - result = 31 * result + manga.hashCode() - result = 31 * result + (error?.hashCode() ?: 0) - result = 31 * result + max - result = 31 * result + totalChapters - result = 31 * result + progress - result = 31 * result + eta.hashCode() - result = 31 * result + timestamp.hashCode() - return result - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/ExploreButtons.kt b/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/ExploreButtons.kt index 0e4aa9c83..2eb8a003f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/ExploreButtons.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/ExploreButtons.kt @@ -2,24 +2,11 @@ package org.koitharu.kotatsu.explore.ui.model import org.koitharu.kotatsu.list.ui.model.ListModel -class ExploreButtons( +data class ExploreButtons( val isRandomLoading: Boolean, ) : ListModel { override fun areItemsTheSame(other: ListModel): Boolean { return other is ExploreButtons } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as ExploreButtons - - return isRandomLoading == other.isRandomLoading - } - - override fun hashCode(): Int { - return isRandomLoading.hashCode() - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/MangaSourceItem.kt b/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/MangaSourceItem.kt index fa0c0e9e5..2425945e5 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/MangaSourceItem.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/MangaSourceItem.kt @@ -3,7 +3,7 @@ package org.koitharu.kotatsu.explore.ui.model import org.koitharu.kotatsu.list.ui.model.ListModel import org.koitharu.kotatsu.parsers.model.MangaSource -class MangaSourceItem( +data class MangaSourceItem( val source: MangaSource, val isGrid: Boolean, ) : ListModel { @@ -11,20 +11,4 @@ class MangaSourceItem( override fun areItemsTheSame(other: ListModel): Boolean { return other is MangaSourceItem && other.source == source } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as MangaSourceItem - - if (source != other.source) return false - return isGrid == other.isGrid - } - - override fun hashCode(): Int { - var result = source.hashCode() - result = 31 * result + isGrid.hashCode() - return result - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/RecommendationsItem.kt b/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/RecommendationsItem.kt index 9876def1f..5d1a99ba0 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/RecommendationsItem.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/explore/ui/model/RecommendationsItem.kt @@ -6,7 +6,6 @@ import org.koitharu.kotatsu.parsers.model.Manga data class RecommendationsItem( val manga: Manga ) : ListModel { - val summary: String = manga.tags.joinToString { it.title } override fun areItemsTheSame(other: ListModel): Boolean { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/domain/model/Cover.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/domain/model/Cover.kt index 1b44af3bb..e76c18724 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/domain/model/Cover.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/domain/model/Cover.kt @@ -3,31 +3,10 @@ package org.koitharu.kotatsu.favourites.domain.model import org.koitharu.kotatsu.parsers.model.MangaSource import org.koitharu.kotatsu.parsers.util.find -class Cover( +data class Cover( val url: String, val source: String, ) { - val mangaSource: MangaSource? get() = if (source.isEmpty()) null else MangaSource.entries.find(source) - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as Cover - - if (url != other.url) return false - return source == other.source - } - - override fun hashCode(): Int { - var result = url.hashCode() - result = 31 * result + source.hashCode() - return result - } - - override fun toString(): String { - return "Cover(url='$url', source=$source)" - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/container/FavouriteTabModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/container/FavouriteTabModel.kt index 1a9b16276..684c1fa72 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/container/FavouriteTabModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/favourites/ui/container/FavouriteTabModel.kt @@ -2,7 +2,7 @@ package org.koitharu.kotatsu.favourites.ui.container import org.koitharu.kotatsu.list.ui.model.ListModel -class FavouriteTabModel( +data class FavouriteTabModel( val id: Long, val title: String, ) : ListModel { @@ -10,20 +10,4 @@ class FavouriteTabModel( override fun areItemsTheSame(other: ListModel): Boolean { return other is FavouriteTabModel && other.id == id } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as FavouriteTabModel - - if (id != other.id) return false - return title == other.title - } - - override fun hashCode(): Int { - var result = id.hashCode() - result = 31 * result + title.hashCode() - return result - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/FilterCoordinator.kt b/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/FilterCoordinator.kt index 30516882b..dba254833 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/FilterCoordinator.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/FilterCoordinator.kt @@ -263,30 +263,11 @@ class FilterCoordinator @Inject constructor( return result } - private class TagsWrapper( + private data class TagsWrapper( val tags: Set, val isLoading: Boolean, val isError: Boolean, - ) { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as TagsWrapper - - if (tags != other.tags) return false - if (isLoading != other.isLoading) return false - return isError == other.isError - } - - override fun hashCode(): Int { - var result = tags.hashCode() - result = 31 * result + isLoading.hashCode() - result = 31 * result + isError.hashCode() - return result - } - } + ) private class TagTitleComparator(lc: String?) : Comparator { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterItem.kt b/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterItem.kt index e096ebc51..063d3521c 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterItem.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterItem.kt @@ -8,7 +8,7 @@ import org.koitharu.kotatsu.parsers.model.SortOrder sealed interface FilterItem : ListModel { - class Sort( + data class Sort( val order: SortOrder, val isSelected: Boolean, ) : FilterItem { @@ -24,25 +24,9 @@ sealed interface FilterItem : ListModel { super.getChangePayload(previousState) } } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as Sort - - if (order != other.order) return false - return isSelected == other.isSelected - } - - override fun hashCode(): Int { - var result = order.hashCode() - result = 31 * result + isSelected.hashCode() - return result - } } - class Tag( + data class Tag( val tag: MangaTag, val isChecked: Boolean, ) : FilterItem { @@ -58,43 +42,14 @@ sealed interface FilterItem : ListModel { super.getChangePayload(previousState) } } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as Tag - - if (tag != other.tag) return false - return isChecked == other.isChecked - } - - override fun hashCode(): Int { - var result = tag.hashCode() - result = 31 * result + isChecked.hashCode() - return result - } } - class Error( + data class Error( @StringRes val textResId: Int, ) : FilterItem { override fun areItemsTheSame(other: ListModel): Boolean { return other is Error && textResId == other.textResId } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as Error - - return textResId == other.textResId - } - - override fun hashCode(): Int { - return textResId - } } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterState.kt b/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterState.kt index b4ab41c7a..efb1d4168 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterState.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/filter/ui/model/FilterState.kt @@ -3,24 +3,7 @@ package org.koitharu.kotatsu.filter.ui.model import org.koitharu.kotatsu.parsers.model.MangaTag import org.koitharu.kotatsu.parsers.model.SortOrder -class FilterState( +data class FilterState( val sortOrder: SortOrder?, val tags: Set, -) { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as FilterState - - if (sortOrder != other.sortOrder) return false - return tags == other.tags - } - - override fun hashCode(): Int { - var result = sortOrder?.hashCode() ?: 0 - result = 31 * result + tags.hashCode() - return result - } -} +) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/image/ui/ImageActivity.kt b/app/src/main/kotlin/org/koitharu/kotatsu/image/ui/ImageActivity.kt index 56a11f004..73203e59d 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/image/ui/ImageActivity.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/image/ui/ImageActivity.kt @@ -98,7 +98,7 @@ class ImageActivity : BaseActivity(), ImageRequest.Listene .enqueueWith(coil) } - private class SsivTarget( + private data class SsivTarget( override val view: SubsamplingScaleImageView, ) : ViewTarget { @@ -106,14 +106,6 @@ class ImageActivity : BaseActivity(), ImageRequest.Listene override fun onSuccess(result: Drawable) = setDrawable(result) - override fun equals(other: Any?): Boolean { - return (this === other) || (other is SsivTarget && view == other.view) - } - - override fun hashCode() = view.hashCode() - - override fun toString() = "SsivTarget(view=$view)" - private fun setDrawable(drawable: Drawable?) { if (drawable != null) { view.setImage(ImageSource.Bitmap(drawable.toBitmap())) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/input/LocalMangaDirInput.kt b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/input/LocalMangaDirInput.kt index bdfe8adf7..f500558b9 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/input/LocalMangaDirInput.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/input/LocalMangaDirInput.kt @@ -77,7 +77,7 @@ class LocalMangaDirInput(root: File) : LocalMangaInput(root) { largeCoverUrl = null, description = null, ) - LocalManga(root, manga) + LocalManga(manga, root) } override suspend fun getMangaInfo(): Manga? = runInterruptible(Dispatchers.IO) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/input/LocalMangaZipInput.kt b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/input/LocalMangaZipInput.kt index f468c4647..6526c5bb5 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/local/data/input/LocalMangaZipInput.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/local/data/input/LocalMangaZipInput.kt @@ -94,7 +94,7 @@ class LocalMangaZipInput(root: File) : LocalMangaInput(root) { ) } } - return LocalManga(root, manga) + return LocalManga(manga, root) } override suspend fun getMangaInfo(): Manga? = runInterruptible(Dispatchers.IO) { diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/local/domain/model/LocalManga.kt b/app/src/main/kotlin/org/koitharu/kotatsu/local/domain/model/LocalManga.kt index 247d395d4..26b15966b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/local/domain/model/LocalManga.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/local/domain/model/LocalManga.kt @@ -6,13 +6,11 @@ import org.koitharu.kotatsu.parsers.model.Manga import org.koitharu.kotatsu.parsers.model.MangaTag import java.io.File -class LocalManga( - val file: File, +data class LocalManga( val manga: Manga, + val file: File = manga.url.toUri().toFile(), ) { - constructor(manga: Manga) : this(manga.url.toUri().toFile(), manga) - var createdAt: Long = -1L private set get() { @@ -31,22 +29,6 @@ class LocalManga( return manga.tags.containsAll(tags) } - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as LocalManga - - if (manga != other.manga) return false - return file == other.file - } - - override fun hashCode(): Int { - var result = manga.hashCode() - result = 31 * result + file.hashCode() - return result - } - override fun toString(): String { return "LocalManga(${file.path}: ${manga.title})" } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/ReaderColorFilter.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/ReaderColorFilter.kt index 8852ff2da..9b4f8a828 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/ReaderColorFilter.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/domain/ReaderColorFilter.kt @@ -3,7 +3,7 @@ package org.koitharu.kotatsu.reader.domain import android.graphics.ColorMatrix import android.graphics.ColorMatrixColorFilter -class ReaderColorFilter( +data class ReaderColorFilter( val brightness: Float, val contrast: Float, val isInverted: Boolean, @@ -51,22 +51,4 @@ class ReaderColorFilter( ) set(matrix) } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as ReaderColorFilter - - if (brightness != other.brightness) return false - if (contrast != other.contrast) return false - return isInverted == other.isInverted - } - - override fun hashCode(): Int { - var result = brightness.hashCode() - result = 31 * result + contrast.hashCode() - result = 31 * result + isInverted.hashCode() - return result - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PageThumbnail.kt b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PageThumbnail.kt index 304f59234..294b8bb2e 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PageThumbnail.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/reader/ui/thumbnails/PageThumbnail.kt @@ -4,7 +4,7 @@ import org.koitharu.kotatsu.core.parser.MangaRepository import org.koitharu.kotatsu.list.ui.model.ListModel import org.koitharu.kotatsu.reader.ui.pager.ReaderPage -class PageThumbnail( +data class PageThumbnail( val isCurrent: Boolean, val repository: MangaRepository, val page: ReaderPage, @@ -16,23 +16,4 @@ class PageThumbnail( override fun areItemsTheSame(other: ListModel): Boolean { return other is PageThumbnail && page == other.page } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as PageThumbnail - - if (isCurrent != other.isCurrent) return false - if (repository != other.repository) return false - return page == other.page - } - - override fun hashCode(): Int { - var result = isCurrent.hashCode() - result = 31 * result + repository.hashCode() - result = 31 * result + page.hashCode() - return result - } - } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblerManga.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblerManga.kt index 94151906d..f4d3be9bc 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblerManga.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblerManga.kt @@ -2,40 +2,17 @@ package org.koitharu.kotatsu.scrobbling.common.domain.model import org.koitharu.kotatsu.list.ui.model.ListModel -class ScrobblerManga( +data class ScrobblerManga( val id: Long, val name: String, val altName: String?, val cover: String, 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 - - other as ScrobblerManga - - if (id != other.id) return false - if (name != other.name) return false - if (altName != other.altName) return false - if (cover != other.cover) return false - return url == other.url - } - - override fun hashCode(): Int { - var result = id.hashCode() - result = 31 * result + name.hashCode() - result = 31 * result + altName.hashCode() - result = 31 * result + cover.hashCode() - result = 31 * result + url.hashCode() - return result - } - override fun toString(): String { return "ScrobblerManga #$id \"$name\" $url" } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblerUser.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblerUser.kt index 89037e4a2..d79d0a3c7 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblerUser.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblerUser.kt @@ -1,29 +1,8 @@ package org.koitharu.kotatsu.scrobbling.common.domain.model -class ScrobblerUser( +data class ScrobblerUser( val id: Long, val nickname: String, val avatar: String, val service: ScrobblerService, -) { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as ScrobblerUser - - if (id != other.id) return false - if (nickname != other.nickname) return false - if (avatar != other.avatar) return false - return service == other.service - } - - override fun hashCode(): Int { - var result = id.hashCode() - result = 31 * result + nickname.hashCode() - result = 31 * result + avatar.hashCode() - result = 31 * result + service.hashCode() - return result - } -} +) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblingInfo.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblingInfo.kt index 828a2c607..ff106007f 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblingInfo.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/domain/model/ScrobblingInfo.kt @@ -2,7 +2,7 @@ package org.koitharu.kotatsu.scrobbling.common.domain.model import org.koitharu.kotatsu.list.ui.model.ListModel -class ScrobblingInfo( +data class ScrobblingInfo( val scrobbler: ScrobblerService, val mangaId: Long, val targetId: Long, @@ -19,38 +19,4 @@ class ScrobblingInfo( 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 - - other as ScrobblingInfo - - if (scrobbler != other.scrobbler) return false - if (mangaId != other.mangaId) return false - if (targetId != other.targetId) return false - if (status != other.status) return false - if (chapter != other.chapter) return false - if (comment != other.comment) return false - if (rating != other.rating) return false - if (title != other.title) return false - if (coverUrl != other.coverUrl) return false - if (description != other.description) return false - return externalUrl == other.externalUrl - } - - override fun hashCode(): Int { - var result = scrobbler.hashCode() - result = 31 * result + mangaId.hashCode() - result = 31 * result + targetId.hashCode() - result = 31 * result + (status?.hashCode() ?: 0) - result = 31 * result + chapter - result = 31 * result + (comment?.hashCode() ?: 0) - result = 31 * result + rating.hashCode() - result = 31 * result + title.hashCode() - result = 31 * result + coverUrl.hashCode() - result = 31 * result + (description?.hashCode() ?: 0) - result = 31 * result + externalUrl.hashCode() - return result - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/model/ScrobblerHint.kt b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/model/ScrobblerHint.kt index ec2342521..9b2b42eac 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/model/ScrobblerHint.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/scrobbling/common/ui/selector/model/ScrobblerHint.kt @@ -4,7 +4,7 @@ import androidx.annotation.DrawableRes import androidx.annotation.StringRes import org.koitharu.kotatsu.list.ui.model.ListModel -class ScrobblerHint( +data class ScrobblerHint( @DrawableRes val icon: Int, @StringRes val textPrimary: Int, @StringRes val textSecondary: Int, @@ -15,26 +15,4 @@ class ScrobblerHint( 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 - - other as ScrobblerHint - - if (icon != other.icon) return false - if (textPrimary != other.textPrimary) return false - if (textSecondary != other.textSecondary) return false - if (error != other.error) return false - return actionStringRes == other.actionStringRes - } - - override fun hashCode(): Int { - var result = icon - result = 31 * result + textPrimary - result = 31 * result + textSecondary - result = 31 * result + (error?.hashCode() ?: 0) - result = 31 * result + actionStringRes - return result - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/MultiSearchListModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/MultiSearchListModel.kt index 83d6c9dc2..7d6f802fc 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/MultiSearchListModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/search/ui/multi/MultiSearchListModel.kt @@ -5,7 +5,7 @@ import org.koitharu.kotatsu.list.ui.model.ListModel import org.koitharu.kotatsu.list.ui.model.MangaItemModel import org.koitharu.kotatsu.parsers.model.MangaSource -class MultiSearchListModel( +data class MultiSearchListModel( val source: MangaSource, val hasMore: Boolean, val list: List, @@ -23,24 +23,4 @@ class MultiSearchListModel( super.getChangePayload(previousState) } } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as MultiSearchListModel - - if (source != other.source) return false - if (hasMore != other.hasMore) return false - if (list != other.list) return false - return error == other.error - } - - override fun hashCode(): Int { - var result = source.hashCode() - result = 31 * result + hasMore.hashCode() - result = 31 * result + list.hashCode() - result = 31 * result + (error?.hashCode() ?: 0) - return result - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/DirectoryModel.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/DirectoryModel.kt index 401ae7452..7c274458d 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/DirectoryModel.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/storage/DirectoryModel.kt @@ -5,14 +5,13 @@ import org.koitharu.kotatsu.list.ui.ListModelDiffCallback import org.koitharu.kotatsu.list.ui.model.ListModel import java.io.File -class DirectoryModel( +data class DirectoryModel( val title: String?, @StringRes val titleRes: Int, val file: File?, val isChecked: Boolean, val isAvailable: Boolean, ) : ListModel { - override fun areItemsTheSame(other: ListModel): Boolean { return other is DirectoryModel && other.file == file && other.title == title && other.titleRes == titleRes } @@ -24,26 +23,4 @@ class DirectoryModel( super.getChangePayload(previousState) } } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as DirectoryModel - - if (title != other.title) return false - if (titleRes != other.titleRes) return false - if (file != other.file) return false - if (isChecked != other.isChecked) return false - return isAvailable == other.isAvailable - } - - override fun hashCode(): Int { - var result = title?.hashCode() ?: 0 - result = 31 * result + titleRes - result = 31 * result + (file?.hashCode() ?: 0) - result = 31 * result + isChecked.hashCode() - result = 31 * result + isAvailable.hashCode() - return result - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/settings/userdata/StorageUsage.kt b/app/src/main/kotlin/org/koitharu/kotatsu/settings/userdata/StorageUsage.kt index 5d3f2c80a..6ed2e4748 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/settings/userdata/StorageUsage.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/settings/userdata/StorageUsage.kt @@ -1,51 +1,13 @@ package org.koitharu.kotatsu.settings.userdata -class StorageUsage( +data class StorageUsage( val savedManga: Item, val pagesCache: Item, val otherCache: Item, val available: Item, ) { - - class Item( + data class Item( val bytes: Long, val percent: Float, - ) { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as Item - - if (bytes != other.bytes) return false - return percent == other.percent - } - - override fun hashCode(): Int { - var result = bytes.hashCode() - result = 31 * result + percent.hashCode() - return result - } - } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as StorageUsage - - if (savedManga != other.savedManga) return false - if (pagesCache != other.pagesCache) return false - if (otherCache != other.otherCache) return false - return available == other.available - } - - override fun hashCode(): Int { - var result = savedManga.hashCode() - result = 31 * result + pagesCache.hashCode() - result = 31 * result + otherCache.hashCode() - result = 31 * result + available.hashCode() - return result - } + ) } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/sync/domain/SyncAuthResult.kt b/app/src/main/kotlin/org/koitharu/kotatsu/sync/domain/SyncAuthResult.kt index b1581e1d0..e8d29ec70 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/sync/domain/SyncAuthResult.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/sync/domain/SyncAuthResult.kt @@ -1,29 +1,8 @@ package org.koitharu.kotatsu.sync.domain -class SyncAuthResult( +data class SyncAuthResult( val host: String, val email: String, val password: String, val token: String, -) { - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as SyncAuthResult - - if (host != other.host) return false - if (email != other.email) return false - if (password != other.password) return false - return token == other.token - } - - override fun hashCode(): Int { - var result = host.hashCode() - result = 31 * result + email.hashCode() - result = 31 * result + password.hashCode() - result = 31 * result + token.hashCode() - return result - } -} +) diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/domain/model/MangaTracking.kt b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/domain/model/MangaTracking.kt index be931ad98..67f0eb02c 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/domain/model/MangaTracking.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/domain/model/MangaTracking.kt @@ -3,31 +3,12 @@ package org.koitharu.kotatsu.tracker.domain.model import java.util.* import org.koitharu.kotatsu.parsers.model.Manga -class MangaTracking( +data class MangaTracking( val manga: Manga, val lastChapterId: Long, val lastCheck: Date?, ) { - fun isEmpty(): Boolean { return lastChapterId == 0L } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as MangaTracking - - if (manga != other.manga) return false - if (lastChapterId != other.lastChapterId) return false - return lastCheck == other.lastCheck - } - - override fun hashCode(): Int { - var result = manga.hashCode() - result = 31 * result + lastChapterId.hashCode() - result = 31 * result + (lastCheck?.hashCode() ?: 0) - return result - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/feed/model/FeedItem.kt b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/feed/model/FeedItem.kt index dd7d20d6b..7cc085d4b 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/feed/model/FeedItem.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/ui/feed/model/FeedItem.kt @@ -3,7 +3,7 @@ package org.koitharu.kotatsu.tracker.ui.feed.model import org.koitharu.kotatsu.list.ui.model.ListModel import org.koitharu.kotatsu.parsers.model.Manga -class FeedItem( +data class FeedItem( val id: Long, val imageUrl: String, val title: String, @@ -11,32 +11,7 @@ class FeedItem( val count: Int, val isNew: Boolean, ) : ListModel { - override fun areItemsTheSame(other: ListModel): Boolean { return other is FeedItem && other.id == id } - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as FeedItem - - if (id != other.id) return false - if (imageUrl != other.imageUrl) return false - if (title != other.title) return false - if (manga != other.manga) return false - if (count != other.count) return false - return isNew == other.isNew - } - - override fun hashCode(): Int { - var result = id.hashCode() - result = 31 * result + imageUrl.hashCode() - result = 31 * result + title.hashCode() - result = 31 * result + manga.hashCode() - result = 31 * result + count - result = 31 * result + isNew.hashCode() - return result - } } diff --git a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/work/TrackingItem.kt b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/work/TrackingItem.kt index 837835583..38ad9d4ec 100644 --- a/app/src/main/kotlin/org/koitharu/kotatsu/tracker/work/TrackingItem.kt +++ b/app/src/main/kotlin/org/koitharu/kotatsu/tracker/work/TrackingItem.kt @@ -2,28 +2,7 @@ package org.koitharu.kotatsu.tracker.work import org.koitharu.kotatsu.tracker.domain.model.MangaTracking -class TrackingItem( +data class TrackingItem( val tracking: MangaTracking, val channelId: String?, -) { - - operator fun component1() = tracking - - operator fun component2() = channelId - - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (javaClass != other?.javaClass) return false - - other as TrackingItem - - if (tracking != other.tracking) return false - return channelId == other.channelId - } - - override fun hashCode(): Int { - var result = tracking.hashCode() - result = 31 * result + channelId.hashCode() - return result - } -} +)