Commit 34a7f3e1 authored by leichao.gao's avatar leichao.gao

add result and back switch

parent 538b5821
...@@ -3,6 +3,7 @@ package com.test.easy.easycleanerjunk.activity ...@@ -3,6 +3,7 @@ package com.test.easy.easycleanerjunk.activity
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.graphics.Color import android.graphics.Color
import android.view.View
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import com.test.easy.easycleanerjunk.activity.appmanager.AppManagerAnimationActivity import com.test.easy.easycleanerjunk.activity.appmanager.AppManagerAnimationActivity
...@@ -104,7 +105,8 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() { ...@@ -104,7 +105,8 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
PHOTO_COMPRESS -> { PHOTO_COMPRESS -> {
val size = intent.getLongExtra("size", 0L).toFormatSize(1) val size = intent.getLongExtra("size", 0L).toFormatSize(1)
binding.tvInfo.text = "Compress ${intent.getIntExtra("num", 0)} photo, $size space freed" binding.tvInfo.text =
"Compress ${intent.getIntExtra("num", 0)} photo, $size space freed"
} }
BATTERY_INFO -> { BATTERY_INFO -> {
...@@ -125,17 +127,30 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() { ...@@ -125,17 +127,30 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) { onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() { override fun handleOnBackPressed() {
AdmobUtils.showInterstitialAd(this@ResultActivity) { val s = SPUtils.getInstance().getInt("isShowBackIntAd", 0)
if (s == 1) {
AdmobUtils.showInterstitialAd(this@ResultActivity) {
finishToMain()
}
} else {
finishToMain() finishToMain()
} }
} }
}) })
binding.ivBack.setOnClickListener { binding.ivBack.setOnClickListener {
onBackPressedDispatcher.onBackPressed() onBackPressedDispatcher.onBackPressed()
} }
val ss = SPUtils.getInstance().getInt("isShowResultNaAd", 0)
if (ss == 1) {
binding.flAd.visibility = View.VISIBLE
AdmobUtils.showNativeAd(this@ResultActivity, binding.flAd)
} else {
binding.flAd.visibility = View.GONE
}
AdmobUtils.showNativeAd(this@ResultActivity, binding.flAd)
} }
override fun onResume() { override fun onResume() {
......
...@@ -16,4 +16,6 @@ class ConfigBean() { ...@@ -16,4 +16,6 @@ class ConfigBean() {
var timerInterval: Int = 5 var timerInterval: Int = 5
var maxMultiClick: Int = 4 var maxMultiClick: Int = 4
var naAdS: Int = 0 var naAdS: Int = 0
var isShowBackIntAd: Int = 0
var isShowResultNaAd: Int = 0
} }
...@@ -65,6 +65,7 @@ object ComUtils { ...@@ -65,6 +65,7 @@ object ComUtils {
SPUtils.getInstance().put("timerDelay", bean.timerDelay) SPUtils.getInstance().put("timerDelay", bean.timerDelay)
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)
adDisplayInterval = bean.adInterval adDisplayInterval = bean.adInterval
maxMultiClick = bean.maxMultiClick maxMultiClick = bean.maxMultiClick
AdDisplayUtils.getInstance().setMaxAdDisplayCount(bean.adShowCount) AdDisplayUtils.getInstance().setMaxAdDisplayCount(bean.adShowCount)
......
package com.test.easy.easycleanerjunk.view package com.test.easy.easycleanerjunk.view
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Activity
import android.app.Dialog import android.app.Dialog
import android.content.Context import android.content.Context
import android.graphics.Color import android.graphics.Color
...@@ -102,6 +103,13 @@ object DialogViews { ...@@ -102,6 +103,13 @@ object DialogViews {
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
fun Context.showDialogFunctionExit(function: String, okAction: () -> Unit) { fun Context.showDialogFunctionExit(function: String, okAction: () -> Unit) {
val s = SPUtils.getInstance().getInt("isShowBackIntAd", 0)
if (s == 0) {
if(this is Activity){
this.finish()
}
return
}
val desc = when (function) { val desc = when (function) {
JUNK_CLEANER -> "Exit Junk Cleaner? Unremoved junk files may be taking up space." JUNK_CLEANER -> "Exit Junk Cleaner? Unremoved junk files may be taking up space."
LARGE_FILE_CLEANER -> "Exit Big File Cleaner? Unremoved big files may be taking up space." LARGE_FILE_CLEANER -> "Exit Big File Cleaner? Unremoved big files may be taking up space."
......
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