[TIMOB-12583] Android: Maps V2 module: Adding custom views in the pin
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2013-03-20T21:20:21.000+0000 |
| Affected Version/s | Release 3.0.0 |
| Fix Version/s | 2013 Sprint 06 API, 2013 Sprint 06, Co-3.1.0 |
| Components | Android |
| Labels | api, module_googlemapv2, module_map, qe-testadded |
| Reporter | Mauro Parra-Miranda |
| Assignee | Ping Wang |
| Created | 2013-02-05T02:18:22.000+0000 |
| Updated | 2014-08-19T13:55:43.000+0000 |
Description
Feature Description
Customer wants to be able to use any view in as the custom pin instead of having to convert the view into a blob.Extra info
Customer have the feeling that this will do the entire process more efficient (memory and time wise) and easy (to code).Attachments
| File | Date | Size |
|---|---|---|
| pin.jpg | 2013-02-05T02:20:39.000+0000 | 94015 |
This is the kind of custom pins that the customer wants to add.
Can be fixed on Android Maps v2
1. PR https://github.com/appcelerator/titanium_mobile/pull/3982 fixes a bug in the toImage() method. Test case:
For FR, please run the above test case. Should see a label with the text "$400k" and with the red background color. 2. PR https://github.com/appcelerator/titanium_modules/pull/92 Test case:var win = Ti.UI.createWindow({fullscreen: false}); var myView1 = Ti.UI.createView({ //width:100, //height:50, width:Ti.UI.SIZE, height:Ti.UI.SIZE, backgroundColor:'red' }); var label = Ti.UI.createLabel({ text:" $400K ", font:{fontSize:10, fontWeight:"bold", fontStyle:"italic"} }); myView1.add(label); var imgview = Ti.UI.createImageView({ width: 400, height: 300, backgroundColor: 'white', enableZoomControls: true }); var imageBlob = myView1.toImage(); imgview.image = imageBlob.media; win.add(imgview); win.open();var MapModule = require('ti.map'); var win = Ti.UI.createWindow({fullscreen: false}); var myView1 = Ti.UI.createView({ width:Ti.UI.SIZE, height:Ti.UI.SIZE, backgroundColor:'red' }); var label = Ti.UI.createLabel({ text:" $400K ", font:{fontSize:18, fontWeight:"bold", fontStyle:"italic"} }); myView1.add(label); var anno = MapModule.createAnnotation({latitude: -33.87365, customView: myView1, image: "KS_nav_ui.png", longitude: 151.20689, title: "Drag Me", subtitle: "Sydney is quite chill", draggable: true}); var anno2 = MapModule.createAnnotation({latitude: -33.86365, pincolor: MapModule.ANNOTATION_BLUE, longitude: 151.21689, title: "Drag Me 2", subtitle: "This is anno2", draggable: true}); var anno3 = MapModule.createAnnotation({latitude: -33.85365, longitude: 151.20689, title: "anno3", subtitle: "This is anno3", draggable: false}); var map = MapModule.createView({ userLocation: true, mapType: MapModule.NORMAL_TYPE, animate: true, annotations: [anno, anno2, anno3], region: {latitude: -33.87365, longitude: 151.20689, latitudeDelta: 0.1, longitudeDelta: 0.1 }, //Sydney top: '30%' }); map.addEventListener('pinchangedragstate', function(e) { Ti.API.info(e.title + ": newState=" + e.newState + ", lat=" + e.annotation.latitude + ", lon=" + e.annotation.longitude); }); var b = Ti.UI.createButton({ title: "Toggle draggable for anno3", top: 0 }); b.addEventListener('click', function(){ anno3.draggable = !anno3.draggable; Ti.API.info("anno3.draggable = " + anno3.draggable); }); win.add(b); win.add(map); win.open();Test case #1 above added to map_module, test case #2 to mapv2 module test apps.
Hi, apparently the customView property is not yet supported on Android. https://github.com/appcelerator/titanium_mobile/blob/58198c641d77e17d156431666e80bae732b5c130/apidoc/Titanium/Map/Annotation.yml#L87 Am I wrong? Is there an alternative? Thanks in advance for your answer.