diff --git a/app/src/main/java/com/hippo/ehviewer/dao/DownloadInfo.kt b/app/src/main/java/com/hippo/ehviewer/dao/DownloadInfo.kt index bc3cfe267..a83546882 100644 --- a/app/src/main/java/com/hippo/ehviewer/dao/DownloadInfo.kt +++ b/app/src/main/java/com/hippo/ehviewer/dao/DownloadInfo.kt @@ -3,11 +3,18 @@ package com.hippo.ehviewer.dao import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.Ignore +import com.hippo.ehviewer.client.data.AbstractGalleryInfo import com.hippo.ehviewer.client.data.BaseGalleryInfo import com.hippo.ehviewer.client.data.GalleryInfo +@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") @Entity(tableName = "DOWNLOADS") -class DownloadInfo() : BaseGalleryInfo() { +class DownloadInfo( + @Ignore + val galleryInfo: GalleryInfo = BaseGalleryInfo(), +) : BaseGalleryInfo(), AbstractGalleryInfo by galleryInfo { + constructor() : this(galleryInfo = BaseGalleryInfo()) + @ColumnInfo(name = "STATE") var state = 0 @@ -38,20 +45,6 @@ class DownloadInfo() : BaseGalleryInfo() { @Ignore var total = 0 - constructor(galleryInfo: GalleryInfo) : this() { - gid = galleryInfo.gid - token = galleryInfo.token - title = galleryInfo.title - titleJpn = galleryInfo.titleJpn - thumbKey = galleryInfo.thumbKey - this.category = galleryInfo.category - posted = galleryInfo.posted - uploader = galleryInfo.uploader - rating = galleryInfo.rating - simpleTags = galleryInfo.simpleTags - simpleLanguage = galleryInfo.simpleLanguage - } - companion object { const val STATE_INVALID = -1 const val STATE_NONE = 0 diff --git a/app/src/main/java/com/hippo/ehviewer/dao/HistoryInfo.kt b/app/src/main/java/com/hippo/ehviewer/dao/HistoryInfo.kt index ad41d8ff4..77adaca25 100644 --- a/app/src/main/java/com/hippo/ehviewer/dao/HistoryInfo.kt +++ b/app/src/main/java/com/hippo/ehviewer/dao/HistoryInfo.kt @@ -2,30 +2,23 @@ package com.hippo.ehviewer.dao import androidx.room.ColumnInfo import androidx.room.Entity +import androidx.room.Ignore +import com.hippo.ehviewer.client.data.AbstractGalleryInfo import com.hippo.ehviewer.client.data.BaseGalleryInfo import com.hippo.ehviewer.client.data.GalleryInfo import com.hippo.ehviewer.client.data.GalleryInfo.Companion.NOT_FAVORITED +@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") @Entity(tableName = "HISTORY") -class HistoryInfo() : BaseGalleryInfo() { +class HistoryInfo( + @Ignore + val galleryInfo: GalleryInfo = BaseGalleryInfo(), +) : BaseGalleryInfo(), AbstractGalleryInfo by galleryInfo { + constructor() : this(galleryInfo = BaseGalleryInfo()) + @ColumnInfo(name = "TIME") var time: Long = 0 @ColumnInfo(name = "FAVORITE_SLOT") override var favoriteSlot: Int = NOT_FAVORITED - - constructor(galleryInfo: GalleryInfo) : this() { - gid = galleryInfo.gid - token = galleryInfo.token - title = galleryInfo.title - titleJpn = galleryInfo.titleJpn - thumbKey = galleryInfo.thumbKey - this.category = galleryInfo.category - posted = galleryInfo.posted - uploader = galleryInfo.uploader - rating = galleryInfo.rating - simpleTags = galleryInfo.simpleTags - simpleLanguage = galleryInfo.simpleLanguage - favoriteSlot = galleryInfo.favoriteSlot - } } diff --git a/app/src/main/java/com/hippo/ehviewer/dao/LocalFavoriteInfo.kt b/app/src/main/java/com/hippo/ehviewer/dao/LocalFavoriteInfo.kt index f8e9dd1ed..31a515e7d 100644 --- a/app/src/main/java/com/hippo/ehviewer/dao/LocalFavoriteInfo.kt +++ b/app/src/main/java/com/hippo/ehviewer/dao/LocalFavoriteInfo.kt @@ -2,30 +2,23 @@ package com.hippo.ehviewer.dao import androidx.room.ColumnInfo import androidx.room.Entity +import androidx.room.Ignore +import com.hippo.ehviewer.client.data.AbstractGalleryInfo import com.hippo.ehviewer.client.data.BaseGalleryInfo import com.hippo.ehviewer.client.data.GalleryInfo import com.hippo.ehviewer.client.data.GalleryInfo.Companion.LOCAL_FAVORITED +@Suppress("DELEGATED_MEMBER_HIDES_SUPERTYPE_OVERRIDE") @Entity(tableName = "LOCAL_FAVORITES") -class LocalFavoriteInfo() : BaseGalleryInfo() { +class LocalFavoriteInfo( + @Ignore + val galleryInfo: GalleryInfo = BaseGalleryInfo(), +) : BaseGalleryInfo(), AbstractGalleryInfo by galleryInfo { + constructor() : this(galleryInfo = BaseGalleryInfo()) + @ColumnInfo(name = "TIME") var time: Long = 0 - constructor(galleryInfo: GalleryInfo) : this() { - gid = galleryInfo.gid - token = galleryInfo.token - title = galleryInfo.title - titleJpn = galleryInfo.titleJpn - thumbKey = galleryInfo.thumbKey - this.category = galleryInfo.category - posted = galleryInfo.posted - uploader = galleryInfo.uploader - rating = galleryInfo.rating - simpleTags = galleryInfo.simpleTags - simpleLanguage = galleryInfo.simpleLanguage - } - - init { - favoriteSlot = LOCAL_FAVORITED - } + @Ignore + override var favoriteSlot = LOCAL_FAVORITED }