Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12755] Android: Support HYBRID_TYPE constant and regionchanged event on Maps v2 Module

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2013-02-21T00:30:14.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.1.0, 2013 Sprint 04 API, 2013 Sprint 04
ComponentsAndroid
Labelsapi
ReporterBenjamin Hatfield
AssigneeHieu Pham
Created2013-02-15T19:12:00.000+0000
Updated2017-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();

Comments

  1. Hieu Pham 2013-02-19

    Additional test case for 'regionchanged' event:
       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();
       
    1. Run code, move the map around, check logs.
  2. Hieu Pham 2013-02-19

    PR: https://github.com/appcelerator/titanium_modules/pull/81
  3. Lee Morris 2017-03-09

    Closing ticket as fixed.

JSON Source