Created
August 17, 2016 17:21
-
-
Save gnardini/d82f8fab8b8c79c9b7a80c7283ce62b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FixedSwipeRefreshLayout extends SwipeRefreshLayout { | |
private boolean mHandleTouch = true; | |
public FixedSwipeRefreshLayout(Context context) { | |
super(context); | |
} | |
public FixedSwipeRefreshLayout(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
@Override | |
public boolean onTouchEvent(MotionEvent ev) { | |
int action = MotionEventCompat.getActionMasked(ev); | |
switch (action) { | |
case MotionEvent.ACTION_DOWN: | |
mHandleTouch = false; | |
break; | |
default: | |
if (mHandleTouch) { | |
return super.onTouchEvent(ev); | |
} | |
mHandleTouch = onInterceptTouchEvent(ev); | |
switch (action) { | |
case MotionEvent.ACTION_UP: | |
case MotionEvent.ACTION_CANCEL: | |
mHandleTouch = true; | |
break; | |
} | |
break; | |
} | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment