fix(android): avoid null pointer before bouncing RefreshWrapper

This commit is contained in:
stevezhuo
2020-10-13 14:54:11 +08:00
committed by siguangli
parent 06044610f8
commit 43c2fb5636
@@ -96,15 +96,17 @@ public class RefreshWrapper extends HippyViewGroup
void bounceToHead(float toTransY)
{
Animator contentAnimator = ObjectAnimator.ofFloat(mContentView, "TranslationY", mContentView.getTranslationY(), toTransY);
contentAnimator.setDuration(mBounceTime);
contentAnimator.setInterpolator(new AccelerateInterpolator());
Animator wrapperAnimator = ObjectAnimator.ofFloat(mRefreshWrapperItemView, "TranslationY", mRefreshWrapperItemView.getTranslationY(),
toTransY);
wrapperAnimator.setInterpolator(new AccelerateInterpolator());
wrapperAnimator.setDuration(mBounceTime);
contentAnimator.start();
wrapperAnimator.start();
if (mContentView != null && mRefreshWrapperItemView != null) {
Animator contentAnimator = ObjectAnimator.ofFloat(mContentView, "TranslationY", mContentView.getTranslationY(), toTransY);
contentAnimator.setDuration(mBounceTime);
contentAnimator.setInterpolator(new AccelerateInterpolator());
Animator wrapperAnimator = ObjectAnimator.ofFloat(mRefreshWrapperItemView, "TranslationY", mRefreshWrapperItemView.getTranslationY(),
toTransY);
wrapperAnimator.setInterpolator(new AccelerateInterpolator());
wrapperAnimator.setDuration(mBounceTime);
contentAnimator.start();
wrapperAnimator.start();
}
}