菜单标题
This commit is contained in:
@@ -217,4 +217,6 @@ object PreferKey {
|
||||
|
||||
const val disableMangaScrollAnimation = "disableMangaScrollAnimation"
|
||||
const val disableMangaCrossFade = "disableMangaCrossFade"
|
||||
|
||||
const val titleBarMode = "titleBarMode"
|
||||
}
|
||||
|
||||
@@ -734,6 +734,12 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
appCtx.putPrefBoolean(PreferKey.disableMangaCrossFade, value)
|
||||
}
|
||||
|
||||
var titleBarMode
|
||||
get() = appCtx.getPrefString(PreferKey.titleBarMode, "1")
|
||||
set(value) {
|
||||
appCtx.putPrefString(PreferKey.titleBarMode, value)
|
||||
}
|
||||
|
||||
//漫画预加载数量
|
||||
var mangaPreDownloadNum
|
||||
get() = appCtx.getPrefInt(PreferKey.mangaPreDownloadNum, 10)
|
||||
|
||||
@@ -259,6 +259,7 @@ class ReadMenu @JvmOverloads constructor(
|
||||
fun reset() {
|
||||
upColorConfig()
|
||||
initView()
|
||||
upBookView()
|
||||
}
|
||||
|
||||
fun refreshMenuColorFilter() {
|
||||
@@ -725,14 +726,33 @@ class ReadMenu @JvmOverloads constructor(
|
||||
fun upBookView() {
|
||||
val bookName = ReadBook.book?.name ?: ""
|
||||
|
||||
val isTablet = (resources.configuration.screenLayout and Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE
|
||||
val mode = AppConfig.titleBarMode?.toInt()
|
||||
|
||||
if (isTablet || resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
binding.titleBar.title = bookName
|
||||
binding.tvBookName.gone()
|
||||
} else {
|
||||
binding.titleBar.title = " "
|
||||
binding.tvBookName.text = bookName
|
||||
when (mode) {
|
||||
0 -> { // 在应用栏上显示
|
||||
binding.titleBar.title = bookName
|
||||
binding.llBook.visible()
|
||||
binding.tvBookName.gone()
|
||||
}
|
||||
1 -> { // 在独立行上显示
|
||||
binding.titleBar.title = " "
|
||||
binding.tvBookName.text = bookName
|
||||
binding.llBook.visible()
|
||||
binding.tvBookName.visible()
|
||||
}
|
||||
2 -> { // 仅显示标题
|
||||
binding.titleBar.title = bookName
|
||||
binding.llBook.gone()
|
||||
}
|
||||
3 -> { // 不显示
|
||||
binding.titleBar.title = " "
|
||||
binding.llBook.gone()
|
||||
}
|
||||
else -> {
|
||||
binding.titleBar.title = " "
|
||||
binding.tvBookName.text = bookName
|
||||
binding.llBook.visible()
|
||||
}
|
||||
}
|
||||
|
||||
ReadBook.curTextChapter?.let {
|
||||
@@ -743,14 +763,16 @@ class ReadMenu @JvmOverloads constructor(
|
||||
} else {
|
||||
binding.tvChapterUrl.gone()
|
||||
}
|
||||
|
||||
upSeekBar()
|
||||
binding.tvPre.isEnabled = ReadBook.durChapterIndex != 0
|
||||
binding.tvNext.isEnabled = ReadBook.durChapterIndex != ReadBook.simulatedChapterSize - 1
|
||||
} ?: let {
|
||||
} ?: run {
|
||||
binding.tvChapterUrl.gone()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun upSeekBar() {
|
||||
//孩子们 土方法丑陋但有效
|
||||
binding.seekReadPage.apply {
|
||||
|
||||
@@ -89,7 +89,7 @@ class MoreConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_more_conf
|
||||
}
|
||||
|
||||
PreferKey.keepLight -> postEvent(key, true)
|
||||
PreferKey.readSliderMode -> postEvent(EventBus.UPDATE_READ_ACTION_BAR, true)
|
||||
PreferKey.readSliderMode, PreferKey.titleBarMode -> postEvent(EventBus.UPDATE_READ_ACTION_BAR, true)
|
||||
PreferKey.textSelectAble -> postEvent(key, getPrefBoolean(key))
|
||||
PreferKey.screenOrientation -> {
|
||||
(activity as? ReadBookActivity)?.setOrientation()
|
||||
|
||||
Reference in New Issue
Block a user