Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.view.View
import android.view.WindowManager
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.ViewPropertyAnimatorCompat
import com.duckduckgo.app.browser.R
import com.duckduckgo.app.global.view.html
import kotlinx.android.synthetic.main.include_dax_dialog_cta.*
Expand All @@ -33,6 +34,8 @@ import kotlinx.android.synthetic.main.content_onboarding_welcome.longDescription
class WelcomePage : OnboardingPageFragment() {

private var ctaText: String = ""
private var welcomeAnimation: ViewPropertyAnimatorCompat? = null
private var typingAnimation: ViewPropertyAnimatorCompat? = null

override fun layoutResource(): Int = R.layout.content_onboarding_welcome

Expand All @@ -50,6 +53,12 @@ class WelcomePage : OnboardingPageFragment() {
applyFullScreenFlags()
}

override fun onDestroy() {
super.onDestroy()
welcomeAnimation?.cancel()
typingAnimation?.cancel()
}

private fun applyFullScreenFlags() {
activity?.window?.apply {
clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
Expand All @@ -74,12 +83,12 @@ class WelcomePage : OnboardingPageFragment() {
}

private fun beginWelcomeAnimation(ctaText: String) {
ViewCompat.animate(welcomeContent as View)
welcomeAnimation = ViewCompat.animate(welcomeContent as View)
.alpha(MIN_ALPHA)
.setDuration(ANIMATION_DURATION)
.setStartDelay(ANIMATION_DELAY)
.withEndAction {
ViewCompat.animate(daxCtaContainer)
typingAnimation = ViewCompat.animate(daxCtaContainer)
.alpha(MAX_ALPHA)
.setDuration(ANIMATION_DURATION)
.withEndAction {
Expand Down