I've got a requirement to detect quadruple clicks ...
# compose
c
I've got a requirement to detect quadruple clicks anywhere on the screen within 250ms. I have something that works with the clickable modifier with a Box at the root of my app (can post code if anyone is interested, but I essentially just count touches and reset every 250ms) but now my problem is that on one of our screens that is a full webview the quadruple clicks aren't recognized. I'm assuming my webview (forked from accompanist) can somehow be changed so that I can also get those clicks. Anyone have any ideas here? Been hacking away at it to try to get something working to no avail. Maybe its some limitation of webview?
m
I believe I've encountered something similar. The WebView page within the
AndroidView
is consuming the click events and not letting the
Box
get it. You've probably figured that out already, let me see if I can find out how this was solved.
❤️ 1
Alright, turns out it wasn't the exact same issue, but still reproducible. Like I mentioned earlier, the WebView's page is consuming the click events and you don't want to interfere with the click events on your web page. So what I did in the past was use my own custom implementation of a WebView which was very similar to how accompanist structured theirs.
Copy code
class TouchWebView(context: Context) : WebView(context) {
    override fun onTouchEvent(event: MotionEvent?): Boolean {
        if (event?.action == MotionEvent.ACTION_DOWN) {
            // Check 250ms counter
        }
        return super.onTouchEvent(event)
    }
}
Not the most ideal situation, since you'll have to make changes to your forked accompanist WebView implementation.