选择字体文件夹弹出框用协程处理

这样就不会遮盖住了, 优化一点代码
pull/118/head
hingbong 5 years ago
parent 54b3add99a
commit 95c14b99a3
  1. 2
      app/src/main/java/io/legado/app/help/storage/Backup.kt
  2. 2
      app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt

@ -102,7 +102,7 @@ object Backup {
if (file.exists()) { if (file.exists()) {
treeDoc.findFile(fileName)?.delete() treeDoc.findFile(fileName)?.delete()
treeDoc.createFile("", fileName)?.let { treeDoc.createFile("", fileName)?.let {
DocumentUtils.writeText(context, file.readText(), it.uri) DocumentUtils.writeBytes(context, file.readBytes(), it.uri)
} }
} }
} }

@ -109,6 +109,7 @@ class FontSelectDialog : BaseDialogFragment(),
} }
private fun openFolder() { private fun openFolder() {
launch(Main) {
alert { alert {
titleResource = R.string.select_folder titleResource = R.string.select_folder
items(resources.getStringArray(R.array.select_folder).toList()) { _, index -> items(resources.getStringArray(R.array.select_folder).toList()) { _, index ->
@ -145,6 +146,7 @@ class FontSelectDialog : BaseDialogFragment(),
} }
}.show() }.show()
} }
}
@SuppressLint("DefaultLocale") @SuppressLint("DefaultLocale")
private fun getFontFiles(doc: DocumentFile) { private fun getFontFiles(doc: DocumentFile) {

Loading…
Cancel
Save