Commit de9bf7bd authored by wanglei's avatar wanglei

...whatsapp

parent 45158310
package com.base.filerecoveryrecyclebin.activity.whatsapp
import android.annotation.SuppressLint
import android.content.Intent
import android.view.View
import android.widget.Toast
import androidx.activity.addCallback
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.delay
import kotlinx.coroutines.launch
import kotlin.random.Random
class WhatsAppCleanerAnimationActivity : BaseActivity<ActivityWhatsAppCleanerAnimationBinding>() {
override val binding: ActivityWhatsAppCleanerAnimationBinding by lazy {
ActivityWhatsAppCleanerAnimationBinding.inflate(layoutInflater)
}
override fun initView() {
playLottie()
}
override fun initListener() {
onBackPressedDispatcher.addCallback {
Toast.makeText(this@WhatsAppCleanerAnimationActivity, "wait a moment", Toast.LENGTH_SHORT).show()
}
}
@SuppressLint("SetTextI18n")
private fun playLottie() {
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
binding.lottieCompleted.visibility = View.VISIBLE
binding.lottieCompleted.playAnimation()
binding.tv.text = "Completed!"
delay(1000)
AdmobMaxHelper.admobMaxShowInterstitialAd(this@WhatsAppCleanerAnimationActivity) {
startActivity(Intent(this@WhatsAppCleanerAnimationActivity, WhatsAppCleanerActivity::class.java))
finish()
}
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<FrameLayout
android:id="@+id/id_top_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/id_tv_title_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="WhatsApp Cleaner"
android:textColor="#333333"
android:textSize="18sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</FrameLayout>
<FrameLayout
android:layout_width="300dp"
android:layout_height="300dp"
app:layout_constraintBottom_toTopOf="@id/tv"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.65">
<com.base.filerecoveryrecyclebin.view.XmlLottieAnimationView
android:id="@+id/lottie"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
app:lottie_autoPlay="true"
app:lottie_loop="true" />
<com.base.filerecoveryrecyclebin.view.XmlLottieAnimationView
android:id="@+id/lottie_completed"
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_gravity="center"
android:visibility="gone"
app:lottie_autoPlay="false"
app:lottie_rawRes="@raw/loading_completed" />
</FrameLayout>
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="275dp"
android:text="Wait a moment..."
android:textColor="#333333"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="HardcodedText" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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