Skip to content

Commit

Permalink
[优化] 仅避免重复succes状态
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhao-Yan-Yan committed Mar 6, 2021
1 parent b46f463 commit 0e592f3
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,17 @@ class MultiStateContainer : FrameLayout {

@JvmOverloads
fun <T : MultiState> show(multiState: T, enableAnimator: Boolean = true, onNotifyListener: OnNotifyListener<T>? = null) {

if (lastState == multiState.javaClass.name) {
return
}

lastState = multiState.javaClass.name

if (childCount == 0) {
initialization()
}
if (childCount > 1) {
removeViewAt(1)
}
if (lastState == SuccessState::class.java.name) {
return
} else {
lastState = multiState.javaClass.name
}
if (multiState is SuccessState) {
originTargetView?.visibility = View.VISIBLE
originTargetView?.executeAnimator()
Expand Down

0 comments on commit 0e592f3

Please sign in to comment.