Skip to content

Commit

Permalink
pref: LeastAnimationStateChangedHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
liangjingkanji committed Oct 27, 2022
1 parent c38d9c8 commit 968a450
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import com.drake.statelayout.Status
*
* @param leastDuration 至少显示动画多长时间, 如果为null则至少显示动画完整播放一次的时间
*/
open class LeastAnimationStateChangedHandler(var leastDuration: Long? = null) :
open class LeastAnimationStateChangedHandler(private val leastDuration: Long? = null) :
StateChangedHandler {

/** 加载状态开始时间 */
Expand All @@ -42,7 +42,7 @@ open class LeastAnimationStateChangedHandler(var leastDuration: Long? = null) :
val animation = state.findViewById<LottieAnimationView>(R.id.lottie)
animation?.addAnimatorUpdateListener {
val duration = System.currentTimeMillis() - loadingStartTime
if (duration >= leastDuration ?: it.duration) {
if (duration >= (leastDuration ?: it.duration)) {
animationPlaying = false
animation.cancelAnimation()
animation.removeAllUpdateListeners()
Expand Down

0 comments on commit 968a450

Please sign in to comment.