Commit 1c6c6646 authored by wanglei's avatar wanglei

...

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