@@ -23,6 +23,7 @@ import android.view.View
2323import android.view.WindowManager
2424import androidx.core.content.ContextCompat
2525import androidx.core.view.ViewCompat
26+ import androidx.core.view.ViewPropertyAnimatorCompat
2627import com.duckduckgo.app.browser.R
2728import com.duckduckgo.app.global.view.html
2829import kotlinx.android.synthetic.main.include_dax_dialog_cta.*
@@ -33,6 +34,8 @@ import kotlinx.android.synthetic.main.content_onboarding_welcome.longDescription
3334class WelcomePage : OnboardingPageFragment () {
3435
3536 private var ctaText: String = " "
37+ private var welcomeAnimation: ViewPropertyAnimatorCompat ? = null
38+ private var typingAnimation: ViewPropertyAnimatorCompat ? = null
3639
3740 override fun layoutResource (): Int = R .layout.content_onboarding_welcome
3841
@@ -50,6 +53,12 @@ class WelcomePage : OnboardingPageFragment() {
5053 applyFullScreenFlags()
5154 }
5255
56+ override fun onDestroy () {
57+ super .onDestroy()
58+ welcomeAnimation?.cancel()
59+ typingAnimation?.cancel()
60+ }
61+
5362 private fun applyFullScreenFlags () {
5463 activity?.window?.apply {
5564 clearFlags(WindowManager .LayoutParams .FLAG_TRANSLUCENT_STATUS )
@@ -74,12 +83,12 @@ class WelcomePage : OnboardingPageFragment() {
7483 }
7584
7685 private fun beginWelcomeAnimation (ctaText : String ) {
77- ViewCompat .animate(welcomeContent as View )
86+ welcomeAnimation = ViewCompat .animate(welcomeContent as View )
7887 .alpha(MIN_ALPHA )
7988 .setDuration(ANIMATION_DURATION )
8089 .setStartDelay(ANIMATION_DELAY )
8190 .withEndAction {
82- ViewCompat .animate(daxCtaContainer)
91+ typingAnimation = ViewCompat .animate(daxCtaContainer)
8392 .alpha(MAX_ALPHA )
8493 .setDuration(ANIMATION_DURATION )
8594 .withEndAction {
0 commit comments