edit BgTextConfigDialog.kt

pull/840/head
gedoor 4 years ago
parent 821acb1d7c
commit 1ff21378c2
  1. 4
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt

@ -204,7 +204,7 @@ class BgTextConfigDialog : BaseDialogFragment(), FilePickerDialog.CallBack {
val exportFileName = if (ReadBookConfig.config.name.isBlank()) { val exportFileName = if (ReadBookConfig.config.name.isBlank()) {
configFileName configFileName
} else { } else {
ReadBookConfig.config.name "${ReadBookConfig.config.name}.zip"
} }
execute { execute {
val exportFiles = arrayListOf<File>() val exportFiles = arrayListOf<File>()
@ -257,7 +257,7 @@ class BgTextConfigDialog : BaseDialogFragment(), FilePickerDialog.CallBack {
if (ZipUtils.zipFiles(exportFiles, File(configZipPath))) { if (ZipUtils.zipFiles(exportFiles, File(configZipPath))) {
if (uri.isContentScheme()) { if (uri.isContentScheme()) {
DocumentFile.fromTreeUri(requireContext(), uri)?.let { treeDoc -> DocumentFile.fromTreeUri(requireContext(), uri)?.let { treeDoc ->
treeDoc.findFile(configFileName)?.delete() treeDoc.findFile(exportFileName)?.delete()
treeDoc.createFile("", exportFileName) treeDoc.createFile("", exportFileName)
?.writeBytes(requireContext(), File(configZipPath).readBytes()) ?.writeBytes(requireContext(), File(configZipPath).readBytes())
} }

Loading…
Cancel
Save