Hi,
regarding the maneuvers' list and icons, the easiest way to get them is to use predefined list item - RouteListItem. The simplest way to add routing to your app is to use the route component, please check the example below:
Code:
myApp.ManeuversPage = new nokia.mh5.Class(nokia.mh5.ui.Page, function(parent) {
return {
children: ["maneuvers", "route"],
maneuvers: {
control: nokia.mh5.ui.List,
itemClass: nokia.mh5.components.RouteListItem
},
route: {
control: nokia.mh5.components.Route,
listeners: {
success: function (e) {
this.parent.maneuvers.items = e.data.maneuvers;
},
error: function (e) {
console.error(e.data.message);
}
}
}
};
});
This example will create two text inputs (from and to) and a list. After searching for starting point and destination, it will display the maneuvers in the list. However, if you don't want to use routing component with default look and feel, you can do it via headless mode. In this case, you need to create your own UI and pass the parameters to route adapter, please check the second example for more details:
Code:
myApp.ManeuversPage = new nokia.mh5.Class(nokia.mh5.ui.Page, function(parent) {
return {
children: ["maneuvers", "button"],
maneuvers: {
control: nokia.mh5.ui.List,
itemClass: nokia.mh5.components.RouteListItem
},
button: {
control: nokia.mh5.ui.Button,
onClick: function () {
var from = {
latitude: 52,
longitude: 13
},
to = {
latitude: 51,
longitude: 12
},
parameters = {
appId: "myAppId",
appCode: "myAppCode",
mode: "drive"
};
nokia.mh5.adapters.Route.fetch([from, to], parameters, function (result) {
// success
this.parent.maneuvers.items = result.maneuvers;
}.bind(this), function (message) {
// error
console.error(message);
});
}
};
});
The above code creates two UI components: a list and a button, and after clicking the button it makes a routing request showing the maneuvers in the list.
Hope that helps,
Mat