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 with swipe viewHolder left or right #40

Open
vkropivko opened this issue Aug 8, 2017 · 1 comment
Open

Bug with swipe viewHolder left or right #40

vkropivko opened this issue Aug 8, 2017 · 1 comment

Comments

@vkropivko
Copy link

Bug with swipe viewHolder left or right. Not correcty work onTouchEvent

@mshahabrauf
Copy link

mshahabrauf commented Sep 16, 2019

public class WaveVerticalSwipeToRefresh extends WaveSwipeRefreshLayout {

    private int mTouchSlop;
    private float mPrevX;

    public WaveVerticalSwipeToRefresh(Context context, AttributeSet attrs) {
        super(context, attrs);

        mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                mPrevX = MotionEvent.obtain(event).getX();
                break;

            case MotionEvent.ACTION_MOVE:
                final float eventX = event.getX();
                float xDiff = Math.abs(eventX - mPrevX);

                if (xDiff > mTouchSlop) {
                    return false;
                }
        }

        return super.onInterceptTouchEvent(event);
    }
} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants