diff --git a/app/src/main/java/io/legado/app/ui/importbook/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/importbook/ImportBookActivity.kt index b2b5cdca9..cbd7863eb 100644 --- a/app/src/main/java/io/legado/app/ui/importbook/ImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/importbook/ImportBookActivity.kt @@ -87,9 +87,13 @@ class ImportBookActivity : VMBaseActivity(R.layout.activity tv_path.text = tv_path.text.toString() + it.name + File.separator } } - doc?.listFiles()?.let { - importBookAdapter.setItems(it.toList()) + val docList = arrayListOf() + doc?.listFiles()?.forEach { + if (it.isDirectory || it.name?.endsWith(".txt", true) == true) { + docList.add(it) + } } + importBookAdapter.setItems(docList) } }