|
|
|
@ -235,12 +235,15 @@ class ImportBookActivity : VMBaseActivity<ImportBookViewModel>(R.layout.activity |
|
|
|
|
* 扫描当前文件夹 |
|
|
|
|
*/ |
|
|
|
|
private fun scanFolder() { |
|
|
|
|
launch(IO) { |
|
|
|
|
rootDoc?.let { doc -> |
|
|
|
|
adapter.clearItems() |
|
|
|
|
val lastDoc = subDocs.lastOrNull() ?: doc |
|
|
|
|
viewModel.scanDoc(lastDoc) { |
|
|
|
|
launch { |
|
|
|
|
adapter.addItem(it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} ?: let { |
|
|
|
|
val lastPath = AppConfig.importBookPath |
|
|
|
|
if (lastPath.isNullOrEmpty()) { |
|
|
|
@ -249,11 +252,14 @@ class ImportBookActivity : VMBaseActivity<ImportBookViewModel>(R.layout.activity |
|
|
|
|
adapter.clearItems() |
|
|
|
|
val file = File(path) |
|
|
|
|
viewModel.scanFile(file) { |
|
|
|
|
launch { |
|
|
|
|
adapter.addItem(it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |
|
|
|
|
super.onActivityResult(requestCode, resultCode, data) |
|
|
|
|