|
|
@ -124,6 +124,14 @@ data class Book( |
|
|
|
return readConfig!! |
|
|
|
return readConfig!! |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun setReverseToc(reverseToc: Boolean) { |
|
|
|
|
|
|
|
config().reverseToc = reverseToc |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun getReverseToc(): Boolean { |
|
|
|
|
|
|
|
return config().reverseToc |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun setUseReplaceRule(useReplaceRule: Boolean) { |
|
|
|
fun setUseReplaceRule(useReplaceRule: Boolean) { |
|
|
|
config().useReplaceRule = useReplaceRule |
|
|
|
config().useReplaceRule = useReplaceRule |
|
|
|
} |
|
|
|
} |
|
|
@ -156,14 +164,6 @@ data class Book( |
|
|
|
config().imageStyle = imageStyle |
|
|
|
config().imageStyle = imageStyle |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun getDelParagraph(): Int { |
|
|
|
|
|
|
|
return config().delParagraph |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun setDelParagraph(num: Int) { |
|
|
|
|
|
|
|
config().delParagraph = num |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun setDelTag(tag: Long) { |
|
|
|
fun setDelTag(tag: Long) { |
|
|
|
config().delTag = |
|
|
|
config().delTag = |
|
|
|
if ((config().delTag and tag) == tag) config().delTag and tag.inv() else config().delTag or tag |
|
|
|
if ((config().delTag and tag) == tag) config().delTag and tag.inv() else config().delTag or tag |
|
|
@ -208,17 +208,10 @@ data class Book( |
|
|
|
newBook.customTag = customTag |
|
|
|
newBook.customTag = customTag |
|
|
|
newBook.canUpdate = canUpdate |
|
|
|
newBook.canUpdate = canUpdate |
|
|
|
newBook.readConfig = readConfig |
|
|
|
newBook.readConfig = readConfig |
|
|
|
delete() |
|
|
|
delete(this) |
|
|
|
appDb.bookDao.insert(newBook) |
|
|
|
appDb.bookDao.insert(newBook) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun delete() { |
|
|
|
|
|
|
|
if (ReadBook.book?.bookUrl == bookUrl) { |
|
|
|
|
|
|
|
ReadBook.book = null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
appDb.bookDao.delete(this) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun upInfoFromOld(oldBook: Book?) { |
|
|
|
fun upInfoFromOld(oldBook: Book?) { |
|
|
|
oldBook?.let { |
|
|
|
oldBook?.let { |
|
|
|
group = oldBook.group |
|
|
|
group = oldBook.group |
|
|
@ -241,15 +234,23 @@ data class Book( |
|
|
|
const val imgStyleDefault = "DEFAULT" |
|
|
|
const val imgStyleDefault = "DEFAULT" |
|
|
|
const val imgStyleFull = "FULL" |
|
|
|
const val imgStyleFull = "FULL" |
|
|
|
const val imgStyleText = "TEXT" |
|
|
|
const val imgStyleText = "TEXT" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun delete(book: Book?) { |
|
|
|
|
|
|
|
book ?: return |
|
|
|
|
|
|
|
if (ReadBook.book?.bookUrl == book.bookUrl) { |
|
|
|
|
|
|
|
ReadBook.book = null |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
appDb.bookDao.delete(book) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Parcelize |
|
|
|
@Parcelize |
|
|
|
data class ReadConfig( |
|
|
|
data class ReadConfig( |
|
|
|
|
|
|
|
var reverseToc: Boolean = false, |
|
|
|
var pageAnim: Int = -1, |
|
|
|
var pageAnim: Int = -1, |
|
|
|
var reSegment: Boolean = false, |
|
|
|
var reSegment: Boolean = false, |
|
|
|
var imageStyle: String? = null, |
|
|
|
var imageStyle: String? = null, |
|
|
|
var useReplaceRule: Boolean = AppConfig.replaceEnableDefault,// 正文使用净化替换规则 |
|
|
|
var useReplaceRule: Boolean = AppConfig.replaceEnableDefault,// 正文使用净化替换规则 |
|
|
|
var delParagraph: Int = 0,//去除段首 |
|
|
|
|
|
|
|
var delTag: Long = 0L,//去除标签 |
|
|
|
var delTag: Long = 0L,//去除标签 |
|
|
|
) : Parcelable |
|
|
|
) : Parcelable |
|
|
|
|
|
|
|
|
|
|
|