Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

bug #18

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -374,15 +374,16 @@ 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() {
return (int) (PULL_DELTA * getSprRatio());
}


private static long REL_DRAG_DUR = 200;
private static long REL_DRAG_DUR = 100;

private long mStart;
private long mStop;
Expand Down Expand Up @@ -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;

Expand All @@ -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;

Expand All @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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();
}
}
});

Expand All @@ -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:
Expand All @@ -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()) {
Expand Down Expand Up @@ -218,7 +225,7 @@ public boolean onTouchEvent(MotionEvent event) {
mUpBackAnimator.start();
mHeader.releaseDrag();
mIsRefreshing = true;
if (onCircleRefreshListener!=null) {
if (onCircleRefreshListener != null) {
onCircleRefreshListener.refreshing();
}

Expand Down Expand Up @@ -251,7 +258,7 @@ public void finishRefreshing() {
if (onCircleRefreshListener != null) {
onCircleRefreshListener.completeRefresh();
}
mIsRefreshing = false;
// mIsRefreshing = false;
mHeader.setRefreshing(false);
}

Expand Down