diff --git a/app/src/main/java/io/legado/app/data/entities/Book.kt b/app/src/main/java/io/legado/app/data/entities/Book.kt index 5b61a6cc7..79fc9dbe2 100644 --- a/app/src/main/java/io/legado/app/data/entities/Book.kt +++ b/app/src/main/java/io/legado/app/data/entities/Book.kt @@ -56,6 +56,9 @@ data class Book( var readConfig: ReadConfig? = null ) : Parcelable, BaseBook { + @Ignore + constructor() : this(bookUrl = "") + fun isLocalBook(): Boolean { return origin == BookType.local } diff --git a/app/src/main/java/io/legado/app/data/entities/BookChapter.kt b/app/src/main/java/io/legado/app/data/entities/BookChapter.kt index 39b8ea6b0..48f4fc3bf 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookChapter.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookChapter.kt @@ -47,6 +47,9 @@ data class BookChapter( var variable: String? = null //变量 ) : Parcelable, RuleDataInterface { + @Ignore + constructor() : this(url = "", bookUrl = "") + @delegate:Transient @delegate:Ignore @IgnoredOnParcel diff --git a/app/src/main/java/io/legado/app/data/entities/BookGroup.kt b/app/src/main/java/io/legado/app/data/entities/BookGroup.kt index f19f5f05c..78cc44cce 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookGroup.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookGroup.kt @@ -3,6 +3,7 @@ package io.legado.app.data.entities import android.content.Context import android.os.Parcelable import androidx.room.Entity +import androidx.room.Ignore import androidx.room.PrimaryKey import io.legado.app.R import io.legado.app.constant.AppConst @@ -19,6 +20,9 @@ data class BookGroup( var show: Boolean = true ) : Parcelable { + @Ignore + constructor() : this(groupName = "") + fun getManageName(context: Context): String { return when (groupId) { AppConst.bookGroupAllId -> "$groupName(${context.getString(R.string.all)})" diff --git a/app/src/main/java/io/legado/app/data/entities/BookSource.kt b/app/src/main/java/io/legado/app/data/entities/BookSource.kt index 01fdf3fe5..bcc222ba5 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookSource.kt @@ -19,10 +19,10 @@ import timber.log.Timber indices = [(Index(value = ["bookSourceUrl"], unique = false))] ) data class BookSource( - var bookSourceName: String = "", // 名称 - var bookSourceGroup: String? = null, // 分组 @PrimaryKey var bookSourceUrl: String = "", // 地址,包括 http/https + var bookSourceName: String = "", // 名称 + var bookSourceGroup: String? = null, // 分组 var bookSourceType: Int = BookType.default, // 类型,0 文本,1 音频, 3 图片 var bookUrlPattern: String? = null, // 详情页url正则 var customOrder: Int = 0, // 手动排序编号 @@ -46,6 +46,9 @@ data class BookSource( var ruleContent: ContentRule? = null // 正文页规则 ) : Parcelable, BaseSource { + @Ignore + constructor() : this(bookSourceUrl = "") + override fun getTag(): String { return bookSourceName } diff --git a/app/src/main/java/io/legado/app/data/entities/Bookmark.kt b/app/src/main/java/io/legado/app/data/entities/Bookmark.kt index 9ee4a8ea0..46db12e35 100644 --- a/app/src/main/java/io/legado/app/data/entities/Bookmark.kt +++ b/app/src/main/java/io/legado/app/data/entities/Bookmark.kt @@ -2,6 +2,7 @@ package io.legado.app.data.entities import android.os.Parcelable import androidx.room.Entity +import androidx.room.Ignore import androidx.room.Index import androidx.room.PrimaryKey import kotlinx.parcelize.Parcelize @@ -21,5 +22,9 @@ data class Bookmark( var chapterName: String = "", var bookText: String = "", var content: String = "" +) : Parcelable { -) : Parcelable \ No newline at end of file + @Ignore + constructor() : this(bookName = "") + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/Cache.kt b/app/src/main/java/io/legado/app/data/entities/Cache.kt index f9687dea7..39c0bd808 100644 --- a/app/src/main/java/io/legado/app/data/entities/Cache.kt +++ b/app/src/main/java/io/legado/app/data/entities/Cache.kt @@ -1,6 +1,7 @@ package io.legado.app.data.entities import androidx.room.Entity +import androidx.room.Ignore import androidx.room.Index import androidx.room.PrimaryKey @@ -10,4 +11,9 @@ data class Cache( val key: String = "", var value: String? = null, var deadline: Long = 0L -) \ No newline at end of file +) { + + @Ignore + constructor() : this(key = "") + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/Cookie.kt b/app/src/main/java/io/legado/app/data/entities/Cookie.kt index 8e12febf4..193fb643c 100644 --- a/app/src/main/java/io/legado/app/data/entities/Cookie.kt +++ b/app/src/main/java/io/legado/app/data/entities/Cookie.kt @@ -1,6 +1,7 @@ package io.legado.app.data.entities import androidx.room.Entity +import androidx.room.Ignore import androidx.room.Index import androidx.room.PrimaryKey @@ -9,4 +10,9 @@ data class Cookie( @PrimaryKey var url: String = "", var cookie: String = "" -) \ No newline at end of file +) { + + @Ignore + constructor() : this(url = "") + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt b/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt index 3b1db4512..cbc6a05da 100644 --- a/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt +++ b/app/src/main/java/io/legado/app/data/entities/HttpTTS.kt @@ -1,6 +1,7 @@ package io.legado.app.data.entities import androidx.room.Entity +import androidx.room.Ignore import androidx.room.PrimaryKey import com.jayway.jsonpath.DocumentContext import io.legado.app.utils.GSON @@ -25,6 +26,9 @@ data class HttpTTS( var loginCheckJs: String? = null, ) : BaseSource { + @Ignore + constructor() : this(name = "") + override fun getTag(): String { return name } diff --git a/app/src/main/java/io/legado/app/data/entities/ReadRecord.kt b/app/src/main/java/io/legado/app/data/entities/ReadRecord.kt index 2b2b5caf4..b12246c62 100644 --- a/app/src/main/java/io/legado/app/data/entities/ReadRecord.kt +++ b/app/src/main/java/io/legado/app/data/entities/ReadRecord.kt @@ -1,10 +1,16 @@ package io.legado.app.data.entities import androidx.room.Entity +import androidx.room.Ignore @Entity(tableName = "readRecord", primaryKeys = ["deviceId", "bookName"]) data class ReadRecord( var deviceId: String = "", var bookName: String = "", var readTime: Long = 0L -) \ No newline at end of file +) { + + @Ignore + constructor() : this(deviceId = "") + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/ReadRecordShow.kt b/app/src/main/java/io/legado/app/data/entities/ReadRecordShow.kt index 79795b0d9..0ede36a84 100644 --- a/app/src/main/java/io/legado/app/data/entities/ReadRecordShow.kt +++ b/app/src/main/java/io/legado/app/data/entities/ReadRecordShow.kt @@ -1,6 +1,13 @@ package io.legado.app.data.entities +import androidx.room.Ignore + data class ReadRecordShow( var bookName: String = "", var readTime: Long = 0L -) \ No newline at end of file +) { + + @Ignore + constructor() : this("") + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt b/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt index 29f0072fd..be085a9fc 100644 --- a/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt @@ -2,10 +2,7 @@ package io.legado.app.data.entities import android.os.Parcelable import android.text.TextUtils -import androidx.room.ColumnInfo -import androidx.room.Entity -import androidx.room.Index -import androidx.room.PrimaryKey +import androidx.room.* import kotlinx.parcelize.Parcelize import java.util.regex.Pattern import java.util.regex.PatternSyntaxException @@ -29,6 +26,8 @@ data class ReplaceRule( var order: Int = 0 ) : Parcelable { + @Ignore + constructor() : this(id = System.currentTimeMillis()) override fun equals(other: Any?): Boolean { if (other is ReplaceRule) { diff --git a/app/src/main/java/io/legado/app/data/entities/RssArticle.kt b/app/src/main/java/io/legado/app/data/entities/RssArticle.kt index 911fb16b8..8928ddc28 100644 --- a/app/src/main/java/io/legado/app/data/entities/RssArticle.kt +++ b/app/src/main/java/io/legado/app/data/entities/RssArticle.kt @@ -26,6 +26,9 @@ data class RssArticle( var variable: String? = null ) : RuleDataInterface { + @Ignore + constructor() : this("") + override fun hashCode() = link.hashCode() override fun equals(other: Any?): Boolean { diff --git a/app/src/main/java/io/legado/app/data/entities/RssReadRecord.kt b/app/src/main/java/io/legado/app/data/entities/RssReadRecord.kt index edbb4c15d..2a54427dd 100644 --- a/app/src/main/java/io/legado/app/data/entities/RssReadRecord.kt +++ b/app/src/main/java/io/legado/app/data/entities/RssReadRecord.kt @@ -1,7 +1,13 @@ package io.legado.app.data.entities import androidx.room.Entity +import androidx.room.Ignore import androidx.room.PrimaryKey @Entity(tableName = "rssReadRecords") -data class RssReadRecord(@PrimaryKey val record: String, val read: Boolean = true) \ No newline at end of file +data class RssReadRecord(@PrimaryKey val record: String, val read: Boolean = true) { + + @Ignore + constructor() : this("") + +} \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/data/entities/RssSource.kt b/app/src/main/java/io/legado/app/data/entities/RssSource.kt index 78830285a..7f9c97051 100644 --- a/app/src/main/java/io/legado/app/data/entities/RssSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/RssSource.kt @@ -2,6 +2,7 @@ package io.legado.app.data.entities import android.os.Parcelable import androidx.room.Entity +import androidx.room.Ignore import androidx.room.Index import androidx.room.PrimaryKey import com.jayway.jsonpath.DocumentContext @@ -43,6 +44,9 @@ data class RssSource( var customOrder: Int = 0 ) : Parcelable, BaseSource { + @Ignore + constructor() : this("") + override fun getTag(): String { return sourceName } diff --git a/app/src/main/java/io/legado/app/data/entities/RssStar.kt b/app/src/main/java/io/legado/app/data/entities/RssStar.kt index df4bd546f..fc696cf94 100644 --- a/app/src/main/java/io/legado/app/data/entities/RssStar.kt +++ b/app/src/main/java/io/legado/app/data/entities/RssStar.kt @@ -25,6 +25,9 @@ data class RssStar( var variable: String? = null ) : RuleDataInterface { + @Ignore + constructor() : this("") + @delegate:Transient @delegate:Ignore @IgnoredOnParcel diff --git a/app/src/main/java/io/legado/app/data/entities/RuleSub.kt b/app/src/main/java/io/legado/app/data/entities/RuleSub.kt index 2b43787fe..bc9c250d0 100644 --- a/app/src/main/java/io/legado/app/data/entities/RuleSub.kt +++ b/app/src/main/java/io/legado/app/data/entities/RuleSub.kt @@ -1,6 +1,7 @@ package io.legado.app.data.entities import androidx.room.Entity +import androidx.room.Ignore import androidx.room.PrimaryKey @Entity(tableName = "ruleSubs") @@ -13,4 +14,9 @@ data class RuleSub( var customOrder: Int = 0, var autoUpdate: Boolean = false, var update: Long = System.currentTimeMillis() -) +) { + + @Ignore + constructor() : this(name = "") + +} diff --git a/app/src/main/java/io/legado/app/data/entities/SearchBook.kt b/app/src/main/java/io/legado/app/data/entities/SearchBook.kt index 96c525b3a..6169aa6d0 100644 --- a/app/src/main/java/io/legado/app/data/entities/SearchBook.kt +++ b/app/src/main/java/io/legado/app/data/entities/SearchBook.kt @@ -40,6 +40,9 @@ data class SearchBook( var originOrder: Int = 0 ) : Parcelable, BaseBook, Comparable { + @Ignore + constructor() : this(bookUrl = "") + @Ignore @IgnoredOnParcel override var infoHtml: String? = null diff --git a/app/src/main/java/io/legado/app/data/entities/SearchKeyword.kt b/app/src/main/java/io/legado/app/data/entities/SearchKeyword.kt index 955e5fe3d..ade4a5551 100644 --- a/app/src/main/java/io/legado/app/data/entities/SearchKeyword.kt +++ b/app/src/main/java/io/legado/app/data/entities/SearchKeyword.kt @@ -2,6 +2,7 @@ package io.legado.app.data.entities import android.os.Parcelable import androidx.room.Entity +import androidx.room.Ignore import androidx.room.Index import androidx.room.PrimaryKey import kotlinx.parcelize.Parcelize @@ -14,4 +15,9 @@ data class SearchKeyword( var word: String = "", // 搜索关键词 var usage: Int = 1, // 使用次数 var lastUseTime: Long = System.currentTimeMillis() // 最后一次使用时间 -) : Parcelable +) : Parcelable { + + @Ignore + constructor() : this(word = "") + +} diff --git a/app/src/main/java/io/legado/app/data/entities/TxtTocRule.kt b/app/src/main/java/io/legado/app/data/entities/TxtTocRule.kt index 52669dab7..54429bbf3 100644 --- a/app/src/main/java/io/legado/app/data/entities/TxtTocRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/TxtTocRule.kt @@ -1,6 +1,7 @@ package io.legado.app.data.entities import androidx.room.Entity +import androidx.room.Ignore import androidx.room.PrimaryKey @@ -12,4 +13,9 @@ data class TxtTocRule( var rule: String = "", var serialNumber: Int = -1, var enable: Boolean = true -) \ No newline at end of file +) { + + @Ignore + constructor() : this(name = "") + +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 45afa777f..1f3ac687d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.5.31' + ext.kotlin_version = '1.6.0' repositories { google() mavenCentral()