mirror of
https://github.com/gedoor/legado.git
synced 2025-01-07 03:06:58 +08:00
书籍目录页面,增加字段统计开关,默认开启 (#4470)
This commit is contained in:
parent
db3ee32496
commit
f1a99fd361
@ -107,6 +107,7 @@ object PreferKey {
|
||||
const val checkSource = "checkSource"
|
||||
const val uploadRule = "uploadRule"
|
||||
const val tocUiUseReplace = "tocUiUseReplace"
|
||||
const val tocCountWords = "tocCountWords"
|
||||
const val enableReadRecord = "enableReadRecord"
|
||||
const val localBookImportSort = "localBookImportSort"
|
||||
const val customWelcome = "customWelcome"
|
||||
|
@ -381,6 +381,12 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
appCtx.putPrefBoolean(PreferKey.tocUiUseReplace, value)
|
||||
}
|
||||
|
||||
var tocCountWords: Boolean
|
||||
get() = appCtx.getPrefBoolean(PreferKey.tocCountWords, true)
|
||||
set(value) {
|
||||
appCtx.putPrefBoolean(PreferKey.tocCountWords, value)
|
||||
}
|
||||
|
||||
var enableReadRecord: Boolean
|
||||
get() = appCtx.getPrefBoolean(PreferKey.enableReadRecord, true)
|
||||
set(value) {
|
||||
|
@ -150,7 +150,7 @@ class ChapterListAdapter(context: Context, val callback: Callback) :
|
||||
} else {
|
||||
tvTag.gone()
|
||||
}
|
||||
if (!item.wordCount.isNullOrEmpty() && !item.isVolume) {
|
||||
if (AppConfig.tocCountWords && !item.wordCount.isNullOrEmpty() && !item.isVolume) {
|
||||
//章节字数
|
||||
tvWordCount.text = item.wordCount
|
||||
tvWordCount.visible()
|
||||
|
@ -132,6 +132,8 @@ class TocActivity : VMBaseActivity<ActivityChapterListBinding, TocViewModel>(),
|
||||
}
|
||||
menu.findItem(R.id.menu_use_replace)?.isChecked =
|
||||
AppConfig.tocUiUseReplace
|
||||
menu.findItem(R.id.menu_load_word_count)?.isChecked =
|
||||
AppConfig.tocCountWords
|
||||
menu.findItem(R.id.menu_split_long_chapter)?.isChecked =
|
||||
viewModel.bookData.value?.getSplitLongChapter() == true
|
||||
return super.onMenuOpened(featureId, menu)
|
||||
@ -165,6 +167,10 @@ class TocActivity : VMBaseActivity<ActivityChapterListBinding, TocViewModel>(),
|
||||
viewModel.chapterListCallBack?.upChapterList(searchView?.query?.toString())
|
||||
}
|
||||
|
||||
R.id.menu_load_word_count -> {
|
||||
AppConfig.tocCountWords = !item.isChecked
|
||||
}
|
||||
|
||||
R.id.menu_export_bookmark -> exportDir.launch {
|
||||
requestCode = 1
|
||||
}
|
||||
|
@ -42,6 +42,12 @@
|
||||
android:title="@string/use_replace"
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_load_word_count"
|
||||
android:checkable="true"
|
||||
android:title="@string/load_word_count"
|
||||
app:showAsAction="never" />
|
||||
|
||||
</group>
|
||||
|
||||
<group
|
||||
|
Loading…
Reference in New Issue
Block a user