[TIMOB-4844] Enable property for setBuiltInZoomControls in WebViews on Android
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-10-03T07:30:38.000+0000 |
Affected Version/s | Release 1.7.2 |
Fix Version/s | Sprint 2011-39, Release 1.8.0 |
Components | Android |
Labels | module_webview, qe-testadded |
Reporter | Matthew Congrove |
Assignee | Allen Yeung |
Created | 2011-07-31T22:50:55.000+0000 |
Updated | 2013-11-25T08:49:31.000+0000 |
Description
Request that Appcelerator expose the
setBuiltInZoomControls
property on WebViews within Android so that zooming functionality can be _disabled_ in the application. Perhaps a property name like disableZoom
might be more appropriate.
Android documentation: http://developer.android.com/reference/android/webkit/WebSettings.html#setBuiltInZoomControls(boolean)
Associated helpdesk ticket:
appc.me/c/APP-864343 Changing the customer priority to Within release.Thanks very much for working on this, it's very important to us (HotelTonight)! I've tested this with continuous build 1.8.0.v20110923102146, but setting enableZoomControls to false doesn't seem to turn off the display of the zoom controls. Upon further research, the solution appears to require calling both the native setBuiltInZoomControls, as you do now (in TiUIWebView.java), as well as setSupportZoom. I have added this to the Titanium code, built the SDK, built my app with this new SDK build, and tested it, and it does indeed solve it. I thus hope this addition/change can be part of this fix. Note, I found this solution via the following in case it's of interest: http://stackoverflow.com/questions/5125851/enable-disable-zoom-in-android-webview
I just tried the latest build with my app.js, and it seems to be working. Could you provide an app.js so I can try to reproduce the issue you are having? Thanks, Allen
I just downloaded the latest continuous build for today, and it's still happening - on some devices. Here's a screenshot: https://skitch.com/chrisrbailey/fh2nb/android-zoom-controls-on-webview This occurs on my HTC Thunderbolt, but not on an Droid X or an LG Optimus: HTC Thunderbolt: Android 2.2.1, Verizon, Webkit/533.1, screen: 480x800 Droid X: Android 2.2.1, Verizon, screen: 480x854 LG Optimus S: Android 2.2.2, Sprint, screen: 320x480 To reproduce this, use a Titanium app that contains a window that has a WebView control. Open that up, ensure a web page loads in the webview, then scroll the webpage. You'll then see the zoom controls appear, again on some devices. The above screenshot was taken on an HTC Thunderbolt, using Titanium build 1.8.0.v20110926132318. As other Android developers have found, this depends on the device, but it seems, it's not enough to just call setBuiltInZoomControls, you also need to call setSupportZoom in order to affect this on all devices (see my prior comment and the Stack Overflow thread).
Note, I just sent a GitHub pull request with my change for this, that I've tested on the Thunderbolt (and others) and shown to work. https://github.com/appcelerator/titanium_mobile/pull/510
I've added your proposed change with support to change zoomControls after initialization. Thanks for your input.
For testing I used this app.js
This code should not have zoom controls, since we disabled it. If you enable it with webview.setEnableZoomControls(true), the zoom controls should show up.
Closing. Verified fix on a Nexus One 2.2.2 with SDK 1.8.0.1.v20111122105459. Tested with Allen's app. User can zoom in and out, but zoom controls are disabled. If setEnableZoomControls is set to true, zoom controls are enabled.
Anvil test case added. PR link: https://github.com/appcelerator/titanium_mobile/pull/5020