From 9e402a7cc0adeadbe0f440815f4217d35adacec0 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 18 Feb 2020 20:25:23 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/widget/font/FontSelectDialog.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt b/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt index 47d4ac1a1..a129ae47c 100644 --- a/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt +++ b/app/src/main/java/io/legado/app/ui/widget/font/FontSelectDialog.kt @@ -123,10 +123,11 @@ class FontSelectDialog : DialogFragment(), private fun getFontFiles(uri: Uri) { launch(IO) { FileUtils.deleteFile(fontCacheFolder) - DocumentFile.fromTreeUri(App.INSTANCE, uri)?.listFiles()?.forEach { file -> - if (file.name?.toLowerCase()?.matches(".*\\.[ot]tf".toRegex()) == true) { - DocumentUtils.readBytes(App.INSTANCE, file.uri)?.let { - FileUtils.createFileIfNotExist(fontCacheFolder + file.name).writeBytes(it) + DocumentUtils.listFiles(App.INSTANCE, uri).forEach { item -> + if (item.name.toLowerCase().matches(".*\\.[ot]tf".toRegex())) { + DocumentUtils.readBytes(App.INSTANCE, item.uri)?.let { byteArray -> + FileUtils.createFileIfNotExist(fontCacheFolder + item.name) + .writeBytes(byteArray) } } }