翻页动画跟随背景

pull/406/head
gedoor 4 years ago
parent d60bfcfcfc
commit d4d35f680e
  1. 29
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt
  2. 2
      app/src/main/java/io/legado/app/help/storage/Restore.kt
  3. 16
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  4. 1
      app/src/main/res/values-zh-rHK/strings.xml
  5. 1
      app/src/main/res/values-zh-rTW/strings.xml
  6. 1
      app/src/main/res/values-zh/strings.xml
  7. 1
      app/src/main/res/values/strings.xml

@ -158,12 +158,6 @@ object ReadBookConfig {
App.INSTANCE.putPrefBoolean(PreferKey.shareLayout, value)
}
}
var pageAnim: Int
get() = if (AppConfig.isEInkMode) -1 else App.INSTANCE.getPrefInt(PreferKey.pageAnim)
set(value) {
App.INSTANCE.putPrefInt(PreferKey.pageAnim, value)
isScroll = pageAnim == 3
}
var isScroll = pageAnim == 3
val clickTurnPage get() = App.INSTANCE.getPrefBoolean(PreferKey.clickTurnPage, true)
val textFullJustify get() = App.INSTANCE.getPrefBoolean(PreferKey.textFullJustify, true)
@ -182,6 +176,13 @@ object ReadBookConfig {
val config get() = if (shareLayout) shareConfig else durConfig
var pageAnim: Int
get() = config.pageAnim()
set(value) {
config.setPageAnim(value)
isScroll = pageAnim == 3
}
var textFont: String
get() = config.textFont
set(value) {
@ -379,6 +380,8 @@ object ReadBookConfig {
private var textColor: String = "#3E3D3B",//白天文字颜色
private var textColorNight: String = "#ADADAD",//夜间文字颜色
private var textColorEInk: String = "#000000",
private var pageAnim: Int = 0,
private var pageAnimEInk: Int = 3,
var textFont: String = "",//字体
var textBold: Int = 0,//是否粗体字 0:正常, 1:粗体, 2:细体
var textSize: Int = 20,//文字大小
@ -454,6 +457,20 @@ object ReadBookConfig {
}
}
fun setPageAnim(anim: Int) {
when {
AppConfig.isEInkMode -> pageAnimEInk = anim
else -> pageAnim = anim
}
}
fun pageAnim(): Int {
return when {
AppConfig.isEInkMode -> pageAnimEInk
else -> pageAnim
}
}
fun textColor(): Int {
return when {
AppConfig.isEInkMode -> Color.parseColor(textColorEInk)

@ -61,7 +61,6 @@ object Restore {
private val readPrefKeys = arrayOf(
PreferKey.readStyleSelect,
PreferKey.shareLayout,
PreferKey.pageAnim,
PreferKey.hideStatusBar,
PreferKey.hideNavigationBar,
PreferKey.bodyIndent,
@ -215,7 +214,6 @@ object Restore {
ReadBookConfig.apply {
styleSelect = App.INSTANCE.getPrefInt(PreferKey.readStyleSelect)
shareLayout = App.INSTANCE.getPrefBoolean(PreferKey.shareLayout)
pageAnim = App.INSTANCE.getPrefInt(PreferKey.pageAnim)
hideStatusBar = App.INSTANCE.getPrefBoolean(PreferKey.hideStatusBar)
hideNavigationBar = App.INSTANCE.getPrefBoolean(PreferKey.hideNavigationBar)
bodyIndentCount = App.INSTANCE.getPrefInt(PreferKey.bodyIndent, 2)

@ -104,12 +104,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
private fun initData() {
cb_share_layout.isChecked = ReadBookConfig.shareLayout
ReadBookConfig.pageAnim.let {
if (it >= 0 && it < rg_page_anim.childCount) {
rg_page_anim.check(rg_page_anim[it].id)
}
}
upStyle()
upView()
styleAdapter.setItems(ReadBookConfig.configList)
}
@ -149,7 +144,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
cb_share_layout.onCheckedChangeListener = { checkBox, isChecked ->
if (checkBox.isPressed) {
ReadBookConfig.shareLayout = isChecked
upStyle()
upView()
postEvent(EventBus.UP_CONFIG, true)
}
}
@ -206,7 +201,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
if (index != oldIndex) {
ReadBookConfig.styleSelect = index
ReadBookConfig.upBg()
upStyle()
upView()
styleAdapter.notifyItemChanged(oldIndex)
styleAdapter.notifyItemChanged(index)
postEvent(EventBus.UP_CONFIG, true)
@ -220,8 +215,11 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack {
return true
}
private fun upStyle() {
private fun upView() {
ReadBookConfig.let {
if (it.pageAnim >= 0 && it.pageAnim < rg_page_anim.childCount) {
rg_page_anim.check(rg_page_anim[it.pageAnim].id)
}
dsb_text_size.progress = it.textSize - 5
dsb_text_letter_spacing.progress = (it.letterSpacing * 100).toInt() + 50
dsb_line_size.progress = it.lineSpacingExtra

@ -733,7 +733,6 @@
<string name="rule_replace_regex">替换规则(replaceRegex)</string>
<string name="group_name">分組名稱</string>
<string name="note_content">備註內容</string>
<string name="e_ink_change_bg">E-Ink模式下只有白纸黑字,不显示其它背景</string>
<string name="replace_enable_default_t">默认启用替换净化</string>
<string name="replace_enable_default_s">新加入书架的书是否启用替换净化</string>
<string name="select_restore_file">选择恢复文件</string>

@ -733,7 +733,6 @@
<string name="rule_replace_regex">取代規則(replaceRegex)</string>
<string name="group_name">分組名稱</string>
<string name="note_content">備註內容</string>
<string name="e_ink_change_bg">E-Ink模式下只有白紙黑字,不顯示其它背景</string>
<string name="replace_enable_default_t">預設啟用取代淨化</string>
<string name="replace_enable_default_s">新加入書架的書是否啟用取代淨化</string>
<string name="select_restore_file">選擇復原文件</string>

@ -738,7 +738,6 @@
<string name="rule_replace_regex">替换规则(replaceRegex)</string>
<string name="group_name">分组名称</string>
<string name="note_content">备注内容</string>
<string name="e_ink_change_bg">E-Ink模式下只有白纸黑字,不显示其它背景</string>
<string name="replace_enable_default_t">默认启用替换净化</string>
<string name="replace_enable_default_s">新加入书架的书是否启用替换净化</string>
<string name="select_restore_file">选择恢复文件</string>

@ -739,7 +739,6 @@
<string name="read_config">Reading interface settings</string>
<string name="group_name">Group name</string>
<string name="note_content">Remarks section</string>
<string name="e_ink_change_bg">Only white page black text in E-Ink mode</string>
<string name="replace_enable_default_t">Enable replace rule by default</string>
<string name="replace_enable_default_s">For new added books</string>
<string name="select_restore_file">Select restore file</string>

Loading…
Cancel
Save