Commit b8a8781a authored by 周文华's avatar 周文华

【调整】调整清理首页显示清理文件大小

parent 88379b4e
......@@ -4,7 +4,6 @@ package com.base.scanqrclear.luma
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.os.Bundle
import android.view.View
import android.view.animation.LinearInterpolator
......@@ -147,6 +146,19 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
AnimationHelps.progress(binding.pbMemoryUsed, usedMemoryUsedScale.toInt())
}
}
lifecycleScope.launch(Dispatchers.IO) {
val emptyFoldersDeferred = async { FileHelps.findEmptyFolders(lifecycleScope) }
val filesDeferred = async { MediaHelps.findSpecifiedFiles(requireContext()) }
val emptyFolder = emptyFoldersDeferred.await()
val files = filesDeferred.await()
val emptyLength = emptyFolder.sumOf { it.length }
val filesLength = files.sumOf { it.length }
val totalLength = emptyLength + filesLength
val totalSize = Utils.getSize(totalLength)
withContext(Dispatchers.Main) {
binding.tvJunkFiles.text = totalSize
}
}
}
private fun showDay() {
......
......@@ -173,7 +173,7 @@
android:id="@+id/tv_junk_files"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/junk_files"
android:text="0 B"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"
......
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