pull/363/head
gedoor 5 years ago
parent d2600dcaaf
commit 626ae94768
  1. 15
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt

@ -316,20 +316,15 @@ class BgTextConfigDialog : BaseDialogFragment(), FileChooserDialog.CallBack {
val config: ReadBookConfig.Config = GSON.fromJsonObject(configFile.readText())!! val config: ReadBookConfig.Config = GSON.fromJsonObject(configFile.readText())!!
if (config.textFont.isNotEmpty()) { if (config.textFont.isNotEmpty()) {
val fontName = FileUtils.getName(config.textFont) val fontName = FileUtils.getName(config.textFont)
val file = File( val fontPath =
FileUtils.getPath(requireContext().externalFilesDir, "font", fontName) FileUtils.getPath(requireContext().externalFilesDir, "font", fontName)
) FileUtils.getFile(configDir, fontName).copyTo(File(fontPath))
FileUtils.getFile(configDir, fontName).copyTo(file) config.textFont = fontPath
config.textFont = file.absolutePath
} }
if (config.bgType() == 2) { if (config.bgType() == 2) {
val bgName = FileUtils.getName(config.bgStr()) val bgName = FileUtils.getName(config.bgStr())
val file = FileUtils.createFileIfNotExist( val bgPath = FileUtils.getPath(requireContext().externalFilesDir, "bg", bgName)
requireContext().externalFilesDir, FileUtils.getFile(configDir, bgName).copyTo(File(bgPath))
"bg",
bgName
)
FileUtils.getFile(configDir, bgName).compareTo(file)
} }
ReadBookConfig.durConfig = config ReadBookConfig.durConfig = config
postEvent(EventBus.UP_CONFIG, true) postEvent(EventBus.UP_CONFIG, true)

Loading…
Cancel
Save