Commit 1c6c6646 authored by wanglei's avatar wanglei

...

parent d10e2c06
......@@ -13,11 +13,14 @@ import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.adapter.AppManagerAdapter
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils
import com.base.filerecoveryrecyclebin.bean.AppBean
import com.base.filerecoveryrecyclebin.databinding.ActivityAppManagerBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity
import com.base.filerecoveryrecyclebin.utils.BarUtils
import com.base.filerecoveryrecyclebin.utils.RamUtils.ramPair
import com.base.filerecoveryrecyclebin.view.DialogViews.showDeletePermanentlyDialog
import com.base.filerecoveryrecyclebin.view.DialogViews.showExitFunctionDialog
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
......@@ -79,7 +82,16 @@ class AppManagerActivity : BaseActivity<ActivityAppManagerBinding>() {
override fun initListener() {
super.initListener()
onBackPressedDispatcher.addCallback {
finishToMain()
showExitFunctionDialog{showAd ->
if (showAd){
AdmobMaxHelper.admobMaxShowInterstitialAd(this@AppManagerActivity, isLoading = false) {
finishToMain()
}
}else{
finishToMain()
}
}
}
binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
......
......@@ -14,6 +14,7 @@ import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.adapter.AppManagerAdapter
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper.showBackInterAdSp
import com.base.filerecoveryrecyclebin.bean.AppBean
import com.base.filerecoveryrecyclebin.databinding.ActivityAppProcessBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity
......@@ -64,10 +65,13 @@ class AppProcessActivity : BaseActivity<ActivityAppProcessBinding>() {
super.initListener()
onBackPressedDispatcher.addCallback {
showAppProcessExitDialog(ePercent) {
// AdmobMaxHelper.admobMaxShowInterstitialAd(this@AppProcessActivity) {
//
// }
finishToMain()
if (showBackInterAdSp()) {
AdmobMaxHelper.admobMaxShowInterstitialAd(this@AppProcessActivity) {
finishToMain()
}
} else {
finishToMain()
}
}
}
binding.flFanhui.setOnClickListener {
......
......@@ -15,6 +15,7 @@ import com.base.filerecoveryrecyclebin.help.BaseActivity
import com.base.filerecoveryrecyclebin.receiver.BatteryReceiver
import com.base.filerecoveryrecyclebin.utils.BarUtils
import com.base.filerecoveryrecyclebin.utils.LogEx
import com.base.filerecoveryrecyclebin.view.DialogViews.showExitFunctionDialog
import kotlin.math.abs
......@@ -63,7 +64,15 @@ class BatteryActivity : BaseActivity<ActivityBatteryBinding>() {
override fun initListener() {
super.initListener()
onBackPressedDispatcher.addCallback {
finishToMain()
showExitFunctionDialog { showAd ->
if (showAd) {
AdmobMaxHelper.admobMaxShowInterstitialAd(this@BatteryActivity) {
finishToMain()
}
} else {
finishToMain()
}
}
}
binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
......
......@@ -65,7 +65,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
if (scanFinish) {
if (junkExpandAdapter.getAllChildItemCount() == 0) {
binding.tvBtn.visibility = View.GONE
binding.llTwoBtn.visibility = View.VISIBLE
binding.llTwoBtn.visibility = View.GONE
} else {
binding.tvBtn.isVisible = true
binding.tvBtn.isEnabled = true
......
......@@ -8,7 +8,6 @@ import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.adapter.MediaAdapter
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils.showInterAdSp
import com.base.filerecoveryrecyclebin.bean.MediaBean
import com.base.filerecoveryrecyclebin.bean.MediaTimeBean
import com.base.filerecoveryrecyclebin.databinding.ActivityRepeatBinding
......@@ -103,7 +102,7 @@ class RepeatActivity : BaseActivity<ActivityRepeatBinding>() {
}
binding.tvClean.setOnClickListener {
showDeletePermanentlyDialog {
if (showInterAdSp()) {
if (AdmobMaxHelper.showDeleteAdSp()) {
AdmobMaxHelper.admobMaxShowInterstitialAd(this, isLoading = false) {
cleanFile()
}
......
......@@ -9,7 +9,6 @@ import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.adapter.ScreenShotAdapter
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils.showInterAdSp
import com.base.filerecoveryrecyclebin.bean.ScreenPhotoBean
import com.base.filerecoveryrecyclebin.bean.ScreenshotBean
import com.base.filerecoveryrecyclebin.databinding.ActivityScreenShotBinding
......@@ -122,7 +121,7 @@ class ScreenShotActivity : BaseActivity<ActivityScreenShotBinding>() {
binding.tvClean.setOnClickListener {
showDeletePermanentlyDialog {
if (showInterAdSp()) {
if (AdmobMaxHelper.showDeleteAdSp()) {
AdmobMaxHelper.admobMaxShowInterstitialAd(this, isLoading = false) {
cleanFile()
}
......
......@@ -32,6 +32,18 @@ object AdmobMaxHelper {
return ss == 1
}
fun showBackInterAdSp(): Boolean {
val isShowBackIntAd = AppPreferences.getInstance().getString("isShowBackIntAd", "0").toInt()
//1要看插屏 0不看
return isShowBackIntAd == 1
}
fun showDeleteAdSp(): Boolean {
val isDeleteInterAd = AppPreferences.getInstance().getString("isDeleteInterAd", "0").toInt()
//1要看插屏 0不看
return isDeleteInterAd == 1
}
//Begin
fun initAdmobMaxAd() {
......
......@@ -41,11 +41,6 @@ object AdmobInterstitialUtils {
return System.currentTimeMillis() - interLoadTime > 1000 * 60 * 60
}
fun showInterAdSp(): Boolean {
val isDeleteInterAd = AppPreferences.getInstance().getString("isDeleteInterAd", "0").toInt()
//1要看插屏 0不看
return isDeleteInterAd == 1
}
fun showInterstitialAd(
activity: Activity,
......
......@@ -19,7 +19,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
import androidx.lifecycle.LifecycleCoroutineScope
import com.base.filerecoveryrecyclebin.R
import com.base.filerecoveryrecyclebin.activity.junkclean.ScanJunkActivity
import com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils.showInterAdSp
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper.showBackInterAdSp
import com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_ALL
import com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_AUDIO
import com.base.filerecoveryrecyclebin.bean.ConstObject.SELECT_FILE_DOCUMENT
......@@ -274,7 +274,7 @@ object DialogViews {
exitAction: (showAd: Boolean) -> Unit
) {
if (!mustShow) {
if (!showInterAdSp()) {
if (!showBackInterAdSp()) {
exitAction.invoke(false)
return
}
......
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