[TIMOB-12755] Android: Support HYBRID_TYPE constant and regionchanged event on Maps v2 Module
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Low |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2013-02-21T00:30:14.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 3.1.0, 2013 Sprint 04 API, 2013 Sprint 04 |
| Components | Android |
| Labels | api |
| Reporter | Benjamin Hatfield |
| Assignee | Hieu Pham |
| Created | 2013-02-15T19:12:00.000+0000 |
| Updated | 2017-03-09T01:19:54.000+0000 |
Description
1. Missing a constant to set the HYBRID_TYPE. As a workaround, I can set the mapType to 4 and it works. See code below.
Constant is listed and used as an example in these links:
https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap
https://developers.google.com/maps/documentation/android/map?hl=en#change_the_map_type
2. The regionchanged event does not fire when changing zoom level or moving the map around as with the previous Ti.Map module.
var MapModule = require('ti.map');
var win = Ti.UI.createWindow({backgroundColor: 'white'});
var mapview = MapModule.createView({
mapType: 4,
region: {latitude: 37.389569, longitude: -122.050212, latitudeDelta: 0.1, longitudeDelta: 0.1}
});
function report (e) {
Ti.API.info('mapview:' + e.type);
}
mapview.addEventListener('regionchanged', report);
mapview.addEventListener('postlayout', report);
mapview.addEventListener('complete', report);
win.add(mapview);
win.open();
Additional test case for 'regionchanged' event:
1. Run code, move the map around, check logs.var MapModule = require('ti.map'); var win = Ti.UI.createWindow({fullscreen: false}); var map = MapModule.createView({ userLocation: true, mapType: MapModule.HYBRID_TYPE, region: {latitude: -33.87365, longitude: 151.20689, latitudeDelta: 0.1, longitudeDelta: 0.1 }, //Sydney }); map.addEventListener('regionchanged', function(e) { Ti.API.info("Latitude: " + e.latitude); Ti.API.info("Longitude: " + e.longitude); Ti.API.info("Type: " + e.type); }); win.add(map); win.open();PR: https://github.com/appcelerator/titanium_modules/pull/81
Closing ticket as fixed.