diff --git a/circlerefresh/src/main/java/com/tuesda/walker/circlerefresh/CircleRefreshLayout.java b/circlerefresh/src/main/java/com/tuesda/walker/circlerefresh/CircleRefreshLayout.java index cc8e8fe..1475271 100644 --- a/circlerefresh/src/main/java/com/tuesda/walker/circlerefresh/CircleRefreshLayout.java +++ b/circlerefresh/src/main/java/com/tuesda/walker/circlerefresh/CircleRefreshLayout.java @@ -253,8 +253,33 @@ public void finishRefreshing() { } mIsRefreshing = false; mHeader.setRefreshing(false); + + back(); } + public boolean isRefreshing() { + return mIsRefreshing; + } + + private void back() { + float height = mChildView.getTranslationY(); + ValueAnimator backTopAni = ValueAnimator.ofFloat(height, 0); + backTopAni.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { + @Override + public void onAnimationUpdate(ValueAnimator animation) { + float val = (float) animation.getAnimatedValue(); + val = decelerateInterpolator.getInterpolation(val / mHeaderHeight) * val; + if (mChildView != null) { + mChildView.setTranslationY(val); + } + mHeader.getLayoutParams().height = (int) val; + mHeader.requestLayout(); + } + }); + backTopAni.setDuration((long) (height * BACK_TOP_DUR / mHeaderHeight)); + backTopAni.start(); + } + private OnCircleRefreshListener onCircleRefreshListener; public void setOnRefreshListener(OnCircleRefreshListener onCircleRefreshListener) {