Commit 9d1e6f03 authored by wanglei's avatar wanglei

Merge remote-tracking branch 'origin/free-master-ad-legal' into free-master-ad-legal

parents c62a087e f7c0eeb5
...@@ -15,6 +15,7 @@ import com.test.easy.easycleanerjunk.helps.KotlinExt.toFormatSize ...@@ -15,6 +15,7 @@ import com.test.easy.easycleanerjunk.helps.KotlinExt.toFormatSize
import com.test.easy.easycleanerjunk.helps.PermissionHelp.checkStorePermission import com.test.easy.easycleanerjunk.helps.PermissionHelp.checkStorePermission
import com.test.easy.easycleanerjunk.helps.PermissionHelp.requestStorePermission import com.test.easy.easycleanerjunk.helps.PermissionHelp.requestStorePermission
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.utils.SPUtils
import com.test.easy.easycleanerjunk.view.AFunOb import com.test.easy.easycleanerjunk.view.AFunOb
import com.test.easy.easycleanerjunk.view.DialogViews.showDialogFunctionExit import com.test.easy.easycleanerjunk.view.DialogViews.showDialogFunctionExit
import com.test.easy.easycleanerjunk.view.DialogViews.showGerPermission import com.test.easy.easycleanerjunk.view.DialogViews.showGerPermission
...@@ -103,30 +104,41 @@ class ScreenShotActivity : BaseActivity<ActivityScreenShotBinding>() { ...@@ -103,30 +104,41 @@ class ScreenShotActivity : BaseActivity<ActivityScreenShotBinding>() {
setCleanUpUi(size) setCleanUpUi(size)
} }
binding.tvClean.setOnClickListener { binding.tvClean.setOnClickListener {
val files = screenShotAdapter.getSelectData()
showFileDeleteDialog { val s = SPUtils.getInstance().getInt("isShowBackIntAd", 0)
AdmobUtils.showInterstitialAd(this) { if (s == 0) {
lifecycleScope.launch(Dispatchers.IO) { doDelete()
async { } else {
files.forEach { screenFile -> showFileDeleteDialog {
runCatching { AdmobUtils.showInterstitialAd(this) {
val file = screenFile.file doDelete()
if (file.exists()) file.delete()
}
}
}.await()
launch(Dispatchers.Main) {
screenShotAdapter.removeData(files)
binding.tvSize.text = "0"
binding.tvUnit.text = "B"
}
} }
} }
} }
} }
} }
private fun doDelete() {
val files = screenShotAdapter.getSelectData()
lifecycleScope.launch(Dispatchers.IO) {
async {
files.forEach { screenFile ->
runCatching {
val file = screenFile.file
if (file.exists()) file.delete()
}
}
}.await()
launch(Dispatchers.Main) {
screenShotAdapter.removeData(files)
binding.tvSize.text = "0"
binding.tvUnit.text = "B"
}
}
}
private fun getScreenshotBean(): ArrayList<ScreenshotBean> { private fun getScreenshotBean(): ArrayList<ScreenshotBean> {
val dcim = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) val dcim = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
val screenFiles = FileHelps.getDirFiles(dcim) val screenFiles = FileHelps.getDirFiles(dcim)
......
...@@ -23,6 +23,7 @@ import com.test.easy.easycleanerjunk.helps.MediaStoreUtils ...@@ -23,6 +23,7 @@ import com.test.easy.easycleanerjunk.helps.MediaStoreUtils
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.utils.BarUtils import com.test.easy.easycleanerjunk.utils.BarUtils
import com.test.easy.easycleanerjunk.utils.NewFileUtils import com.test.easy.easycleanerjunk.utils.NewFileUtils
import com.test.easy.easycleanerjunk.utils.SPUtils
import com.test.easy.easycleanerjunk.view.AFunOb import com.test.easy.easycleanerjunk.view.AFunOb
import com.test.easy.easycleanerjunk.view.DialogViews.showDialogFunctionExit import com.test.easy.easycleanerjunk.view.DialogViews.showDialogFunctionExit
import com.test.easy.easycleanerjunk.view.FileDeleteDialog.showFileDeleteDialog import com.test.easy.easycleanerjunk.view.FileDeleteDialog.showFileDeleteDialog
...@@ -74,21 +75,31 @@ class RepeatPhotoActivity : BaseActivity<ActivityLayoutRepeatPhotoBinding>() { ...@@ -74,21 +75,31 @@ class RepeatPhotoActivity : BaseActivity<ActivityLayoutRepeatPhotoBinding>() {
} }
binding.idTvDelete.setOnClickListener { binding.idTvDelete.setOnClickListener {
showFileDeleteDialog { showFileDeleteDialog {
AdmobUtils.showInterstitialAd(this) { val s = SPUtils.getInstance().getInt("isShowBackIntAd", 0)
val list = fileList.toList().filter { it.isSelect } if (s == 0) {
if (list.isNotEmpty() && list.all { NewFileUtils.delete(it.path) }) { doDeleteFile()
fileList.removeAll(list) } else {
FileHelps.similarImageList.removeAll(list) AdmobUtils.showInterstitialAd(this) {
mAdapter.notifyDataSetChanged() doDeleteFile()
setTvStatus()
val array = list.map { it.path }.toTypedArray()
MediaStoreUtils.updateMediaStore(this, array)
} }
} }
} }
} }
} }
private fun doDeleteFile() {
val list = fileList.toList().filter { it.isSelect }
if (list.isNotEmpty() && list.all { NewFileUtils.delete(it.path) }) {
fileList.removeAll(list)
FileHelps.similarImageList.removeAll(list)
mAdapter.notifyDataSetChanged()
setTvStatus()
val array = list.map { it.path }.toTypedArray()
MediaStoreUtils.updateMediaStore(this, array)
}
}
private var fileList = mutableListOf<ImageDataBean>() private var fileList = mutableListOf<ImageDataBean>()
private var isplay = 0 private var isplay = 0
......
...@@ -65,6 +65,7 @@ object ComUtils { ...@@ -65,6 +65,7 @@ object ComUtils {
SPUtils.getInstance().put("timerInterval", bean.timerInterval) SPUtils.getInstance().put("timerInterval", bean.timerInterval)
SPUtils.getInstance().put("naAdS", bean.naAdS) SPUtils.getInstance().put("naAdS", bean.naAdS)
SPUtils.getInstance().put("isShowBackIntAd", bean.isShowBackIntAd) SPUtils.getInstance().put("isShowBackIntAd", bean.isShowBackIntAd)
SPUtils.getInstance().put("isShowResultNaAd", bean.isShowResultNaAd)
SPUtils.getInstance().put("loading_page_time", bean.loadingPageTime) SPUtils.getInstance().put("loading_page_time", bean.loadingPageTime)
adDisplayInterval = bean.adInterval adDisplayInterval = bean.adInterval
maxMultiClick = bean.maxMultiClick maxMultiClick = bean.maxMultiClick
......
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