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

How to implement dispatchTouchEvent() in fragment? #29

Open
mistrydarshan99 opened this issue Jun 12, 2017 · 2 comments
Open

How to implement dispatchTouchEvent() in fragment? #29

mistrydarshan99 opened this issue Jun 12, 2017 · 2 comments

Comments

@mistrydarshan99
Copy link

Hello,

This library works very well in activity but not getting touch detection in the fragment.

So how to implement in the fragment. And also don't get dispatchTouchEvent() method in a fragment.

@yesidlazaro
Copy link

any news here?

@pnkram
Copy link

pnkram commented Jul 6, 2018

Hi, inside my mainactivity I put a FrameLayout in which there is another layout. Inside that FramelayoutI initialized sensey while in mainactivity i set dispatchTouchEvent like this:

    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        // Setup onTouchEvent for detecting type of touch gesture
        //Sensey.getInstance().setupDispatchTouchEvent(event);
        rightFragment.sensey.getInstance().setupDispatchTouchEvent(event);
        return super.dispatchTouchEvent(event);
    }

However when I touch the screen, the touch event is being recognized everywhere while it should be recognized only inside the layout in the fragment.

Can anyone please help me?

EDIT: I managed to put it the listener inside a Framelayout. Now I put 2 listeners in 2 different framelayout and I saw that both boxes are getting touch event but both touches are being registered on the same box.
Is it possible to solve this? I saw that only one instance is being created and I wanted to know if there is some way I can bypass it.
In the meanwhile I'll gonna search if there are other library that can handle multiple touch events.
Thank you

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

3 participants