diff --git a/circlerefresh/src/main/java/com/tuesda/walker/circlerefresh/AnimationView.java b/circlerefresh/src/main/java/com/tuesda/walker/circlerefresh/AnimationView.java index 364834e..800d22d 100644 --- a/circlerefresh/src/main/java/com/tuesda/walker/circlerefresh/AnimationView.java +++ b/circlerefresh/src/main/java/com/tuesda/walker/circlerefresh/AnimationView.java @@ -374,7 +374,8 @@ private void drawDone(Canvas canvas) { private int mLastHeight; private int getRelHeight() { - return (int) (mSpriDeta * (1 - getRelRatio())); + //Modify When the drop-down to refresh a certain distance when the slide to let go, the control on the card does not move + return (mSpriDeta * (1 - getRelRatio())) > 0 ? (int) (mSpriDeta * (1 - getRelRatio())) : 0; } private int getSpringDelta() { @@ -382,7 +383,7 @@ private int getSpringDelta() { } - private static long REL_DRAG_DUR = 200; + private static long REL_DRAG_DUR = 100; private long mStart; private long mStop; @@ -427,7 +428,7 @@ private float getSprRatio() { return Math.min(1, ratio); } - private static final long POP_BALL_DUR = 300; + private static final long POP_BALL_DUR = 200; private long mPopStart; private long mPopStop; @@ -448,7 +449,7 @@ private float getPopRatio() { return Math.min(ratio, 1); } - private static final long OUTER_DUR = 200; + private static final long OUTER_DUR = 100; private long mOutStart; private long mOutStop; @@ -474,7 +475,7 @@ private float getOutRatio() { return Math.min(ratio, 1); } - private static final long DONE_DUR = 1000; + private static final long DONE_DUR = 300; private long mDoneStart; private long mDoneStop; 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..740f0c9 100644 --- a/circlerefresh/src/main/java/com/tuesda/walker/circlerefresh/CircleRefreshLayout.java +++ b/circlerefresh/src/main/java/com/tuesda/walker/circlerefresh/CircleRefreshLayout.java @@ -6,6 +6,7 @@ import android.support.annotation.NonNull; import android.support.v4.view.ViewCompat; import android.util.AttributeSet; +import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.MotionEvent; @@ -21,7 +22,7 @@ public class CircleRefreshLayout extends FrameLayout { private static String TAG = "pullToRefresh"; - private static final long BACK_TOP_DUR = 600; + private static final long BACK_TOP_DUR = 400; private static final long REL_DRAG_DUR = 200; private int mHeaderBackColor = 0xff8b90af; @@ -127,6 +128,9 @@ public void onAnimationUpdate(ValueAnimator animation) { } mHeader.getLayoutParams().height = (int) val; mHeader.requestLayout(); + if (mHeader.getLayoutParams().height == 0) { + mIsRefreshing = false; + } } }); mUpTopAnimator.setDuration(BACK_TOP_DUR); @@ -135,7 +139,10 @@ public void onAnimationUpdate(ValueAnimator animation) { @Override public void viewAniDone() { // Log.i(TAG, "should invoke"); - mUpTopAnimator.start(); + //Resolving a fragment in a refresh can not be stopped + if (!mUpTopAnimator.isStarted()) { + mUpTopAnimator.start(); + } } }); @@ -162,14 +169,13 @@ private boolean canChildScrollUp() { return false; } - return ViewCompat.canScrollVertically(mChildView, -1); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (mIsRefreshing) { - return true; + return false; } switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: @@ -189,7 +195,8 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { @Override public boolean onTouchEvent(MotionEvent event) { if (mIsRefreshing) { - return super.onTouchEvent(event); + // return super.onTouchEvent(event); + return false; } switch (event.getAction()) { @@ -218,7 +225,7 @@ public boolean onTouchEvent(MotionEvent event) { mUpBackAnimator.start(); mHeader.releaseDrag(); mIsRefreshing = true; - if (onCircleRefreshListener!=null) { + if (onCircleRefreshListener != null) { onCircleRefreshListener.refreshing(); } @@ -251,7 +258,7 @@ public void finishRefreshing() { if (onCircleRefreshListener != null) { onCircleRefreshListener.completeRefresh(); } - mIsRefreshing = false; +// mIsRefreshing = false; mHeader.setRefreshing(false); }