[TIMOB-13003] Android: Maps V2 module - Enable/disable the my-location button of GoogleMaps
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2013-05-09T22:52:22.000+0000 |
| Affected Version/s | Release 3.1.0 |
| Fix Version/s | 2013 Sprint 10 API, 2013 Sprint 10, Release 3.1.1, Release 3.2.0 |
| Components | Android |
| Labels | SupportTeam, module_androidmapv2, qe-testadded |
| Reporter | Eduardo Gomez |
| Assignee | Ping Wang |
| Created | 2013-03-08T16:18:50.000+0000 |
| Updated | 2014-02-19T08:57:50.000+0000 |
Eduardo, if you set "userLocation: false" when creating the map, the my location button won't show up.
Edit: mFoundry had set the userLocation property on the map to false in order to remove the my-location button from the map. But this also removes the users current location. Based on below link looks like exposing the method would work. Topic: http://stackoverflow.com/questions/14376361/disable-center-button-in-mylocation-at-google-map-api-v2 Method: https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/UiSettings#isMyLocationButtonEnabled() They need to be able to perform the following: (1) Remove the users get my location icon. (2) Show the users current location on the map. (3) Do NOT center the map on the current location, just show it.
PR: https://github.com/appcelerator/titanium_modules/pull/109 Test case:
For FR, run the above test case. Should see a blue dot showing the user's current location and the my-location button in the top right corner of the map. Click the two buttons to toggle "userLocation" and "userLocationButton". *Note:* the my-location button only shows when userLocation==true && userLocationButton==true.var MapModule = require('ti.map'); var win = Ti.UI.createWindow({fullscreen: false}); var map = MapModule.createView({ userLocation: true, userLocationButton: true, mapType: MapModule.NORMAL_TYPE, animate: true, top: '30%' }); var b1 = Ti.UI.createButton({ title: "Toggle userLocation", top: 0 }); b1.addEventListener('click', function(){ map.userLocation = !map.userLocation; Ti.API.info("***************************** map.userLocation = " + map.userLocation); }); var b2 = Ti.UI.createButton({ title: "Toggle userLocationButton", top: 100 }); b2.addEventListener('click', function(){ map.userLocationButton = !map.userLocationButton; Ti.API.info("***************************** map.userLocationButton = " + map.userLocationButton); }); win.add(b1); win.add(b2); win.add(map); win.open();This fix is in the Map module now and we will bundle this module with the SDK starting from 3.1.1 (TIMOB-13791). So this fix will be in 3.1.1.
Verified this feature is functioning as expected. Using: Mac OS 10.8.3 Safari: 6.0.4 Xcode 4.6.2 CLI: 3.1.1-alpha titanium-code-processor: 1.0.1-alpha Alloy: 1.1.3-alpha Appcelerator Studio, build: 3.1.1.201305292130 Titanium SDK version 3.1.1.v20130529114554 Nexus 4 4.2.1