This piece of code is for you, if
- you want to develop an HTML5 app
- you'd like to track more than one fingertap action ("touch events")
- you want it to work on more pre-Android-3-phones
Test 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.
Grab the latest release version from https://github.com/Philzen/WebView-MultiTouch-Polyfill/tags
- Copy wmp.jar into your own projects'
In your Main Activity, create a new
WebClientobject, passing in the
WebViewthat 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
CordovaWebClient wmp = new CordovaWebClient(this, appView);
- Copy WebClient.java and PhonegapWebClient.java from src/com/changeit/wmpolyfill/ into your project. You will need to refactor those classes namespace to match those of your project - some IDEs (i.e. Netbeans) will do that conveniently for you as you paste the files
In your Main (
DroidGap) Activity, instantiate a new
PhonegapWebClient wmp = new PhonegapWebClient(this, appView);
This solution was tested with Phonegap 1.8.1 and should work with many earlier versions.
- setPolyfillAllTouches (Boolean) [default:
false] Per 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+)
- You can help the project by
- Visit the wiki for further information and ongoing development updates.
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.