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

Event propagation from content to webview #69

Open
ClementHard opened this issue Jul 28, 2015 · 2 comments
Open

Event propagation from content to webview #69

ClementHard opened this issue Jul 28, 2015 · 2 comments

Comments

@ClementHard
Copy link

Hello,

I'm using the swipe gesture to turn pages and it work great by adding a GestureDetector into the webview OnTouchListener.
But if I want to check if the webview consumed the event before trying to detect the swipe gesture (in order to avoid turning the page when dragging a slideshow for example) it do not work because the webview.onTouchEvent(e) always return true even if there is no interactive content.

The same thing works perfectly on iOS.

Here is a StackOverflow question referring to the same problem : http://stackoverflow.com/questions/29821565/check-if-android-webview-is-consuming-touch-events

GestureDetector gestureDetector = new SwipeGestureDetector(context);
webview.setOnTouchListener(new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent event) {
        // With the following code, the gestureDetector is never triggered, webview.onTouchEvent(e) always return true (event is consumed by the webview).
        return webview.onTouchEvent(event) || gestureDetector.onTouchEvent(event);
    }
});

This is probably an Android webview issue.

@ButterRhopa
Copy link

I had been searching for a long time and now I think that it has no proper solution......

@danielweck
Copy link
Member

Android UIWebView, or Chromium? (the latter is available only from KitKat v4.4+)

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

No branches or pull requests

4 participants