pull/63/head
kunfei 5 years ago
parent ea0f25f735
commit 7628ed1e5e
  1. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentView.kt

@ -15,4 +15,5 @@ object PreferKey {
const val cleanCache = "cleanCache" const val cleanCache = "cleanCache"
const val lastGroup = "lastGroup" const val lastGroup = "lastGroup"
const val pageAnim = "pageAnim" const val pageAnim = "pageAnim"
const val readBookFont = "readBookFont"
} }

@ -87,13 +87,13 @@ class ReadStyleDialog : DialogFragment() {
} }
tv_text_font.onClick { tv_text_font.onClick {
FontSelectDialog(requireContext()).apply { FontSelectDialog(requireContext()).apply {
curPath = requireContext().getPrefString("readBookFont") curPath = requireContext().getPrefString(PreferKey.readBookFont)
defaultFont = { defaultFont = {
requireContext().putPrefString("readBookFont", "") requireContext().putPrefString(PreferKey.readBookFont, "")
postEvent(Bus.UP_CONFIG, true) postEvent(Bus.UP_CONFIG, true)
} }
selectFile = { selectFile = {
requireContext().putPrefString("readBookFont", it) requireContext().putPrefString(PreferKey.readBookFont, it)
postEvent(Bus.UP_CONFIG, true) postEvent(Bus.UP_CONFIG, true)
} }
}.show() }.show()

@ -81,7 +81,7 @@ class ContentView : FrameLayout {
tv_bottom_right.setTextColor(it) tv_bottom_right.setTextColor(it)
} }
} }
context.getPrefString("readBookFont")?.let { context.getPrefString(PreferKey.readBookFont)?.let {
if (it.isNotEmpty()) { if (it.isNotEmpty()) {
content_text_view.typeface = Typeface.createFromFile(it) content_text_view.typeface = Typeface.createFromFile(it)
} else { } else {

Loading…
Cancel
Save