... joyfully re-enabling multitouch functionality for HTML 5 apps on many pre-Android 3 devices
This piece of code is for you, if
cordova plugin add https://github.com/Philzen/WebView-MultiTouch-Polyfill
That's it - without further ado, any 2nd, 3rd, whatever other touch your device understands
will be polyfilled in your (Cordova)WebView
when running on android 2.x
Grab the latest release version from https://github.com/Philzen/WebView-MultiTouch-Polyfill/tags
libs
folderIn your Main Activity, create a new WebClient
object, passing in the WebView
that you want to enable multitouch on:
WebClient wmp = new WebClient(webview);
Refer to the MainActivity of the demo app to see the command in context.
As above, but instead of WebClient
use CordovaWebClient
:
CordovaWebClient wmp = new CordovaWebClient(this, appView);
In your Main (DroidGap
) Activity, instantiate a new PhonegapWebClient
:
PhonegapWebClient wmp = new PhonegapWebClient(this, appView);
This solution was tested with Phonegap 1.8.1 and should work with many earlier versions.
Boolean
setPolyfillAllTouches [default: false
]By default WMP won't do anything to single hand gestures in order not to interfere with varying event implementations on different devices. If you set this value to true
, all touches on the webview will be intercepted and emulated in the polyfill.
NOTE: The polyfill won't interfere with any touches (basically it will be inactive) if the API Level is 11 or higher (= devices running Android 3+)
Preview & Play around with WMP by installing WebView-MultiTouch-Polyfill-DemoApp.apk on your device (compiled for Level 10 API = Android 2.3.3+). Full source code found here on github.
Preferable pick issues in "ready" status on the waffle.io board, but of course you are welcome to work on any other issues and send in pull requests for other cool new features & fixes unthought of so far.
The author of this repository strongly sympathises with the "Non-Military Use Only" Licence model. However, since it poses a logical contradiction of the open source definition, all rights are hereby granted under the Apache licence:
Copyright 2012 github.com/Philzen et. al.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.