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
import com.test.easy.easycleanerjunk.helps.PermissionHelp.checkStorePermission
import com.test.easy.easycleanerjunk.helps.PermissionHelp.requestStorePermission
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.DialogViews.showDialogFunctionExit
import com.test.easy.easycleanerjunk.view.DialogViews.showGerPermission
......@@ -103,30 +104,41 @@ class ScreenShotActivity : BaseActivity<ActivityScreenShotBinding>() {
setCleanUpUi(size)
}
binding.tvClean.setOnClickListener {
val files = screenShotAdapter.getSelectData()
showFileDeleteDialog {
AdmobUtils.showInterstitialAd(this) {
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"
}
val s = SPUtils.getInstance().getInt("isShowBackIntAd", 0)
if (s == 0) {
doDelete()
} else {
showFileDeleteDialog {
AdmobUtils.showInterstitialAd(this) {
doDelete()
}
}
}
}
}
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> {
val dcim = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
val screenFiles = FileHelps.getDirFiles(dcim)
......
......@@ -23,6 +23,7 @@ import com.test.easy.easycleanerjunk.helps.MediaStoreUtils
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.utils.BarUtils
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.DialogViews.showDialogFunctionExit
import com.test.easy.easycleanerjunk.view.FileDeleteDialog.showFileDeleteDialog
......@@ -74,21 +75,31 @@ class RepeatPhotoActivity : BaseActivity<ActivityLayoutRepeatPhotoBinding>() {
}
binding.idTvDelete.setOnClickListener {
showFileDeleteDialog {
AdmobUtils.showInterstitialAd(this) {
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)
val s = SPUtils.getInstance().getInt("isShowBackIntAd", 0)
if (s == 0) {
doDeleteFile()
} else {
AdmobUtils.showInterstitialAd(this) {
doDeleteFile()
}
}
}
}
}
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 isplay = 0
......
......@@ -65,6 +65,7 @@ object ComUtils {
SPUtils.getInstance().put("timerInterval", bean.timerInterval)
SPUtils.getInstance().put("naAdS", bean.naAdS)
SPUtils.getInstance().put("isShowBackIntAd", bean.isShowBackIntAd)
SPUtils.getInstance().put("isShowResultNaAd", bean.isShowResultNaAd)
SPUtils.getInstance().put("loading_page_time", bean.loadingPageTime)
adDisplayInterval = bean.adInterval
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