|
|
@ -162,15 +162,16 @@ class ImportBookActivity : VMBaseActivity<ImportBookViewModel>(R.layout.activity |
|
|
|
val docList = arrayListOf<DocItem>() |
|
|
|
val docList = arrayListOf<DocItem>() |
|
|
|
File(path).listFiles()?.forEach { |
|
|
|
File(path).listFiles()?.forEach { |
|
|
|
if (it.isDirectory) { |
|
|
|
if (it.isDirectory) { |
|
|
|
docList.add( |
|
|
|
if (!it.name.startsWith(".")) |
|
|
|
DocItem( |
|
|
|
docList.add( |
|
|
|
it.name, |
|
|
|
DocItem( |
|
|
|
DocumentsContract.Document.MIME_TYPE_DIR, |
|
|
|
it.name, |
|
|
|
it.length(), |
|
|
|
DocumentsContract.Document.MIME_TYPE_DIR, |
|
|
|
Date(it.lastModified()), |
|
|
|
it.length(), |
|
|
|
Uri.parse(it.absolutePath) |
|
|
|
Date(it.lastModified()), |
|
|
|
|
|
|
|
Uri.parse(it.absolutePath) |
|
|
|
|
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
} else if (it.name.endsWith(".txt", true)) { |
|
|
|
} else if (it.name.endsWith(".txt", true)) { |
|
|
|
docList.add( |
|
|
|
docList.add( |
|
|
|
DocItem( |
|
|
|
DocItem( |
|
|
@ -183,6 +184,7 @@ class ImportBookActivity : VMBaseActivity<ImportBookViewModel>(R.layout.activity |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
docList.sortWith(compareBy({ !it.isDir }, { it.name })) |
|
|
|
adapter.setData(docList) |
|
|
|
adapter.setData(docList) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|