mirror of
https://github.com/gedoor/legado.git
synced 2024-07-19 01:17:25 +08:00
Added room database and book entity
This commit is contained in:
parent
53424f69a0
commit
b40f9de603
@ -34,6 +34,12 @@ dependencies {
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
|
||||
kapt 'androidx.lifecycle:lifecycle-compiler:2.0.0'
|
||||
|
||||
implementation 'androidx.room:room-runtime:2.0.0'
|
||||
kapt 'androidx.room:room-compiler:2.0.0'
|
||||
|
||||
implementation 'androidx.paging:paging-runtime:2.1.0'
|
||||
|
||||
def anko_version = '0.10.8'
|
||||
|
33
app/src/main/java/io/legado/app/data/entities/Book.kt
Normal file
33
app/src/main/java/io/legado/app/data/entities/Book.kt
Normal file
@ -0,0 +1,33 @@
|
||||
package io.legado.app.data.entities
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.room.*
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
import java.util.*
|
||||
|
||||
@Parcelize
|
||||
@Entity(tableName = "books",
|
||||
indices = [(Index(value = ["url"]))])
|
||||
data class Book(@PrimaryKey
|
||||
var url: String = "",
|
||||
var name: String = "",
|
||||
var tag: String = "",
|
||||
var author: String? = null,
|
||||
var coverUrl: String? = null,
|
||||
var customCoverUrl: String? = null,
|
||||
var introduction: String? = null,
|
||||
var charset: String? = null,
|
||||
var type: Int = 0, // 0: text, 1: audio
|
||||
var latestChapterName: String? = null,
|
||||
var lastUpdateTime: Date? = null,
|
||||
var latestChapterTime: Date? = null,
|
||||
var durChapterIndex: Int = 0,
|
||||
var durChapterPage: Int = 0,
|
||||
var totalChapterNum: Int = 0,
|
||||
var hasNewChapter: Boolean = false,
|
||||
var allowUpdate: Boolean = true
|
||||
) : Parcelable {
|
||||
|
||||
fun getUnreadChapterNum() = Math.max(totalChapterNum - durChapterIndex - 1, 0)
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user