diff --git a/library/src/main/java/com/ajguan/library/EasyRefreshLayout.java b/library/src/main/java/com/ajguan/library/EasyRefreshLayout.java index 42cef21..cd0d209 100644 --- a/library/src/main/java/com/ajguan/library/EasyRefreshLayout.java +++ b/library/src/main/java/com/ajguan/library/EasyRefreshLayout.java @@ -77,6 +77,8 @@ public class EasyRefreshLayout extends ViewGroup { private boolean isEnableLoadMore = true; + + private Runnable delayToScrollTopRunnable = new Runnable() { @Override public void run() { @@ -248,9 +250,11 @@ protected void onLayout(boolean b, int i, int i1, int i2, int i3) { @Override public boolean dispatchTouchEvent(MotionEvent ev) { + if (!isEnablePullToRefresh || isLoading || contentView == null) { return super.dispatchTouchEvent(ev); } + //获取支持多点触控的action final int actionMasked = ev.getActionMasked(); switch (actionMasked) { @@ -273,7 +277,7 @@ public boolean dispatchTouchEvent(MotionEvent ev) { removeCallbacks(delayToScrollTopRunnable); removeCallbacks(autoRefreshRunnable); super.dispatchTouchEvent(ev); - //表示消耗了该事件,便面子view都没有消耗而导致后面接收不到该事件的事件序列 + //表示消耗了该事件,以便子view都没有消耗而导致后面接收不到该事件的事件序列 return true; } @@ -293,6 +297,10 @@ public boolean dispatchTouchEvent(MotionEvent ev) { float offsetY = yDiff * DRAG_RATE; lastMotionX = x; lastMotionY = y; + if (Math.abs(xDiff) > touchSlop /*&& isInterceptMoveEvent*/) { + /*左右滑动了*/ + break; + } if (!isBeginDragged && Math.abs(y - initDownY) > touchSlop) { isBeginDragged = true; @@ -969,4 +977,5 @@ public long getHideLoadViewAnimatorDuration() { public void setHideLoadViewAnimatorDuration(long showCompletedTime) { SHOW_COMPLETED_TIME = showCompletedTime; } + }