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>() { ...@@ -166,6 +166,7 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() {
binding.tvScanning.text = "Completed" binding.tvScanning.text = "Completed"
AdmobInterstitialUtils.showInterstitialAd(this@FileScanResultActivity, isShowDialog = false) {} AdmobInterstitialUtils.showInterstitialAd(this@FileScanResultActivity, isShowDialog = false) {}
binding.ivEmpty.isVisible = pathList.isEmpty() binding.ivEmpty.isVisible = pathList.isEmpty()
setAdapterData(null)
dialogClass.finishScan { dialogClass.finishScan {
scanDialog.dismiss() scanDialog.dismiss()
} }
...@@ -176,32 +177,29 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() { ...@@ -176,32 +177,29 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() {
private val pathList = ArrayList<String>() private val pathList = ArrayList<String>()
private val hashMap = HashMap<String, ArrayList<RecoveryBean>>() private val hashMap = HashMap<String, ArrayList<RecoveryBean>>()
private fun setAdapterData(path: String) { private fun setAdapterData(path: String? = null) {
val flag = path?.let { addMapFolder(it) } ?: true
val flag = addMapFolder(path)
if (flag) { if (flag) {
binding.tvFolderNumber.text = hashMap.keys.size.toString() binding.tvFolderNumber.text = hashMap.keys.size.toString()
val mapList = hashMap.map { val mapList = hashMap.map {
val folderName = it.key.split("/").last() FolderBean(it.key, recoveryList = it.value)
FolderBean(folderName, recoveryList = it.value)
} }
fileFolderAdapter.setData(mapList) fileFolderAdapter.setData(mapList)
} else {
binding.tvFileNumber.text = hashMap.values.sumOf { it.size }.toString()
} }
} }
private fun addMapFolder(path: String): Boolean { 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) { if (hashMap[folder] == null) {
hashMap[folder] = arrayListOf() hashMap[folder] = arrayListOf()
return true isNewFolder = true
} }
val recoveryBean = RecoveryBean(path) val recoveryBean = RecoveryBean(path)
if (scanType == SCAN_DOCUMENTS) { if (scanType == SCAN_DOCUMENTS) {
recoveryBean.setType() recoveryBean.setType()
} }
hashMap[folder]?.add(recoveryBean) 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