This commit is contained in:
Horis 2023-10-14 17:27:21 +08:00
parent fb9189ac0c
commit da0ca1b93f
14 changed files with 39 additions and 7 deletions

View File

@ -137,6 +137,7 @@ object PreferKey {
const val openBookInfoByClickTitle = "openBookInfoByClickTitle"
const val defaultHomePage = "defaultHomePage"
const val showBookshelfFastScroller = "showBookshelfFastScroller"
const val importKeepEnable = "importKeepEnable"
const val cPrimary = "colorPrimary"
const val cAccent = "colorAccent"

View File

@ -420,6 +420,11 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
val importKeepName get() = appCtx.getPrefBoolean(PreferKey.importKeepName)
val importKeepGroup get() = appCtx.getPrefBoolean(PreferKey.importKeepGroup)
var importKeepEnable: Boolean
get() = appCtx.getPrefBoolean(PreferKey.importKeepEnable, false)
set(value) {
appCtx.putPrefBoolean(PreferKey.importKeepEnable, value)
}
var preDownloadNum
get() = appCtx.getPrefInt(PreferKey.preDownloadNum, 10)

View File

@ -142,6 +142,8 @@ class ImportBookSourceDialog() : BaseDialogFragment(R.layout.dialog_recycler_vie
?.isChecked = AppConfig.importKeepName
binding.toolBar.menu.findItem(R.id.menu_keep_group)
?.isChecked = AppConfig.importKeepGroup
binding.toolBar.menu.findItem(R.id.menu_keep_enable)
?.isChecked = AppConfig.importKeepEnable
}
@SuppressLint("InflateParams", "NotifyDataSetChanged")
@ -179,6 +181,11 @@ class ImportBookSourceDialog() : BaseDialogFragment(R.layout.dialog_recycler_vie
item.isChecked = !item.isChecked
putPrefBoolean(PreferKey.importKeepGroup, item.isChecked)
}
R.id.menu_keep_enable -> {
item.isChecked = !item.isChecked
AppConfig.importKeepEnable = item.isChecked
}
}
return false
}

View File

@ -87,6 +87,7 @@ class ImportBookSourceViewModel(app: Application) : BaseViewModel(app) {
val group = groupName?.trim()
val keepName = AppConfig.importKeepName
val keepGroup = AppConfig.importKeepGroup
val keepEnable = AppConfig.importKeepEnable
val selectSource = arrayListOf<BookSource>()
selectStatus.forEachIndexed { index, b ->
if (b) {
@ -98,6 +99,10 @@ class ImportBookSourceViewModel(app: Application) : BaseViewModel(app) {
if (keepGroup) {
source.bookSourceGroup = it.bookSourceGroup
}
if (keepEnable) {
source.enabled = it.enabled
source.enabledExplore = it.enabledExplore
}
source.customOrder = it.customOrder
}
if (!group.isNullOrEmpty()) {

View File

@ -410,8 +410,8 @@ class BookSourceEditActivity :
"intro" -> searchRule.intro =
viewModel.ruleComplete(it.value, searchRule.bookList)
"updateTime" -> searchRule.updateTime =
viewModel.ruleComplete(it.value, searchRule.bookList)
// "updateTime" -> searchRule.updateTime =
// viewModel.ruleComplete(it.value, searchRule.bookList)
"wordCount" -> searchRule.wordCount =
viewModel.ruleComplete(it.value, searchRule.bookList)
@ -442,8 +442,8 @@ class BookSourceEditActivity :
"intro" -> exploreRule.intro =
viewModel.ruleComplete(it.value, exploreRule.bookList)
"updateTime" -> exploreRule.updateTime =
viewModel.ruleComplete(it.value, exploreRule.bookList)
// "updateTime" -> exploreRule.updateTime =
// viewModel.ruleComplete(it.value, exploreRule.bookList)
"wordCount" -> exploreRule.wordCount =
viewModel.ruleComplete(it.value, exploreRule.bookList)
@ -471,8 +471,8 @@ class BookSourceEditActivity :
"intro" -> bookInfoRule.intro =
viewModel.ruleComplete(it.value, bookInfoRule.init)
"updateTime" -> bookInfoRule.updateTime =
viewModel.ruleComplete(it.value, bookInfoRule.init)
// "updateTime" -> bookInfoRule.updateTime =
// viewModel.ruleComplete(it.value, bookInfoRule.init)
"wordCount" -> bookInfoRule.wordCount =
viewModel.ruleComplete(it.value, bookInfoRule.init)

View File

@ -31,4 +31,10 @@
android:checkable="true"
app:showAsAction="never" />
</menu>
<item
android:id="@+id/menu_keep_enable"
android:title="@string/keep_enable"
android:checkable="true"
app:showAsAction="never" />
</menu>

View File

@ -1131,4 +1131,5 @@
<string name="default_home_page">默认主页</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
<string name="export_all_use_book_source">导出所有书的书源</string>
<string name="keep_enable">保留启用状态</string>
</resources>

View File

@ -1134,4 +1134,5 @@
<string name="default_home_page">默认主页</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
<string name="export_all_use_book_source">导出所有书的书源</string>
<string name="keep_enable">保留启用状态</string>
</resources>

View File

@ -1134,4 +1134,5 @@
<string name="default_home_page">默认主页</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
<string name="export_all_use_book_source">导出所有书的书源</string>
<string name="keep_enable">保留启用状态</string>
</resources>

View File

@ -1129,4 +1129,5 @@ Còn </string>
<string name="export_wait">等待导出</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
<string name="export_all_use_book_source">导出所有书的书源</string>
<string name="keep_enable">保留启用状态</string>
</resources>

View File

@ -1130,4 +1130,5 @@
<string name="export_wait">等待导出</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
<string name="export_all_use_book_source">导出所有书的书源</string>
<string name="keep_enable">保留启用状态</string>
</resources>

View File

@ -1132,4 +1132,5 @@
<string name="export_wait">等待导出</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
<string name="export_all_use_book_source">导出所有书的书源</string>
<string name="keep_enable">保留启用状态</string>
</resources>

View File

@ -1132,4 +1132,5 @@
<string name="export_wait">等待导出</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
<string name="export_all_use_book_source">导出所有书的书源</string>
<string name="keep_enable">保留启用状态</string>
</resources>

View File

@ -1134,4 +1134,5 @@
<string name="default_home_page">默认主页</string>
<string name="show_bookshelf_fast_scroller">显示快速滚动条</string>
<string name="export_all_use_book_source">导出所有书的书源</string>
<string name="keep_enable">保留启用状态</string>
</resources>