Commit f97231ab authored by wanglei's avatar wanglei

...

parent 18c3b0b4
...@@ -9,7 +9,9 @@ import androidx.lifecycle.lifecycleScope ...@@ -9,7 +9,9 @@ import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.databinding.ActivityAppProcessAnimationBinding import com.base.filerecoveryrecyclebin.databinding.ActivityAppProcessAnimationBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity import com.base.filerecoveryrecyclebin.help.BaseActivity
import com.ironsource.jo
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlin.random.Random import kotlin.random.Random
...@@ -19,6 +21,7 @@ class AppProcessAnimationActivity : BaseActivity<ActivityAppProcessAnimationBind ...@@ -19,6 +21,7 @@ class AppProcessAnimationActivity : BaseActivity<ActivityAppProcessAnimationBind
override val binding: ActivityAppProcessAnimationBinding by lazy { override val binding: ActivityAppProcessAnimationBinding by lazy {
ActivityAppProcessAnimationBinding.inflate(layoutInflater) ActivityAppProcessAnimationBinding.inflate(layoutInflater)
} }
private var job: Job? = null
override fun initView() { override fun initView() {
playLottie() playLottie()
...@@ -35,7 +38,10 @@ class AppProcessAnimationActivity : BaseActivity<ActivityAppProcessAnimationBind ...@@ -35,7 +38,10 @@ class AppProcessAnimationActivity : BaseActivity<ActivityAppProcessAnimationBind
binding.lottie.imageAssetsFolder = "app_manager/images/" binding.lottie.imageAssetsFolder = "app_manager/images/"
binding.lottie.setAnimation("app_manager/data.json") binding.lottie.setAnimation("app_manager/data.json")
binding.lottie.playAnimation() binding.lottie.playAnimation()
lifecycleScope.launch(Dispatchers.Main) { }
@SuppressLint("SetTextI18n")
fun jumpJob() = lifecycleScope.launch(Dispatchers.Main) {
delay(Random.nextLong(4000, 6000)) delay(Random.nextLong(4000, 6000))
binding.lottie.visibility = View.GONE binding.lottie.visibility = View.GONE
binding.lottieCompleted.visibility = View.VISIBLE binding.lottieCompleted.visibility = View.VISIBLE
...@@ -49,6 +55,17 @@ class AppProcessAnimationActivity : BaseActivity<ActivityAppProcessAnimationBind ...@@ -49,6 +55,17 @@ class AppProcessAnimationActivity : BaseActivity<ActivityAppProcessAnimationBind
} }
} }
override fun onResume() {
super.onResume()
if (job?.isActive == false && job == null) {
job = jumpJob()
}
} }
override fun onPause() {
super.onPause()
job?.cancel()
job = null
}
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper ...@@ -9,6 +9,7 @@ import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.databinding.ActivityScreenShotAnimationBinding import com.base.filerecoveryrecyclebin.databinding.ActivityScreenShotAnimationBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity import com.base.filerecoveryrecyclebin.help.BaseActivity
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlin.random.Random import kotlin.random.Random
...@@ -18,9 +19,14 @@ class PhotoManagerAnimationActivity : BaseActivity<ActivityScreenShotAnimationBi ...@@ -18,9 +19,14 @@ class PhotoManagerAnimationActivity : BaseActivity<ActivityScreenShotAnimationBi
override val binding: ActivityScreenShotAnimationBinding by lazy { override val binding: ActivityScreenShotAnimationBinding by lazy {
ActivityScreenShotAnimationBinding.inflate(layoutInflater) ActivityScreenShotAnimationBinding.inflate(layoutInflater)
} }
;
private var job: Job? = null
override fun initView() { override fun initView() {
lifecycleScope.launch(Dispatchers.Main) {
}
fun jumpJob() = lifecycleScope.launch(Dispatchers.Main) {
delay(Random.nextLong(4000, 4500)) delay(Random.nextLong(4000, 4500))
binding.lottie.visibility = View.INVISIBLE binding.lottie.visibility = View.INVISIBLE
binding.lottieCompleted.visibility = View.VISIBLE binding.lottieCompleted.visibility = View.VISIBLE
...@@ -32,8 +38,6 @@ class PhotoManagerAnimationActivity : BaseActivity<ActivityScreenShotAnimationBi ...@@ -32,8 +38,6 @@ class PhotoManagerAnimationActivity : BaseActivity<ActivityScreenShotAnimationBi
} }
} }
}
override fun initListener() { override fun initListener() {
super.initListener() super.initListener()
onBackPressedDispatcher.addCallback { onBackPressedDispatcher.addCallback {
...@@ -41,4 +45,16 @@ class PhotoManagerAnimationActivity : BaseActivity<ActivityScreenShotAnimationBi ...@@ -41,4 +45,16 @@ class PhotoManagerAnimationActivity : BaseActivity<ActivityScreenShotAnimationBi
} }
} }
override fun onResume() {
super.onResume()
if (job?.isActive == false) {
job = jumpJob()
}
}
override fun onPause() {
super.onPause()
job?.cancel()
}
} }
\ No newline at end of file
...@@ -170,7 +170,9 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() { ...@@ -170,7 +170,9 @@ class FileScanResultActivity : BaseActivity<ActivityFileScanResultBinding>() {
lifecycleScope.launch(Dispatchers.Main) { lifecycleScope.launch(Dispatchers.Main) {
binding.ivWancheng.visibility = View.VISIBLE binding.ivWancheng.visibility = View.VISIBLE
binding.tvScanning.text = "Completed" binding.tvScanning.text = "Completed"
lifecycleScope.launchWhenResumed {
AdmobMaxHelper.admobMaxShowInterstitialAd(this@FileScanResultActivity) AdmobMaxHelper.admobMaxShowInterstitialAd(this@FileScanResultActivity)
}
binding.flEmpty.isVisible = pathList.isEmpty() binding.flEmpty.isVisible = pathList.isEmpty()
setAdapterData(null) setAdapterData(null)
dialogClass.finishScan { dialogClass.finishScan {
......
...@@ -3,9 +3,13 @@ package com.base.filerecoveryrecyclebin.activity.repeat ...@@ -3,9 +3,13 @@ package com.base.filerecoveryrecyclebin.activity.repeat
import android.content.Intent import android.content.Intent
import android.widget.Toast import android.widget.Toast
import androidx.activity.addCallback import androidx.activity.addCallback
import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.databinding.ActivityRepeatAnimationBinding import com.base.filerecoveryrecyclebin.databinding.ActivityRepeatAnimationBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity import com.base.filerecoveryrecyclebin.help.BaseActivity
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlin.random.Random import kotlin.random.Random
class RepeatAnimationActivity : BaseActivity<ActivityRepeatAnimationBinding>() { class RepeatAnimationActivity : BaseActivity<ActivityRepeatAnimationBinding>() {
...@@ -14,14 +18,10 @@ class RepeatAnimationActivity : BaseActivity<ActivityRepeatAnimationBinding>() { ...@@ -14,14 +18,10 @@ class RepeatAnimationActivity : BaseActivity<ActivityRepeatAnimationBinding>() {
ActivityRepeatAnimationBinding.inflate(layoutInflater) ActivityRepeatAnimationBinding.inflate(layoutInflater)
} }
private var job: Job? = null
override fun initView() { override fun initView() {
binding.root.postDelayed({
AdmobMaxHelper.admobMaxShowInterstitialAd(this) {
startActivity(Intent(this, RepeatActivity::class.java))
finish()
}
}, Random.nextLong(3000, 4500))
} }
override fun initListener() { override fun initListener() {
...@@ -30,4 +30,26 @@ class RepeatAnimationActivity : BaseActivity<ActivityRepeatAnimationBinding>() { ...@@ -30,4 +30,26 @@ class RepeatAnimationActivity : BaseActivity<ActivityRepeatAnimationBinding>() {
} }
} }
private fun jumpJob() = lifecycleScope.launch {
delay(Random.nextLong(3000, 4500))
AdmobMaxHelper.admobMaxShowInterstitialAd(this@RepeatAnimationActivity) {
startActivity(Intent(this@RepeatAnimationActivity, RepeatActivity::class.java))
finish()
}
}
override fun onResume() {
super.onResume()
if (job?.isActive == false && job == null) {
job = jumpJob()
}
}
override fun onPause() {
super.onPause()
job?.cancel()
job = null
}
} }
\ No newline at end of file
...@@ -3,10 +3,13 @@ package com.base.filerecoveryrecyclebin.activity.screenshot ...@@ -3,10 +3,13 @@ package com.base.filerecoveryrecyclebin.activity.screenshot
import android.content.Intent import android.content.Intent
import android.widget.Toast import android.widget.Toast
import androidx.activity.addCallback import androidx.activity.addCallback
import com.base.filerecoveryrecyclebin.activity.photomanager.PhotoManagerActivity import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.databinding.ActivityScreenShotAnimationBinding import com.base.filerecoveryrecyclebin.databinding.ActivityScreenShotAnimationBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity import com.base.filerecoveryrecyclebin.help.BaseActivity
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlin.random.Random import kotlin.random.Random
class ScreenShotAnimationActivity : BaseActivity<ActivityScreenShotAnimationBinding>() { class ScreenShotAnimationActivity : BaseActivity<ActivityScreenShotAnimationBinding>() {
...@@ -14,14 +17,18 @@ class ScreenShotAnimationActivity : BaseActivity<ActivityScreenShotAnimationBind ...@@ -14,14 +17,18 @@ class ScreenShotAnimationActivity : BaseActivity<ActivityScreenShotAnimationBind
override val binding: ActivityScreenShotAnimationBinding by lazy { override val binding: ActivityScreenShotAnimationBinding by lazy {
ActivityScreenShotAnimationBinding.inflate(layoutInflater) ActivityScreenShotAnimationBinding.inflate(layoutInflater)
} }
private var job: Job? = null
override fun initView() { override fun initView() {
binding.root.postDelayed({
AdmobMaxHelper.admobMaxShowInterstitialAd(this) { }
startActivity(Intent(this, ScreenShotActivity::class.java))
fun jumpJob() = lifecycleScope.launch {
delay(Random.nextLong(3000, 4500))
AdmobMaxHelper.admobMaxShowInterstitialAd(this@ScreenShotAnimationActivity) {
startActivity(Intent(this@ScreenShotAnimationActivity, ScreenShotActivity::class.java))
finish() finish()
} }
}, Random.nextLong(3000, 4500))
} }
override fun initListener() { override fun initListener() {
...@@ -31,4 +38,17 @@ class ScreenShotAnimationActivity : BaseActivity<ActivityScreenShotAnimationBind ...@@ -31,4 +38,17 @@ class ScreenShotAnimationActivity : BaseActivity<ActivityScreenShotAnimationBind
} }
} }
override fun onResume() {
super.onResume()
if (job?.isActive == false && job == null) {
job = jumpJob()
}
}
override fun onPause() {
super.onPause()
job?.cancel()
job = null
}
} }
\ No newline at end of file
...@@ -9,20 +9,19 @@ import androidx.lifecycle.lifecycleScope ...@@ -9,20 +9,19 @@ import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.databinding.ActivityWhatsAppCleanerAnimationBinding import com.base.filerecoveryrecyclebin.databinding.ActivityWhatsAppCleanerAnimationBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity import com.base.filerecoveryrecyclebin.help.BaseActivity
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlin.random.Random import kotlin.random.Random
class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAnimationBinding>() { class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAnimationBinding>() {
private val animationPath = "whupscan/data.json"
private val imagesPath = "whupscan/images/"
private val nextActivityClass = WhatsAppCleanerActivity::class.java
override val binding: ActivityWhatsAppCleanerAnimationBinding by lazy { override val binding: ActivityWhatsAppCleanerAnimationBinding by lazy {
ActivityWhatsAppCleanerAnimationBinding.inflate(layoutInflater) ActivityWhatsAppCleanerAnimationBinding.inflate(layoutInflater)
} }
private var job: Job? = null
override fun initView() { override fun initView() {
playLottie() playLottie()
} }
...@@ -35,30 +34,37 @@ class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAni ...@@ -35,30 +34,37 @@ class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAni
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun playLottie() { private fun playLottie() {
binding.lottie.imageAssetsFolder = imagesPath binding.lottie.imageAssetsFolder = "junk_scan/images/"
binding.lottie.setAnimation(animationPath) binding.lottie.setAnimation("junk_scan/data.json")
binding.lottie.playAnimation() binding.lottie.playAnimation()
lifecycleScope.launch {
delay(Random.nextLong(3500, 4500))
binding.lottie.cancelAnimation()
binding.lottie.visibility = View.GONE
showCompletionAnimation()
}
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private suspend fun showCompletionAnimation() { fun jumpJob() = lifecycleScope.launch {
delay(Random.nextLong(3500, 4500))
binding.lottie.cancelAnimation()
binding.lottie.visibility = View.GONE
binding.lottieCompleted.visibility = View.VISIBLE binding.lottieCompleted.visibility = View.VISIBLE
binding.lottieCompleted.playAnimation() binding.lottieCompleted.playAnimation()
binding.tv.text = "Completed!" binding.tv.text = "Completed!"
delay(1000) delay(1000)
showAdAndNavigateToNextActivity() AdmobMaxHelper.admobMaxShowInterstitialAd(this@WhatsAppCleanerAnimationActivity) {
startActivity(Intent(this@WhatsAppCleanerAnimationActivity, WhatsAppCleanerActivity::class.java))
finish()
}
} }
private fun showAdAndNavigateToNextActivity() { override fun onResume() {
AdmobMaxHelper.admobMaxShowInterstitialAd(this) { super.onResume()
startActivity(Intent(this, nextActivityClass)) if (job?.isActive == false && job == null) {
finish() job = jumpJob()
} }
} }
override fun onPause() {
super.onPause()
job?.cancel()
job = null
}
} }
\ No newline at end of file
...@@ -268,6 +268,7 @@ public class AdDisplayUtils { ...@@ -268,6 +268,7 @@ public class AdDisplayUtils {
SharedPreferences.Editor editor = prefs.edit(); SharedPreferences.Editor editor = prefs.edit();
editor.putInt(getAdClickCountKey(), adClickCount); editor.putInt(getAdClickCountKey(), adClickCount);
editor.apply(); editor.apply();
LogEx.INSTANCE.logDebug(TAG, "adClickCount=" + adClickCount, false);
} }
//endregion //endregion
......
...@@ -2,11 +2,12 @@ package com.base.filerecoveryrecyclebin.ads.admob ...@@ -2,11 +2,12 @@ package com.base.filerecoveryrecyclebin.ads.admob
import com.base.filerecoveryrecyclebin.ads.AdDisplayUtils import com.base.filerecoveryrecyclebin.ads.AdDisplayUtils
import com.base.filerecoveryrecyclebin.utils.ActivityManagerUtils import com.base.filerecoveryrecyclebin.utils.ActivityManagerUtils
import com.base.filerecoveryrecyclebin.utils.AppPreferences
object AdmobCommonUtils { object AdmobCommonUtils {
private var lastAd: Any? = null private var lastAd: Any? = null
private var maxMultiClick = 4 private var maxMultiClick = AppPreferences.getInstance().getString("maxMultiClick", "10").toInt()
private var multiClick = 0 private var multiClick = 0
fun isMultiClick(currentAd: Any?) { fun isMultiClick(currentAd: Any?) {
if (currentAd == null) { if (currentAd == null) {
......
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