feat:添加文件类型书源(知轩藏书类)

This commit is contained in:
Xwite
2022-05-12 16:24:35 +08:00
parent 837bda546f
commit 7437344a76
10 changed files with 12 additions and 3 deletions
@@ -5,7 +5,8 @@ import androidx.annotation.IntDef
object BookType {
const val default = 0 // 0 文本
const val audio = 1 // 1 音频
const val image = 2 //图片
const val image = 2 // 2 图片
const val file = 3 // 3 只提供下载服务的网站
const val local = "loc_book"
@Target(AnnotationTarget.VALUE_PARAMETER)
@@ -27,7 +27,7 @@ data class BookSource(
var bookSourceName: String = "",
// 分组
var bookSourceGroup: String? = null,
// 类型,0 文本,1 音频, 2 图片
// 类型,0 文本,1 音频, 2 图片, 3 文件(指的是类似知轩藏书只提供下载的网站)
@BookType.Type
var bookSourceType: Int = 0,
// 详情页url正则
@@ -192,6 +192,7 @@ class BookSourceEditActivity :
binding.cbIsEnableFind.isChecked = it.enabledExplore
binding.spType.setSelection(
when (it.bookSourceType) {
BookType.file -> 3
BookType.image -> 2
BookType.audio -> 1
else -> 0
@@ -296,6 +297,7 @@ class BookSourceEditActivity :
source.enabled = binding.cbIsEnable.isChecked
source.enabledExplore = binding.cbIsEnableFind.isChecked
source.bookSourceType = when (binding.spType.selectedItemPosition) {
3 -> BookType.file
2 -> BookType.image
1 -> BookType.audio
else -> BookType.default