pull/1434/head
gedoor 3 years ago
parent 829695e398
commit 7775ff9d56
  1. 3
      app/src/main/java/io/legado/app/data/entities/Book.kt
  2. 3
      app/src/main/java/io/legado/app/data/entities/BookChapter.kt
  3. 4
      app/src/main/java/io/legado/app/data/entities/BookGroup.kt
  4. 7
      app/src/main/java/io/legado/app/data/entities/BookSource.kt
  5. 7
      app/src/main/java/io/legado/app/data/entities/Bookmark.kt
  6. 8
      app/src/main/java/io/legado/app/data/entities/Cache.kt
  7. 8
      app/src/main/java/io/legado/app/data/entities/Cookie.kt
  8. 4
      app/src/main/java/io/legado/app/data/entities/HttpTTS.kt
  9. 8
      app/src/main/java/io/legado/app/data/entities/ReadRecord.kt
  10. 9
      app/src/main/java/io/legado/app/data/entities/ReadRecordShow.kt
  11. 7
      app/src/main/java/io/legado/app/data/entities/ReplaceRule.kt
  12. 3
      app/src/main/java/io/legado/app/data/entities/RssArticle.kt
  13. 8
      app/src/main/java/io/legado/app/data/entities/RssReadRecord.kt
  14. 4
      app/src/main/java/io/legado/app/data/entities/RssSource.kt
  15. 3
      app/src/main/java/io/legado/app/data/entities/RssStar.kt
  16. 8
      app/src/main/java/io/legado/app/data/entities/RuleSub.kt
  17. 3
      app/src/main/java/io/legado/app/data/entities/SearchBook.kt
  18. 8
      app/src/main/java/io/legado/app/data/entities/SearchKeyword.kt
  19. 8
      app/src/main/java/io/legado/app/data/entities/TxtTocRule.kt
  20. 2
      build.gradle

@ -56,6 +56,9 @@ data class Book(
var readConfig: ReadConfig? = null var readConfig: ReadConfig? = null
) : Parcelable, BaseBook { ) : Parcelable, BaseBook {
@Ignore
constructor() : this(bookUrl = "")
fun isLocalBook(): Boolean { fun isLocalBook(): Boolean {
return origin == BookType.local return origin == BookType.local
} }

@ -47,6 +47,9 @@ data class BookChapter(
var variable: String? = null //变量 var variable: String? = null //变量
) : Parcelable, RuleDataInterface { ) : Parcelable, RuleDataInterface {
@Ignore
constructor() : this(url = "", bookUrl = "")
@delegate:Transient @delegate:Transient
@delegate:Ignore @delegate:Ignore
@IgnoredOnParcel @IgnoredOnParcel

@ -3,6 +3,7 @@ package io.legado.app.data.entities
import android.content.Context import android.content.Context
import android.os.Parcelable import android.os.Parcelable
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import io.legado.app.R import io.legado.app.R
import io.legado.app.constant.AppConst import io.legado.app.constant.AppConst
@ -19,6 +20,9 @@ data class BookGroup(
var show: Boolean = true var show: Boolean = true
) : Parcelable { ) : Parcelable {
@Ignore
constructor() : this(groupName = "")
fun getManageName(context: Context): String { fun getManageName(context: Context): String {
return when (groupId) { return when (groupId) {
AppConst.bookGroupAllId -> "$groupName(${context.getString(R.string.all)})" AppConst.bookGroupAllId -> "$groupName(${context.getString(R.string.all)})"

@ -19,10 +19,10 @@ import timber.log.Timber
indices = [(Index(value = ["bookSourceUrl"], unique = false))] indices = [(Index(value = ["bookSourceUrl"], unique = false))]
) )
data class BookSource( data class BookSource(
var bookSourceName: String = "", // 名称
var bookSourceGroup: String? = null, // 分组
@PrimaryKey @PrimaryKey
var bookSourceUrl: String = "", // 地址,包括 http/https var bookSourceUrl: String = "", // 地址,包括 http/https
var bookSourceName: String = "", // 名称
var bookSourceGroup: String? = null, // 分组
var bookSourceType: Int = BookType.default, // 类型,0 文本,1 音频, 3 图片 var bookSourceType: Int = BookType.default, // 类型,0 文本,1 音频, 3 图片
var bookUrlPattern: String? = null, // 详情页url正则 var bookUrlPattern: String? = null, // 详情页url正则
var customOrder: Int = 0, // 手动排序编号 var customOrder: Int = 0, // 手动排序编号
@ -46,6 +46,9 @@ data class BookSource(
var ruleContent: ContentRule? = null // 正文页规则 var ruleContent: ContentRule? = null // 正文页规则
) : Parcelable, BaseSource { ) : Parcelable, BaseSource {
@Ignore
constructor() : this(bookSourceUrl = "")
override fun getTag(): String { override fun getTag(): String {
return bookSourceName return bookSourceName
} }

@ -2,6 +2,7 @@ package io.legado.app.data.entities
import android.os.Parcelable import android.os.Parcelable
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.Index import androidx.room.Index
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import kotlinx.parcelize.Parcelize import kotlinx.parcelize.Parcelize
@ -21,5 +22,9 @@ data class Bookmark(
var chapterName: String = "", var chapterName: String = "",
var bookText: String = "", var bookText: String = "",
var content: String = "" var content: String = ""
) : Parcelable {
) : Parcelable @Ignore
constructor() : this(bookName = "")
}

@ -1,6 +1,7 @@
package io.legado.app.data.entities package io.legado.app.data.entities
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.Index import androidx.room.Index
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
@ -10,4 +11,9 @@ data class Cache(
val key: String = "", val key: String = "",
var value: String? = null, var value: String? = null,
var deadline: Long = 0L var deadline: Long = 0L
) ) {
@Ignore
constructor() : this(key = "")
}

@ -1,6 +1,7 @@
package io.legado.app.data.entities package io.legado.app.data.entities
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.Index import androidx.room.Index
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
@ -9,4 +10,9 @@ data class Cookie(
@PrimaryKey @PrimaryKey
var url: String = "", var url: String = "",
var cookie: String = "" var cookie: String = ""
) ) {
@Ignore
constructor() : this(url = "")
}

@ -1,6 +1,7 @@
package io.legado.app.data.entities package io.legado.app.data.entities
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import com.jayway.jsonpath.DocumentContext import com.jayway.jsonpath.DocumentContext
import io.legado.app.utils.GSON import io.legado.app.utils.GSON
@ -25,6 +26,9 @@ data class HttpTTS(
var loginCheckJs: String? = null, var loginCheckJs: String? = null,
) : BaseSource { ) : BaseSource {
@Ignore
constructor() : this(name = "")
override fun getTag(): String { override fun getTag(): String {
return name return name
} }

@ -1,10 +1,16 @@
package io.legado.app.data.entities package io.legado.app.data.entities
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
@Entity(tableName = "readRecord", primaryKeys = ["deviceId", "bookName"]) @Entity(tableName = "readRecord", primaryKeys = ["deviceId", "bookName"])
data class ReadRecord( data class ReadRecord(
var deviceId: String = "", var deviceId: String = "",
var bookName: String = "", var bookName: String = "",
var readTime: Long = 0L var readTime: Long = 0L
) ) {
@Ignore
constructor() : this(deviceId = "")
}

@ -1,6 +1,13 @@
package io.legado.app.data.entities package io.legado.app.data.entities
import androidx.room.Ignore
data class ReadRecordShow( data class ReadRecordShow(
var bookName: String = "", var bookName: String = "",
var readTime: Long = 0L var readTime: Long = 0L
) ) {
@Ignore
constructor() : this("")
}

@ -2,10 +2,7 @@ package io.legado.app.data.entities
import android.os.Parcelable import android.os.Parcelable
import android.text.TextUtils import android.text.TextUtils
import androidx.room.ColumnInfo import androidx.room.*
import androidx.room.Entity
import androidx.room.Index
import androidx.room.PrimaryKey
import kotlinx.parcelize.Parcelize import kotlinx.parcelize.Parcelize
import java.util.regex.Pattern import java.util.regex.Pattern
import java.util.regex.PatternSyntaxException import java.util.regex.PatternSyntaxException
@ -29,6 +26,8 @@ data class ReplaceRule(
var order: Int = 0 var order: Int = 0
) : Parcelable { ) : Parcelable {
@Ignore
constructor() : this(id = System.currentTimeMillis())
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (other is ReplaceRule) { if (other is ReplaceRule) {

@ -26,6 +26,9 @@ data class RssArticle(
var variable: String? = null var variable: String? = null
) : RuleDataInterface { ) : RuleDataInterface {
@Ignore
constructor() : this("")
override fun hashCode() = link.hashCode() override fun hashCode() = link.hashCode()
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {

@ -1,7 +1,13 @@
package io.legado.app.data.entities package io.legado.app.data.entities
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
@Entity(tableName = "rssReadRecords") @Entity(tableName = "rssReadRecords")
data class RssReadRecord(@PrimaryKey val record: String, val read: Boolean = true) data class RssReadRecord(@PrimaryKey val record: String, val read: Boolean = true) {
@Ignore
constructor() : this("")
}

@ -2,6 +2,7 @@ package io.legado.app.data.entities
import android.os.Parcelable import android.os.Parcelable
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.Index import androidx.room.Index
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import com.jayway.jsonpath.DocumentContext import com.jayway.jsonpath.DocumentContext
@ -43,6 +44,9 @@ data class RssSource(
var customOrder: Int = 0 var customOrder: Int = 0
) : Parcelable, BaseSource { ) : Parcelable, BaseSource {
@Ignore
constructor() : this("")
override fun getTag(): String { override fun getTag(): String {
return sourceName return sourceName
} }

@ -25,6 +25,9 @@ data class RssStar(
var variable: String? = null var variable: String? = null
) : RuleDataInterface { ) : RuleDataInterface {
@Ignore
constructor() : this("")
@delegate:Transient @delegate:Transient
@delegate:Ignore @delegate:Ignore
@IgnoredOnParcel @IgnoredOnParcel

@ -1,6 +1,7 @@
package io.legado.app.data.entities package io.legado.app.data.entities
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
@Entity(tableName = "ruleSubs") @Entity(tableName = "ruleSubs")
@ -13,4 +14,9 @@ data class RuleSub(
var customOrder: Int = 0, var customOrder: Int = 0,
var autoUpdate: Boolean = false, var autoUpdate: Boolean = false,
var update: Long = System.currentTimeMillis() var update: Long = System.currentTimeMillis()
) ) {
@Ignore
constructor() : this(name = "")
}

@ -40,6 +40,9 @@ data class SearchBook(
var originOrder: Int = 0 var originOrder: Int = 0
) : Parcelable, BaseBook, Comparable<SearchBook> { ) : Parcelable, BaseBook, Comparable<SearchBook> {
@Ignore
constructor() : this(bookUrl = "")
@Ignore @Ignore
@IgnoredOnParcel @IgnoredOnParcel
override var infoHtml: String? = null override var infoHtml: String? = null

@ -2,6 +2,7 @@ package io.legado.app.data.entities
import android.os.Parcelable import android.os.Parcelable
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.Index import androidx.room.Index
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import kotlinx.parcelize.Parcelize import kotlinx.parcelize.Parcelize
@ -14,4 +15,9 @@ data class SearchKeyword(
var word: String = "", // 搜索关键词 var word: String = "", // 搜索关键词
var usage: Int = 1, // 使用次数 var usage: Int = 1, // 使用次数
var lastUseTime: Long = System.currentTimeMillis() // 最后一次使用时间 var lastUseTime: Long = System.currentTimeMillis() // 最后一次使用时间
) : Parcelable ) : Parcelable {
@Ignore
constructor() : this(word = "")
}

@ -1,6 +1,7 @@
package io.legado.app.data.entities package io.legado.app.data.entities
import androidx.room.Entity import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
@ -12,4 +13,9 @@ data class TxtTocRule(
var rule: String = "", var rule: String = "",
var serialNumber: Int = -1, var serialNumber: Int = -1,
var enable: Boolean = true var enable: Boolean = true
) ) {
@Ignore
constructor() : this(name = "")
}

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.5.31' ext.kotlin_version = '1.6.0'
repositories { repositories {
google() google()
mavenCentral() mavenCentral()

Loading…
Cancel
Save