@@ -1144,6 +1144,8 @@ sealed class DaxBubbleCta(
11441144) : Cta, ViewCta, DaxCta {
11451145
11461146 var isModifiedControlOnboardingExperimentEnabled: Boolean? = null
1147+ private var buckAnimators: List <ViewPropertyAnimator > = emptyList()
1148+ private var bbAnimators: List <ViewPropertyAnimator > = emptyList()
11471149
11481150 protected var ctaView: View ? = null
11491151
@@ -1326,13 +1328,13 @@ sealed class DaxBubbleCta(
13261328 val afterAnimation = {
13271329 daxBubbleDialogTitle.finishAnimation()
13281330 dialogTextCta.finishAnimation()
1329- placeholder?.let { placeholderImageView.fadeIn() }
1330- primaryCta.fadeIn()
1331- secondaryCta.fadeIn()
1331+ placeholder?.let { bbAnimators + = placeholderImageView.fadeIn() }
1332+ bbAnimators + = primaryCta.fadeIn()
1333+ bbAnimators + = secondaryCta.fadeIn()
13321334 options?.let {
13331335 optionsViews.forEachIndexed { index, buttonView ->
13341336 if (it.size > index) {
1335- buttonView.fadeIn()
1337+ bbAnimators + = buttonView.fadeIn()
13361338 }
13371339 }
13381340 }
@@ -1357,9 +1359,9 @@ sealed class DaxBubbleCta(
13571359 }
13581360 }
13591361
1360- root.fadeIn().setStartDelay(500 ).withEndAction {
1362+ bbAnimators + = root.fadeIn().setStartDelay(500 ).withEndAction {
13611363 if (configuration is DaxEndCta ) {
1362- headerImage.fadeIn().withEndAction {
1364+ bbAnimators + = headerImage.fadeIn().withEndAction {
13631365 runTypingAnimations()
13641366 }
13651367 } else {
@@ -1455,13 +1457,13 @@ sealed class DaxBubbleCta(
14551457
14561458 val afterAnimation = {
14571459 dialogTextCta.finishAnimation()
1458- placeholder?.let { placeholderImageView.fadeIn() }
1459- primaryCta.fadeIn()
1460- secondaryCta.fadeIn()
1460+ placeholder?.let { buckAnimators + = placeholderImageView.fadeIn() }
1461+ buckAnimators + = primaryCta.fadeIn()
1462+ buckAnimators + = secondaryCta.fadeIn()
14611463 options?.let {
14621464 optionsViews.forEachIndexed { index, buttonView ->
14631465 if (it.size > index) {
1464- buttonView.fadeIn()
1466+ buckAnimators + = buttonView.fadeIn()
14651467 }
14661468 }
14671469 }
@@ -1472,8 +1474,8 @@ sealed class DaxBubbleCta(
14721474 with (buckOnboardingDialogView) {
14731475 animateEntrance(
14741476 onAnimationEnd = {
1475- daxDialogDismissButton.fadeIn()
1476- daxBubbleDialogTitle.fadeIn()
1477+ buckAnimators + = daxDialogDismissButton.fadeIn()
1478+ buckAnimators + = daxBubbleDialogTitle.fadeIn()
14771479 .withEndAction {
14781480 dialogTextCta.startTypingAnimation(daxText, true ) {
14791481 afterAnimation()
@@ -1508,17 +1510,33 @@ sealed class DaxBubbleCta(
15081510
15091511 private fun clearBubbleBuckDialog (binding : IncludeOnboardingBubbleBuckDialogBinding ) {
15101512 binding.apply {
1513+ buckAnimators.forEach { it.cancel() }
1514+ buckAnimators = emptyList()
1515+ daxBubbleDialogTitle.text = " "
1516+ dialogTextCta.cancelAnimation()
1517+ dialogTextCta.text = " "
15111518 this .daxDialogDismissButton.alpha = 0f
15121519 this .primaryCta.gone()
1520+ this .primaryCta.alpha = 0f
15131521 this .secondaryCta.gone()
1522+ this .secondaryCta.alpha = 0f
1523+ this .daxDialogOption1.alpha = 0f
15141524 this .daxDialogOption1.gone()
1525+ this .daxDialogOption2.alpha = 0f
15151526 this .daxDialogOption2.gone()
1527+ this .daxDialogOption3.alpha = 0f
15161528 this .daxDialogOption3.gone()
15171529 }
15181530 }
15191531
15201532 private fun clearBubbleBBDialog (binding : IncludeOnboardingBubbleBbDialogBinding ) {
15211533 binding.apply {
1534+ bbAnimators.forEach { it.cancel() }
1535+ bbAnimators = emptyList()
1536+ daxBubbleDialogTitle.cancelAnimation()
1537+ daxBubbleDialogTitle.text = " "
1538+ dialogTextCta.cancelAnimation()
1539+ dialogTextCta.text = " "
15221540 primaryCta.alpha = 0f
15231541 primaryCta.gone()
15241542 secondaryCta.alpha = 0f
0 commit comments