[ALOY-800] Add support for <Annotation> within <Module module="ti.map" method="createView" platform="android">
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-04-15T14:54:29.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.4.0, 2014 Sprint 08 |
Components | Titanium SDK, XML |
Labels | notable, qe-testadded |
Reporter | Tim Poulsen |
Assignee | Tim Poulsen |
Created | 2013-08-20T16:02:59.000+0000 |
Updated | 2014-05-13T23:03:45.000+0000 |
Description
I would like to be able to add annotations to Android maps using the tag, and style them with the CSS. This will require a small change to store a reference to either the ti.map module or Ti.Map, for Android and iOS respectively.
Given this XML:
<!-- index.xml -->
<View ns="Ti.Map" id="map" platform="ios">
<!-- annotation styled via tss file -->
<Annotation id="annotation1"/>
</View>
<Module id="map" module="ti.map" method="createView" platform="android">
<Annotation id="annotation1"/>
</Module>
The generated code would need to create a reference to the appropriate module, like this:
/* Pseudo-code of the generated Resources/alloy/controllers/index.js */
// need a reference to the map module
$.__mapModule = (OS_ANDROID) require("ti.map") : Ti.Map;
// rest is pretty much the same, just using the map reference rather than Ti.Map explicitly
$.__views.map = $.__mapModule.createView({
region: {
latitude: 37.38,
latitudeDelta: .2,
longitude: -122.05,
longitudeDelta: .2
},
id: "map"
});
$.__views.win.add($.__views.map);
$.__views.annotation1 = $.__mapModule.createAnnotation({
title: "Mountain View",
latitude: 37.389569,
longitude: -122.050212,
id: "annotation1"
});
Attachments
File | Date | Size |
---|---|---|
MapsDemo.zip | 2014-02-13T17:03:43.000+0000 | 3702940 |
There are some platform-specific properties and constants that rely on the reference to the module, e.g. mapType: MapModule.TERRAIN_TYPE, where MapModule is a user-generated reference to ti.map.
test app attached
PR: https://github.com/appcelerator/alloy/pull/338 Test app: use the attached Functional test: 1. Build the attached app for the iOS simulator or an Android device (or Genymotion emulator). This will not work on the stock Android emulator 2. On iOS, the resulting app should have two maps, each with one annotation which are declared in the XML and styled in the TSS. The top map implements the iOS7 camera view. On Android, the app will have two maps, each with an annotation. Top map uses standard view type, the bottom map uses the terrain type.
Verified working as expected. TiSDK 3.3.0.v20140513115438 Alloy 1.4.0-dev Appcelerator Studio 3.3.0.201405011408 CLI 3.3.0-dev Verified using both testing/ALOY-800 and attached sample code. Closing.