[TIMOB-2236] Android: Can't Update Properties of a Map Annotation
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-07-11T23:19:11.000+0000 |
Affected Version/s | Release 2.0.1 |
Fix Version/s | Release 2.1.0, Sprint 2012-11 API |
Components | Android |
Labels | api, module_map, qe-testadded, training |
Reporter | Don Thorp |
Assignee | Ping Wang |
Created | 2011-04-15T03:14:26.000+0000 |
Updated | 2012-07-12T11:49:10.000+0000 |
Description
Updating the properties (ex: title, subtitle) of an annotation proxy are being ignored.Test Case
var win = Ti.UI.createWindow();
var mountainView = Titanium.Map.createAnnotation({
latitude:37.390749,
longitude:-122.081651,
title:"Appcelerator Headquarters",
subtitle:'Mountain View, CA',
pincolor:Titanium.Map.ANNOTATION_RED,
animate:true,
leftButton: '../images/appcelerator_small.png',
myid:1 // Custom property to uniquely identify this annotation.
});
var mapview = Ti.Map.createView({
width: 500, height: 500,
mapType: Titanium.Map.STANDARD_TYPE,
region: {latitude:37.390749, longitude:-122.081651,
latitudeDelta:0.01, longitudeDelta:0.01},
annotations: [mountainView]
});
win.add(mapview);
mapview.addEventListener('click', function(e) {
alert("click! annotation = " + e.annotation);
e.annotation.title = "Found it!";
e.annotation.subtitle = "Works!";
});
win.open();
1. Try clicking the annotation.
2. An alert should pop up saying "click".
3. Check if the title and subtitle got updated.
Expected: title and subtitle changed
Actual: No changes happen, property updates ignored.
Comments
- Josh Roesslein 2012-05-17 Updated this ticket with test case since the linked HD ticket is long gone. This actually affects all properties on annotation in current master branch.
- Ping Wang 2012-05-24
Test case:
For functional test: 1. click the pin to see the annotation title and subtitle. 2. click the button. 3. click the pin to check whether annotation title and subtitle are changed. Expected: The title and subtitle are changed.var win = Ti.UI.createWindow({ backgroundColor: 'black' }); var b = Ti.UI.createButton({ top: 100, title: "change annotation" }); b.addEventListener('click', function() { alert("click! annotation.title = " + mountainView.title); mountainView.title = "Found it!"; mountainView.subtitle = "Works!"; }); win.add(b); var mountainView = Titanium.Map.createAnnotation({ latitude:37.390749, longitude:-122.081651, title:"Appcelerator Headquarters", subtitle:'Mountain View, CA', pincolor:Titanium.Map.ANNOTATION_RED, animate:true, leftButton: '../images/appcelerator_small.png', myid:1 // Custom property to uniquely identify this annotation. }); var mapview = Ti.Map.createView({ width: 500, height: 500, mapType: Titanium.Map.STANDARD_TYPE, region: {latitude:37.390749, longitude:-122.081651, latitudeDelta:0.01, longitudeDelta:0.01}, annotations: [mountainView] }); win.add(mapview); win.open();
- Ping Wang 2012-05-24 PR https://github.com/appcelerator/titanium_mobile/pull/2270
- Dustin Hyde 2012-06-15
Closing as Fixed.
Verified via a modified version of Ping's code (below).
The code was changed to fix the layout across screen-sizes, and prevent an emulator crash (TIMOB-9585) for non-existent image resources.
SDK: 2.1.0.v20120615150353
Studio: 2.1.0.201206141932
OS: Snow Leopard
Runtime: V8
Devices Tested: Android Emulator 2.2, LG Revolution 2.3.6
Test Case:
1. Run code:
2. click the pin to see the annotation title and subtitle. 3. click the update button. 4. click the pin to check whether annotation title and subtitle are changed. Expected: The title and subtitle are changed.var win = Ti.UI.createWindow({ backgroundColor: 'black', layout:'vertical' }); var b = Ti.UI.createButton({ title: "change annotation" }); b.addEventListener('click', function() { alert("click! annotation.title = " + mountainView.title); mountainView.title = "Found it!"; mountainView.subtitle = "Works!"; }); win.add(b); var mountainView = Titanium.Map.createAnnotation({ latitude:37.390749, longitude:-122.081651, title:"Appcelerator Headquarters", subtitle:'Mountain View, CA', pincolor:Titanium.Map.ANNOTATION_RED, animate:true, myid:1 }); var mapview = Ti.Map.createView({ mapType: Titanium.Map.STANDARD_TYPE, region: {latitude:37.390749, longitude:-122.081651, latitudeDelta:0.01, longitudeDelta:0.01}, annotations: [mountainView] }); win.add(mapview); win.open();
- Neha Chhabra 2012-07-11 Reopening to update labels.