Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12787] Android: Allow map annotation to fire a click event without showing the callout

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-10-24T22:38:35.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 22, 2013 Sprint 22 API, Release 3.2.0
ComponentsAndroid
Labelsmodule_map, qe-testadded
ReporterDavide Cassenti
AssigneeHieu Pham
Created2013-02-19T20:06:17.000+0000
Updated2013-11-21T01:55:18.000+0000

Description

Feature description

When clicking on a map annotation, a callout is always shown. Need to avoid the callout to be displayed, and fire the click event anyway. Testing Code:
var MapModule = require('ti.map');
var win = Ti.UI.createWindow({fullscreen: false});
var anno2 = MapModule.createAnnotation({latitude: -33.86365, pincolor: MapModule.ANNOTATION_BLUE, longitude: 151.21689, title: "Anno2", subtitle: "This is anno2", draggable: true});
var anno4 = MapModule.createAnnotation({latitude: -33.86365, longitude: 151.22689, title: "Anno4", subtitle: "This is anno4", draggable: true});

var map = MapModule.createView({
	userLocation: true,
	mapType: MapModule.NORMAL_TYPE,
	animate: true,
	annotations: [anno2, anno4],
	region: {latitude: -33.87365, longitude: 151.20689, latitudeDelta: 0.1, longitudeDelta: 0.1 }, //Sydney
	top: '30%'
});
win.add(map);

map.addEventListener('click', function(e) {
	Ti.API.info("Latitude: " + e.latitude);
	Ti.API.info("Source: " + e.clicksource);
});
var button = Ti.UI.createButton({top: 0, left: 0, title: "Blue Anno Info Window Enabled"});
button.addEventListener('click', function(e) {
    if (!anno2.showInfoWindow) {
		anno2.showInfoWindow = true;
		button.title = "Blue Anno Info Window Enabled";
	} else {
		anno2.showInfoWindow = false;
		button.title = "Blue Anno Info Window Disabled";
	}
});

var button2 = Ti.UI.createButton({top: 100, left: 0, title: "Red Anno Info Window Enabled"});
button2.addEventListener('click', function(e) {
    if (!anno4.showInfoWindow) {
		anno4.showInfoWindow = true;
		button2.title = "Red Anno Info Window Enabled";
	} else {
		anno4.showInfoWindow = false;
		button2.title = "Red Anno Info Window Disabled";
	}
});



win.add(button);
win.add(button2);
win.open();
1. Run code, toggle the property, make sure window info doesn't show when showInfoWindow is false.

Comments

  1. Vishal Duggal 2013-09-24

    Map Module only
  2. Hieu Pham 2013-10-24

    Master PR: https://github.com/appcelerator-modules/ti.map/pull/15

JSON Source