Commit f97231ab authored by wanglei's avatar wanglei

...

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