Titanium JIRA Archive
Alloy (ALOY)

[ALOY-800] Add support for <Annotation> within <Module module="ti.map" method="createView" platform="android">

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-04-15T14:54:29.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.4.0, 2014 Sprint 08
ComponentsTitanium SDK, XML
Labelsnotable, qe-testadded
ReporterTim Poulsen
AssigneeTim Poulsen
Created2013-08-20T16:02:59.000+0000
Updated2014-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

FileDateSize
MapsDemo.zip2014-02-13T17:03:43.000+00003702940

Comments

  1. Tim Poulsen 2013-08-20

    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.
  2. Tim Poulsen 2014-02-13

    test app attached
  3. Tim Poulsen 2014-02-13

    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.
  4. Federico Casali 2014-05-13

    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.

JSON Source