Commit 1a3690c1 authored by maxiaoliang's avatar maxiaoliang

1

parent cb525120
...@@ -12,15 +12,17 @@ import com.test.easy.easycleanerjunk.helps.ConfigHelper ...@@ -12,15 +12,17 @@ import com.test.easy.easycleanerjunk.helps.ConfigHelper
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils
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
class AppManagerAnimationActivity : BaseActivity<ActivityAppManagerAnimationBinding>() { class AppManagerAnimationActivity : BaseActivity<ActivityAppManagerAnimationBinding>() {
override val isLightMode =true
override val binding: ActivityAppManagerAnimationBinding by lazy { override val binding: ActivityAppManagerAnimationBinding by lazy {
ActivityAppManagerAnimationBinding.inflate(layoutInflater) ActivityAppManagerAnimationBinding.inflate(layoutInflater)
} }
private var job: Job? = null
override fun initView() { override fun initView() {
playLottie() playLottie()
...@@ -37,27 +39,38 @@ class AppManagerAnimationActivity : BaseActivity<ActivityAppManagerAnimationBind ...@@ -37,27 +39,38 @@ class AppManagerAnimationActivity : BaseActivity<ActivityAppManagerAnimationBind
binding.lottie.imageAssetsFolder = "easy_app_manager/images/" binding.lottie.imageAssetsFolder = "easy_app_manager/images/"
binding.lottie.setAnimation("easy_app_manager/data.json") binding.lottie.setAnimation("easy_app_manager/data.json")
binding.lottie.playAnimation() 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)
if(ConfigHelper.admobTrueMaxFlase==0){
MaxAdUtils.showInterstitialAd(this@AppManagerAnimationActivity) {
binding.lottie.cancelAnimation()
startActivity(Intent(this@AppManagerAnimationActivity, AppManagerActivity::class.java))
finish()
}
}else{
AdmobUtils.showInterstitialAd(this@AppManagerAnimationActivity) {
binding.lottie.cancelAnimation()
startActivity(Intent(this@AppManagerAnimationActivity, AppManagerActivity::class.java))
finish()
}
}
}
override fun onPause() {
super.onPause()
binding.lottie.pauseAnimation()
job?.cancel()
}
override fun onResume() {
super.onResume()
playLottie()
job = waitJob()
}
private fun waitJob() = lifecycleScope.launch(Dispatchers.Main) {
delay(Random.nextLong(3000, 4500))
binding.lottie.visibility = View.GONE
binding.lottieCompleted.visibility = View.VISIBLE
binding.lottieCompleted.playAnimation()
binding.tv.text = "Completed!"
delay(1000)
if(ConfigHelper.admobTrueMaxFlase==0){
MaxAdUtils.showInterstitialAd(this@AppManagerAnimationActivity) {
binding.lottie.cancelAnimation()
startActivity(Intent(this@AppManagerAnimationActivity, AppManagerActivity::class.java))
finish()
}
}else{
AdmobUtils.showInterstitialAd(this@AppManagerAnimationActivity) {
binding.lottie.cancelAnimation()
startActivity(Intent(this@AppManagerAnimationActivity, AppManagerActivity::class.java))
finish()
}
} }
} }
......
...@@ -17,7 +17,7 @@ import kotlinx.coroutines.launch ...@@ -17,7 +17,7 @@ import kotlinx.coroutines.launch
import kotlin.random.Random import kotlin.random.Random
class BatteryInfoAnimationActivity : BaseActivity<ActivityBatteryInfoAnimationBinding>() { class BatteryInfoAnimationActivity : BaseActivity<ActivityBatteryInfoAnimationBinding>() {
override val isLightMode=true
override val binding: ActivityBatteryInfoAnimationBinding by lazy { override val binding: ActivityBatteryInfoAnimationBinding by lazy {
ActivityBatteryInfoAnimationBinding.inflate(layoutInflater) ActivityBatteryInfoAnimationBinding.inflate(layoutInflater)
} }
......
...@@ -12,8 +12,10 @@ import com.test.easy.easycleanerjunk.helps.ConfigHelper ...@@ -12,8 +12,10 @@ import com.test.easy.easycleanerjunk.helps.ConfigHelper
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils
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
class LargeFileAnimationActivity : BaseActivity<ActivityLargeFileAnimationBinding>() { class LargeFileAnimationActivity : BaseActivity<ActivityLargeFileAnimationBinding>() {
override val isLightMode = true override val isLightMode = true
...@@ -21,7 +23,7 @@ class LargeFileAnimationActivity : BaseActivity<ActivityLargeFileAnimationBindin ...@@ -21,7 +23,7 @@ class LargeFileAnimationActivity : BaseActivity<ActivityLargeFileAnimationBindin
ActivityLargeFileAnimationBinding.inflate(layoutInflater) ActivityLargeFileAnimationBinding.inflate(layoutInflater)
} }
private var job: Job? = null
override fun initView() { override fun initView() {
playLottie() playLottie()
} }
...@@ -31,33 +33,40 @@ class LargeFileAnimationActivity : BaseActivity<ActivityLargeFileAnimationBindin ...@@ -31,33 +33,40 @@ class LargeFileAnimationActivity : BaseActivity<ActivityLargeFileAnimationBindin
Toast.makeText(this@LargeFileAnimationActivity, "wait a moment", Toast.LENGTH_SHORT).show() Toast.makeText(this@LargeFileAnimationActivity, "wait a moment", Toast.LENGTH_SHORT).show()
} }
} }
override fun onPause() {
super.onPause()
binding.lottie.pauseAnimation()
job?.cancel()
}
override fun onResume() {
super.onResume()
playLottie()
job = waitJob()
}
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun playLottie(showFinish: (() -> Unit)? = null) { private fun playLottie() {
binding.lottie.playAnimation()
lifecycleScope.launch(Dispatchers.Main) { }
delay(5000) private fun waitJob() = lifecycleScope.launch(Dispatchers.Main) {
binding.lottie.visibility = View.GONE delay(Random.nextLong(3000, 4500))
binding.lottie.clearAnimation() binding.lottie.visibility = View.GONE
binding.lottieCompleted.visibility = View.VISIBLE binding.lottie.clearAnimation()
binding.lottieCompleted.playAnimation() binding.lottieCompleted.visibility = View.VISIBLE
binding.tv.text = "Completed!" binding.lottieCompleted.playAnimation()
delay(1000) binding.tv.text = "Completed!"
if(ConfigHelper.admobTrueMaxFlase==0){ delay(1000)
MaxAdUtils.showInterstitialAd(this@LargeFileAnimationActivity) { if(ConfigHelper.admobTrueMaxFlase==0){
showFinish?.invoke() MaxAdUtils.showInterstitialAd(this@LargeFileAnimationActivity) {
startActivity(Intent(this@LargeFileAnimationActivity, LargeFileCleanActivity::class.java)) startActivity(Intent(this@LargeFileAnimationActivity, LargeFileCleanActivity::class.java))
finish() finish()
} }
}else{ }else{
AdmobUtils.showInterstitialAd(this@LargeFileAnimationActivity) { AdmobUtils.showInterstitialAd(this@LargeFileAnimationActivity) {
showFinish?.invoke() startActivity(Intent(this@LargeFileAnimationActivity, LargeFileCleanActivity::class.java))
startActivity(Intent(this@LargeFileAnimationActivity, LargeFileCleanActivity::class.java)) finish()
finish()
}
} }
} }
} }
} }
\ No newline at end of file
package com.test.easy.easycleanerjunk.activity.photocompress.photo package com.test.easy.easycleanerjunk.activity.photocompress.photo
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 android.view.View
...@@ -11,10 +10,14 @@ import androidx.lifecycle.lifecycleScope ...@@ -11,10 +10,14 @@ import androidx.lifecycle.lifecycleScope
import com.test.easy.easycleanerjunk.databinding.ActivityStartCompressionPhotoBinding import com.test.easy.easycleanerjunk.databinding.ActivityStartCompressionPhotoBinding
import com.test.easy.easycleanerjunk.helps.BaseActivity import com.test.easy.easycleanerjunk.helps.BaseActivity
import com.test.easy.easycleanerjunk.helps.ConfigHelper import com.test.easy.easycleanerjunk.helps.ConfigHelper
import com.test.easy.easycleanerjunk.helps.PermissionHelp.checkStorePermission
import com.test.easy.easycleanerjunk.helps.PermissionHelp.requestStorePermission
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils
import com.test.easy.easycleanerjunk.utils.BarUtils import com.test.easy.easycleanerjunk.utils.BarUtils
import com.test.easy.easycleanerjunk.view.DialogViews.showGerPermission
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
...@@ -26,7 +29,7 @@ class StartCompressionPhotoActivity : BaseActivity<ActivityStartCompressionPhoto ...@@ -26,7 +29,7 @@ class StartCompressionPhotoActivity : BaseActivity<ActivityStartCompressionPhoto
ActivityStartCompressionPhotoBinding.inflate(layoutInflater) ActivityStartCompressionPhotoBinding.inflate(layoutInflater)
} }
private var job: Job? = null
override fun initView() { override fun initView() {
BarUtils.setStatusBarColor(this, Color.TRANSPARENT) BarUtils.setStatusBarColor(this, Color.TRANSPARENT)
binding.root.updatePadding(top = BarUtils.getStatusBarHeight()) binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
...@@ -36,69 +39,76 @@ class StartCompressionPhotoActivity : BaseActivity<ActivityStartCompressionPhoto ...@@ -36,69 +39,76 @@ class StartCompressionPhotoActivity : BaseActivity<ActivityStartCompressionPhoto
Toast.makeText(this@StartCompressionPhotoActivity, "wait a moment", Toast.LENGTH_SHORT).show() Toast.makeText(this@StartCompressionPhotoActivity, "wait a moment", Toast.LENGTH_SHORT).show()
} }
}) })
if (!checkStorePermission()) {
showGerPermission(
deny = { finishToMain() },
allow = {
requestStorePermission(launcher, result = {
if (it) {
} else {
finishToMain()
}
})
})
}
} }
override fun onStart() { override fun onPause() {
super.onStart() super.onPause()
checkPermission() binding.lottie.pauseAnimation()
job?.cancel()
} }
var isplay = 0 override fun onResume() {
override fun onPermissionsResult(isGranted: Boolean) { super.onResume()
if (isGranted) { if (checkStorePermission()) {
isplay += 1 resumeLottie()
if (isplay == 1) { job = waitJob()
playLottie()
}
} else {
finishToMain()
} }
} }
private fun resumeLottie() {
@SuppressLint("SetTextI18n")
private fun playLottie() {
binding.lottie.imageAssetsFolder = "easy_imgcompress/images/" binding.lottie.imageAssetsFolder = "easy_imgcompress/images/"
binding.lottie.setAnimation("easy_imgcompress/data.json") binding.lottie.setAnimation("easy_imgcompress/data.json")
binding.lottie.playAnimation() binding.lottie.playAnimation()
}
lifecycleScope.launch(Dispatchers.Main) { private fun waitJob() = lifecycleScope.launch(Dispatchers.Main) {
delay(Random.nextLong(2500, 4000))
delay(Random.nextLong(2500, 4000)) val aContext = this@StartCompressionPhotoActivity
val aContext = this@StartCompressionPhotoActivity binding.lottie.cancelAnimation()
binding.lottie.cancelAnimation() binding.lottie.visibility = View.GONE
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) if(ConfigHelper.admobTrueMaxFlase==0){
if(ConfigHelper.admobTrueMaxFlase==0){ MaxAdUtils.showInterstitialAd(aContext) {
MaxAdUtils.showInterstitialAd(aContext) { val mList = ImagesMediaUtils.getAlbums(aContext)
val mList = ImagesMediaUtils.getAlbums(aContext) if (mList.isNotEmpty()) {
if (mList.isNotEmpty()) { startActivity(Intent(aContext, CompressionPhotoListActivity::class.java))
startActivity(Intent(aContext, CompressionPhotoListActivity::class.java)) finish()
finish() } else {
} else { startActivity(Intent(aContext, CompressionPhotoListActivity::class.java))
startActivity(Intent(aContext, CompressionPhotoListActivity::class.java)) finish()
finish()
}
} }
}else{ }
AdmobUtils.showInterstitialAd(aContext) { }else{
val mList = ImagesMediaUtils.getAlbums(aContext) AdmobUtils.showInterstitialAd(aContext) {
if (mList.isNotEmpty()) { val mList = ImagesMediaUtils.getAlbums(aContext)
startActivity(Intent(aContext, CompressionPhotoListActivity::class.java)) if (mList.isNotEmpty()) {
finish() startActivity(Intent(aContext, CompressionPhotoListActivity::class.java))
} else { finish()
startActivity(Intent(aContext, CompressionPhotoListActivity::class.java)) } else {
finish() startActivity(Intent(aContext, CompressionPhotoListActivity::class.java))
} finish()
} }
} }
} }
} }
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
binding.lottie.clearAnimation() binding.lottie.clearAnimation()
......
package com.test.easy.easycleanerjunk.activity.screenshot package com.test.easy.easycleanerjunk.activity.screenshot
import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.view.View import android.view.View
import android.widget.Toast import android.widget.Toast
...@@ -12,6 +11,7 @@ import com.test.easy.easycleanerjunk.helps.ConfigHelper ...@@ -12,6 +11,7 @@ import com.test.easy.easycleanerjunk.helps.ConfigHelper
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils
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
...@@ -22,9 +22,9 @@ class ScreenShotAnimationActivity : BaseActivity<ActivityScreenShotAnimationBind ...@@ -22,9 +22,9 @@ 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() {
playLottie()
} }
override fun initListener() { override fun initListener() {
...@@ -38,35 +38,43 @@ class ScreenShotAnimationActivity : BaseActivity<ActivityScreenShotAnimationBind ...@@ -38,35 +38,43 @@ class ScreenShotAnimationActivity : BaseActivity<ActivityScreenShotAnimationBind
} }
@SuppressLint("SetTextI18n") override fun onPause() {
private fun playLottie() { super.onPause()
binding.lottie.pauseAnimation()
job?.cancel()
}
override fun onResume() {
super.onResume()
resumeLottie()
job = waitJob()
}
fun resumeLottie(){
binding.lottie.imageAssetsFolder = "easy_imgcompress/images/" binding.lottie.imageAssetsFolder = "easy_imgcompress/images/"
binding.lottie.setAnimation("easy_imgcompress/data.json") binding.lottie.setAnimation("easy_imgcompress/data.json")
binding.lottie.playAnimation() binding.lottie.playAnimation()
lifecycleScope.launch(Dispatchers.Main) { }
delay(Random.nextLong(2500, 4000)) private fun waitJob() = lifecycleScope.launch(Dispatchers.Main) {
binding.lottie.cancelAnimation() delay(Random.nextLong(3000, 4500))
binding.lottie.visibility = View.GONE delay(Random.nextLong(2500, 4000))
binding.lottieCompleted.visibility = View.VISIBLE binding.lottie.cancelAnimation()
binding.lottieCompleted.playAnimation() binding.lottie.visibility = View.GONE
binding.tv.text = "Completed!" binding.lottieCompleted.visibility = View.VISIBLE
delay(1000) binding.lottieCompleted.playAnimation()
if(ConfigHelper.admobTrueMaxFlase==0){ binding.tv.text = "Completed!"
MaxAdUtils.showInterstitialAd(this@ScreenShotAnimationActivity) { delay(1000)
startActivity(Intent(this@ScreenShotAnimationActivity, ScreenShotActivity::class.java)) if(ConfigHelper.admobTrueMaxFlase==0){
finish() MaxAdUtils.showInterstitialAd(this@ScreenShotAnimationActivity) {
} startActivity(Intent(this@ScreenShotAnimationActivity, ScreenShotActivity::class.java))
}else{ finish()
AdmobUtils.showInterstitialAd(this@ScreenShotAnimationActivity) { }
startActivity(Intent(this@ScreenShotAnimationActivity, ScreenShotActivity::class.java)) }else{
finish() AdmobUtils.showInterstitialAd(this@ScreenShotAnimationActivity) {
} startActivity(Intent(this@ScreenShotAnimationActivity, ScreenShotActivity::class.java))
finish()
} }
} }
} }
} }
\ No newline at end of file
...@@ -12,6 +12,7 @@ import com.test.easy.easycleanerjunk.helps.ConfigHelper ...@@ -12,6 +12,7 @@ import com.test.easy.easycleanerjunk.helps.ConfigHelper
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils
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
...@@ -21,32 +22,12 @@ class RepeatPhotoAnimationActivity : BaseActivity<ActivityRepeatPhotoAnimationBi ...@@ -21,32 +22,12 @@ class RepeatPhotoAnimationActivity : BaseActivity<ActivityRepeatPhotoAnimationBi
override val binding: ActivityRepeatPhotoAnimationBinding by lazy { override val binding: ActivityRepeatPhotoAnimationBinding by lazy {
ActivityRepeatPhotoAnimationBinding.inflate(layoutInflater) ActivityRepeatPhotoAnimationBinding.inflate(layoutInflater)
} }
private var job: Job? = null
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun initView() { override fun initView() {
lifecycleScope.launch(Dispatchers.Main) { resumeLottie()
delay(Random.nextLong(2500, 4000))
binding.lottie.cancelAnimation()
binding.lottie.visibility = View.GONE
binding.lottieCompleted.visibility = View.VISIBLE
binding.lottieCompleted.playAnimation()
binding.tv.text = "Completed!"
delay(1000)
if(ConfigHelper.admobTrueMaxFlase==0){
MaxAdUtils.showInterstitialAd(this@RepeatPhotoAnimationActivity){
startActivity(Intent(this@RepeatPhotoAnimationActivity, RepeatPhotoActivity::class.java))
finish()
}
}else{
AdmobUtils.showInterstitialAd(this@RepeatPhotoAnimationActivity){
startActivity(Intent(this@RepeatPhotoAnimationActivity, RepeatPhotoActivity::class.java))
finish()
}
}
}
} }
override fun initListener() { override fun initListener() {
...@@ -54,5 +35,39 @@ class RepeatPhotoAnimationActivity : BaseActivity<ActivityRepeatPhotoAnimationBi ...@@ -54,5 +35,39 @@ class RepeatPhotoAnimationActivity : BaseActivity<ActivityRepeatPhotoAnimationBi
Toast.makeText(this@RepeatPhotoAnimationActivity, "wait a moment", Toast.LENGTH_SHORT).show() Toast.makeText(this@RepeatPhotoAnimationActivity, "wait a moment", Toast.LENGTH_SHORT).show()
} }
} }
override fun onPause() {
super.onPause()
binding.lottie.pauseAnimation()
job?.cancel()
}
override fun onResume() {
super.onResume()
resumeLottie()
job = waitJob()
}
fun resumeLottie(){
binding.lottie.playAnimation()
}
private fun waitJob() = lifecycleScope.launch(Dispatchers.Main) {
delay(Random.nextLong(3000, 4500))
binding.lottie.cancelAnimation()
binding.lottie.visibility = View.GONE
binding.lottieCompleted.visibility = View.VISIBLE
binding.lottieCompleted.playAnimation()
binding.tv.text = "Completed!"
delay(1000)
if(ConfigHelper.admobTrueMaxFlase==0){
MaxAdUtils.showInterstitialAd(this@RepeatPhotoAnimationActivity){
startActivity(Intent(this@RepeatPhotoAnimationActivity, RepeatPhotoActivity::class.java))
finish()
}
}else{
AdmobUtils.showInterstitialAd(this@RepeatPhotoAnimationActivity){
startActivity(Intent(this@RepeatPhotoAnimationActivity, RepeatPhotoActivity::class.java))
finish()
}
}
}
} }
\ No newline at end of file
package com.test.easy.easycleanerjunk.activity.whatsapp package com.test.easy.easycleanerjunk.activity.whatsapp
import android.annotation.SuppressLint
import android.content.Intent import android.content.Intent
import android.view.View import android.view.View
import android.widget.Toast import android.widget.Toast
...@@ -11,6 +10,8 @@ import com.test.easy.easycleanerjunk.helps.BaseActivity ...@@ -11,6 +10,8 @@ import com.test.easy.easycleanerjunk.helps.BaseActivity
import com.test.easy.easycleanerjunk.helps.ConfigHelper import com.test.easy.easycleanerjunk.helps.ConfigHelper
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils
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
...@@ -20,9 +21,9 @@ class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAni ...@@ -20,9 +21,9 @@ class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAni
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() resumeLottie()
} }
override fun initListener() { override fun initListener() {
...@@ -31,31 +32,40 @@ class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAni ...@@ -31,31 +32,40 @@ class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAni
} }
} }
@SuppressLint("SetTextI18n") override fun onPause() {
private fun playLottie() { super.onPause()
binding.lottie.pauseAnimation()
job?.cancel()
}
override fun onResume() {
super.onResume()
resumeLottie()
job = waitJob()
}
fun resumeLottie(){
binding.lottie.imageAssetsFolder = "easy_junk_scan/images/" binding.lottie.imageAssetsFolder = "easy_junk_scan/images/"
binding.lottie.setAnimation("easy_junk_scan/data.json") binding.lottie.setAnimation("easy_junk_scan/data.json")
binding.lottie.playAnimation() binding.lottie.playAnimation()
lifecycleScope.launch { }
delay(Random.nextLong(3500, 4500)) private fun waitJob() = lifecycleScope.launch(Dispatchers.Main) {
binding.lottie.cancelAnimation() delay(Random.nextLong(3000, 4500))
binding.lottie.visibility = View.GONE binding.lottie.cancelAnimation()
binding.lottieCompleted.visibility = View.VISIBLE binding.lottie.visibility = View.GONE
binding.lottieCompleted.playAnimation() binding.lottieCompleted.visibility = View.VISIBLE
binding.tv.text="Completed!" binding.lottieCompleted.playAnimation()
delay(1000) binding.tv.text="Completed!"
if(ConfigHelper.admobTrueMaxFlase==0){ delay(1000)
MaxAdUtils.showInterstitialAd(this@WhatsAppCleanerAnimationActivity) { if(ConfigHelper.admobTrueMaxFlase==0){
startActivity(Intent(this@WhatsAppCleanerAnimationActivity, WhatsAppCleanerActivity::class.java)) MaxAdUtils.showInterstitialAd(this@WhatsAppCleanerAnimationActivity) {
finish() startActivity(Intent(this@WhatsAppCleanerAnimationActivity, WhatsAppCleanerActivity::class.java))
} finish()
}else{ }
AdmobUtils.showInterstitialAd(this@WhatsAppCleanerAnimationActivity) { }else{
startActivity(Intent(this@WhatsAppCleanerAnimationActivity, WhatsAppCleanerActivity::class.java)) AdmobUtils.showInterstitialAd(this@WhatsAppCleanerAnimationActivity) {
finish() startActivity(Intent(this@WhatsAppCleanerAnimationActivity, WhatsAppCleanerActivity::class.java))
} finish()
} }
} }
} }
......
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