Commit 72060d58 authored by leichao.gao's avatar leichao.gao

Merge branch 'master' of gitlab.huolea.com:koko/data-recovery-white

parents 0401a829 a1d52ef0
......@@ -166,6 +166,7 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() {
binding.tvScanning.text = "Completed"
AdmobInterstitialUtils.showInterstitialAd(this@FileScanResultActivity, isShowDialog = false) {}
binding.ivEmpty.isVisible = pathList.isEmpty()
setAdapterData(null)
dialogClass.finishScan {
scanDialog.dismiss()
}
......@@ -176,32 +177,29 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() {
private val pathList = ArrayList<String>()
private val hashMap = HashMap<String, ArrayList<RecoveryBean>>()
private fun setAdapterData(path: String) {
val flag = addMapFolder(path)
private fun setAdapterData(path: String? = null) {
val flag = path?.let { addMapFolder(it) } ?: true
if (flag) {
binding.tvFolderNumber.text = hashMap.keys.size.toString()
val mapList = hashMap.map {
val folderName = it.key.split("/").last()
FolderBean(folderName, recoveryList = it.value)
FolderBean(it.key, recoveryList = it.value)
}
fileFolderAdapter.setData(mapList)
} else {
binding.tvFileNumber.text = hashMap.values.sumOf { it.size }.toString()
}
}
private fun addMapFolder(path: String): Boolean {
val folder = File(path).parent ?: ""
var isNewFolder = false
val folder = File(path).parent?.split("/")?.last() ?: ""
if (hashMap[folder] == null) {
hashMap[folder] = arrayListOf()
return true
isNewFolder = true
}
val recoveryBean = RecoveryBean(path)
if (scanType == SCAN_DOCUMENTS) {
recoveryBean.setType()
}
hashMap[folder]?.add(recoveryBean)
return false
return isNewFolder
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment