feat(ui):书源编辑添加自动保存cookie的选项(功能未实现)

pull/1876/head
Xwite 3 years ago
parent 684fb199db
commit 46e14a83ba
  1. 5
      app/src/main/java/io/legado/app/data/AppDatabase.kt
  2. 3
      app/src/main/java/io/legado/app/data/entities/BookSource.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  4. 7
      app/src/main/res/layout/activity_book_source_edit.xml
  5. 1
      app/src/main/res/values-es-rES/strings.xml
  6. 1
      app/src/main/res/values-ja-rJP/strings.xml
  7. 1
      app/src/main/res/values-pt-rBR/strings.xml
  8. 1
      app/src/main/res/values-zh-rHK/strings.xml
  9. 1
      app/src/main/res/values-zh-rTW/strings.xml
  10. 1
      app/src/main/res/values-zh/strings.xml
  11. 1
      app/src/main/res/values/strings.xml

@ -20,7 +20,7 @@ val appDb by lazy {
} }
@Database( @Database(
version = 48, version = 49,
exportSchema = true, exportSchema = true,
entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class, entities = [Book::class, BookGroup::class, BookSource::class, BookChapter::class,
ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class, ReplaceRule::class, SearchBook::class, SearchKeyword::class, Cookie::class,
@ -32,7 +32,8 @@ val appDb by lazy {
AutoMigration(from = 44, to = 45), AutoMigration(from = 44, to = 45),
AutoMigration(from = 45, to = 46), AutoMigration(from = 45, to = 46),
AutoMigration(from = 46, to = 47), AutoMigration(from = 46, to = 47),
AutoMigration(from = 47, to = 48) AutoMigration(from = 47, to = 48),
AutoMigration(from = 48, to = 49)
] ]
) )
abstract class AppDatabase : RoomDatabase() { abstract class AppDatabase : RoomDatabase() {

@ -38,6 +38,9 @@ data class BookSource(
var enabled: Boolean = true, var enabled: Boolean = true,
// 启用发现 // 启用发现
var enabledExplore: Boolean = true, var enabledExplore: Boolean = true,
// 启用okhttp CookieJAr 自动保存每次请求的cookie
@ColumnInfo(defaultValue = "0")
var enabledCookieJar: Boolean = false,
// 并发率 // 并发率
override var concurrentRate: String? = null, override var concurrentRate: String? = null,
// 请求头 // 请求头

@ -190,6 +190,7 @@ class BookSourceEditActivity :
source?.let { source?.let {
binding.cbIsEnable.isChecked = it.enabled binding.cbIsEnable.isChecked = it.enabled
binding.cbIsEnableFind.isChecked = it.enabledExplore binding.cbIsEnableFind.isChecked = it.enabledExplore
binding.cbIsEnableCookie.isChecked = it.enabledCookieJar
binding.spType.setSelection( binding.spType.setSelection(
when (it.bookSourceType) { when (it.bookSourceType) {
BookType.file -> 3 BookType.file -> 3
@ -296,6 +297,7 @@ class BookSourceEditActivity :
val source = viewModel.bookSource?.copy() ?: BookSource() val source = viewModel.bookSource?.copy() ?: BookSource()
source.enabled = binding.cbIsEnable.isChecked source.enabled = binding.cbIsEnable.isChecked
source.enabledExplore = binding.cbIsEnableFind.isChecked source.enabledExplore = binding.cbIsEnableFind.isChecked
source.enabledCookieJar = binding.cbIsEnableCookie.isChecked
source.bookSourceType = when (binding.spType.selectedItemPosition) { source.bookSourceType = when (binding.spType.selectedItemPosition) {
3 -> BookType.file 3 -> BookType.file
2 -> BookType.image 2 -> BookType.image

@ -33,6 +33,13 @@
android:checked="true" android:checked="true"
android:text="@string/discovery" /> android:text="@string/discovery" />
<io.legado.app.lib.theme.view.ThemeCheckBox
android:id="@+id/cb_is_enable_cookie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/auto_save_cookie" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

@ -978,5 +978,6 @@
<string name="import_tts">导入TTS</string> <string name="import_tts">导入TTS</string>
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">自动保存cookie</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -981,5 +981,6 @@
<string name="import_tts">导入TTS</string> <string name="import_tts">导入TTS</string>
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">自动保存cookie</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -981,5 +981,6 @@
<string name="import_tts">导入TTS</string> <string name="import_tts">导入TTS</string>
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">自动保存cookie</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -978,5 +978,6 @@
<string name="import_tts">导入TTS</string> <string name="import_tts">导入TTS</string>
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">自动保存cookie</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -980,5 +980,6 @@
<string name="import_tts">导入TTS</string> <string name="import_tts">导入TTS</string>
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">自动保存cookie</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -980,5 +980,6 @@
<string name="import_tts">导入TTS</string> <string name="import_tts">导入TTS</string>
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">自动保存cookie</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

@ -981,5 +981,6 @@
<string name="import_tts">导入TTS</string> <string name="import_tts">导入TTS</string>
<string name="import_theme">导入主题</string> <string name="import_theme">导入主题</string>
<string name="import_txt_toc_rule">导入txt目录规则</string> <string name="import_txt_toc_rule">导入txt目录规则</string>
<string name="auto_save_cookie">自动保存cookie</string>
<!-- string end --> <!-- string end -->
</resources> </resources>

Loading…
Cancel
Save