Commit 30068861 authored by wanglei's avatar wanglei

...

parent 77f8f722
package com.test.easy.easycleanerjunk.activity.whatsapp
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.Toast
import androidx.activity.addCallback
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.test.easy.easycleanerjunk.R
import com.test.easy.easycleanerjunk.databinding.ActivityWhatsAppCleanerAnimationBinding
import com.test.easy.easycleanerjunk.helps.BaseActivity
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
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()
}
}
private fun playLottie() {
binding.flLottie.visibility = View.VISIBLE
binding.flLottie.setOnClickListener { }
binding.lottie.imageAssetsFolder = "easy_junk_scan/images/"
binding.lottie.setAnimation("easy_junk_scan/data.json")
binding.lottie.playAnimation()
binding.root.postDelayed({
AdmobUtils.showInterstitialAd(this) {
binding.lottie.cancelAnimation()
binding.flLottie.visibility = View.GONE
startActivity(Intent(this@WhatsAppCleanerAnimationActivity, WhatsAppCleanerActivity::class.java))
finish()
}
}, Random.nextLong(3500, 4500))
}
}
\ 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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.whatsapp.WhatsAppCleanerAnimationActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/fl_lottie"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:visibility="gone">
<com.test.easy.easycleanerjunk.view.XmlLottieAnimationView
android:id="@+id/lottie"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.3"
app:lottie_autoPlay="true"
app:lottie_loop="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginBottom="295dp"
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>
</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