From c32cfdeda6ea307e225f17e24db81e206a28ca1f Mon Sep 17 00:00:00 2001 From: Tangem Date: Sat, 22 Oct 2022 18:18:19 +0500 Subject: [PATCH] Updated on 2026-08-14 --- .../toggleWidget/RefreshBalanceWidget.kt | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/com/tangem/tap/common/toggleWidget/RefreshBalanceWidget.kt b/app/src/main/java/com/tangem/tap/common/toggleWidget/RefreshBalanceWidget.kt index 277f839c05..7bccdffc08 100644 --- a/app/src/main/java/com/tangem/tap/common/toggleWidget/RefreshBalanceWidget.kt +++ b/app/src/main/java/com/tangem/tap/common/toggleWidget/RefreshBalanceWidget.kt @@ -2,7 +2,14 @@ package com.tangem.tap.common.toggleWidget import android.view.View import android.view.ViewGroup -import android.view.animation.* +import android.view.animation.AccelerateInterpolator +import android.view.animation.AlphaAnimation +import android.view.animation.Animation +import android.view.animation.AnimationSet +import android.view.animation.AnticipateOvershootInterpolator +import android.view.animation.LinearInterpolator +import android.view.animation.RotateAnimation +import android.view.animation.ScaleAnimation import android.widget.ViewSwitcher import com.tangem.tap.features.wallet.redux.ProgressState import com.tangem.wallet.R @@ -11,7 +18,7 @@ import com.tangem.wallet.R [REDACTED_AUTHOR] */ class RefreshBalanceWidget( - private val root: ViewGroup + private val root: ViewGroup, ) : ViewStateWidget { var isShowing: Boolean? = null @@ -19,7 +26,6 @@ class RefreshBalanceWidget( override val mainView: View = root.findViewById(R.id.btn_refresh_balance) - private val viewSwitcher: ViewSwitcher by lazy { mainView.findViewById(R.id.switcher_refresh_arrow_to_progress) } private val arrowView = mainView.findViewById(R.id.imv_arrow_refresh) @@ -46,6 +52,7 @@ class RefreshBalanceWidget( currentStateByView == ProgressState.Done -> if (progressState == ProgressState.Error) return } + mainView.isClickable = currentStateByView == ProgressState.Done || currentStateByView == ProgressState.Error animateState(progressState) viewSwitcher.showNext() } @@ -60,7 +67,7 @@ class RefreshBalanceWidget( progressViewAnimation = RotateAnimation( 0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, - Animation.RELATIVE_TO_SELF, 0.5f + Animation.RELATIVE_TO_SELF, 0.5f, ) progressViewAnimation?.duration = 700 progressViewAnimation?.interpolator = AccelerateInterpolator() @@ -88,11 +95,13 @@ class RefreshBalanceWidget( class ShowAnimation : AnimationSet(true) { init { - addAnimation(ScaleAnimation( - 0f, 1f, - 0f, 1f, - Animation.RELATIVE_TO_SELF, 0.5f, - Animation.RELATIVE_TO_SELF, 0.5f) + addAnimation( + ScaleAnimation( + 0f, 1f, + 0f, 1f, + Animation.RELATIVE_TO_SELF, 0.5f, + Animation.RELATIVE_TO_SELF, 0.5f, + ), ) addAnimation(AlphaAnimation(0f, 1f)) duration = 300