From d07396e5f07f98c6a756b82283cc780750950641 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 11 Mar 2020 20:17:42 +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 --- .../app/ui/book/local/ImportBookActivity.kt | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt index d89bc9146..0557fb046 100644 --- a/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/local/ImportBookActivity.kt @@ -162,15 +162,16 @@ class ImportBookActivity : VMBaseActivity(R.layout.activity val docList = arrayListOf() File(path).listFiles()?.forEach { if (it.isDirectory) { - docList.add( - DocItem( - it.name, - DocumentsContract.Document.MIME_TYPE_DIR, - it.length(), - Date(it.lastModified()), - Uri.parse(it.absolutePath) + if (!it.name.startsWith(".")) + docList.add( + DocItem( + it.name, + DocumentsContract.Document.MIME_TYPE_DIR, + it.length(), + Date(it.lastModified()), + Uri.parse(it.absolutePath) + ) ) - ) } else if (it.name.endsWith(".txt", true)) { docList.add( DocItem( @@ -183,6 +184,7 @@ class ImportBookActivity : VMBaseActivity(R.layout.activity ) } } + docList.sortWith(compareBy({ !it.isDir }, { it.name })) adapter.setData(docList) } }