daimajia / AndroidSwipeLayout

The Most Powerful Swipe Layout!
MIT License
12.38k stars 2.67k forks source link

onInterceptTouchEvent method called after unlock phone #364

Open JitenNumberTank opened 8 years ago

JitenNumberTank commented 8 years ago

I have implement peek and pop library with swipelayout. its working as well as we run it normally. but its child getting MotionEvent.Action_Cancel after unlocking phone via right side button in phone. I am getting this issue because of SwipeLayout Library. Could you please tell me Why I am getting this type of issue?

daimajia commented 8 years ago

It's pretty tricky when the list item capturing the gesture, and the touch event is generated by the view.

Can you show me some detail code?

JitenNumberTank commented 8 years ago

This is Touch event for view of that Swipelayout viewgroup.

        @Override
        public boolean onTouch(final View view, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {

                if (!isPeekViewVisible) {
                    peekShown = false;
                    isClicked = false;
                    pressedX = event.getX();
                    pressedY = event.getY();
                    startTimer(view, event);
                }

            } else if (event.getAction() == MotionEvent.ACTION_UP) {

                longHoldTimer.cancel();
                pop(view, position);

                if (!peekShown && !isClicked
                        && distance(pressedX, pressedY, event.getX(), event.getY()) < MAX_CLICK_DISTANCE) {
                    isClicked = true;
                    click(view, position);
                }

            } else if (event.getAction() == MotionEvent.ACTION_CANCEL) {

                longHoldTimer.cancel();
                pop(view, position);
            }

            if (peekShown)
                handleTouch(view, event, position);

            return true;
        }

I am getting MotionEvent.Action_Cancel after unlock because of onInterceptMethod of Swipelayout.

JitenNumberTank commented 8 years ago

I am using this https://github.com/shalskar/PeekAndPop library in your Swipelayout. This is getting stucked image on top after unlock phone. I have checked with otherlist without Swipelayout. That's working very well. but with swipelayout that's not working. Could you please tell me why I am getting this issue? I hope I will get hear from you soon.