final 1.0
* added a final icon * changed the icons taken from material design to pebble seeding lang icons
@@ -33,50 +33,26 @@
|
||||
"resources": {
|
||||
"media": [
|
||||
{
|
||||
"file": "images/car_black.png",
|
||||
"name": "ICON_CAR_BLACK",
|
||||
"file": "images/car.png",
|
||||
"name": "ICON_CAR",
|
||||
"targetPlatforms": null,
|
||||
"type": "bitmap"
|
||||
},
|
||||
{
|
||||
"file": "images/car_white.png",
|
||||
"name": "ICON_CAR_WHITE",
|
||||
"file": "images/bike.png",
|
||||
"name": "ICON_BIKE",
|
||||
"targetPlatforms": null,
|
||||
"type": "bitmap"
|
||||
},
|
||||
{
|
||||
"file": "images/train_black.png",
|
||||
"name": "ICON_TRAIN_BLACK",
|
||||
"file": "images/train.png",
|
||||
"name": "ICON_TRAIN",
|
||||
"targetPlatforms": null,
|
||||
"type": "bitmap"
|
||||
},
|
||||
{
|
||||
"file": "images/train_white.png",
|
||||
"name": "ICON_TRAIN_WHITE",
|
||||
"targetPlatforms": null,
|
||||
"type": "bitmap"
|
||||
},
|
||||
{
|
||||
"file": "images/bike_black.png",
|
||||
"name": "ICON_BIKE_BLACK",
|
||||
"targetPlatforms": null,
|
||||
"type": "bitmap"
|
||||
},
|
||||
{
|
||||
"file": "images/bike_white.png",
|
||||
"name": "ICON_BIKE_WHITE",
|
||||
"targetPlatforms": null,
|
||||
"type": "bitmap"
|
||||
},
|
||||
{
|
||||
"file": "images/walk_black.png",
|
||||
"name": "ICON_WALK_BLACK",
|
||||
"targetPlatforms": null,
|
||||
"type": "bitmap"
|
||||
},
|
||||
{
|
||||
"file": "images/walk_white.png",
|
||||
"name": "ICON_WALK_WHITE",
|
||||
"file": "images/walk.png",
|
||||
"name": "ICON_WALK",
|
||||
"targetPlatforms": null,
|
||||
"type": "bitmap"
|
||||
},
|
||||
@@ -133,6 +109,12 @@
|
||||
"name": "ICON_STEP_ATTR",
|
||||
"targetPlatforms": null,
|
||||
"type": "bitmap"
|
||||
},
|
||||
{
|
||||
"file": "images/step_final.png",
|
||||
"name": "ICON_STEP_FINAL",
|
||||
"targetPlatforms": null,
|
||||
"type": "bitmap"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 354 B |
|
Before Width: | Height: | Size: 317 B |
|
Before Width: | Height: | Size: 328 B |
|
After Width: | Height: | Size: 384 B |
|
Before Width: | Height: | Size: 195 B |
|
Before Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 304 B |
|
After Width: | Height: | Size: 238 B |
|
Before Width: | Height: | Size: 147 B After Width: | Height: | Size: 300 B |
|
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 315 B |
|
Before Width: | Height: | Size: 553 B After Width: | Height: | Size: 322 B |
|
Before Width: | Height: | Size: 587 B After Width: | Height: | Size: 316 B |
|
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 317 B |
|
After Width: | Height: | Size: 394 B |
|
Before Width: | Height: | Size: 198 B |
|
Before Width: | Height: | Size: 205 B |
|
After Width: | Height: | Size: 451 B |
|
Before Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 263 B |
@@ -151,7 +151,7 @@ void directions_draw_step(GContext *ctx, GRect bounds, GColor color, char *text,
|
||||
graphics_fill_rect(ctx, header_box, 0, GCornerNone);
|
||||
// Draw icon
|
||||
graphics_context_set_compositing_mode(ctx, GCompOpSet);
|
||||
graphics_draw_bitmap_in_rect(ctx, step_icon, GRect((bounds.size.w - 24) / 2, 18, 24, 24));
|
||||
graphics_draw_bitmap_in_rect(ctx, step_icon, GRect((bounds.size.w - 24) / 2, 20, 24, 24));
|
||||
// Draw text
|
||||
GRect text_box = GRect(7, 7 + header_box.size.h, bounds.size.w - 14, bounds.size.h - header_box.size.h - 14);
|
||||
graphics_context_set_text_color(ctx, color_text);
|
||||
|
||||
@@ -40,6 +40,7 @@ static GBitmap *icon_step_left;
|
||||
static GBitmap *icon_step_uright;
|
||||
static GBitmap *icon_step_uleft;
|
||||
static GBitmap *icon_step_attr;
|
||||
static GBitmap *icon_step_final;
|
||||
|
||||
// Dictation input
|
||||
static DictationSession *dictation_session;
|
||||
@@ -105,6 +106,9 @@ static void draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex
|
||||
case 'g':
|
||||
icon = icon_step_attr;
|
||||
break;
|
||||
case 'h':
|
||||
icon = icon_step_final;
|
||||
break;
|
||||
default:
|
||||
icon = icon_step_type;
|
||||
}
|
||||
@@ -344,6 +348,7 @@ static void window_unload() {
|
||||
gbitmap_destroy(icon_step_uright);
|
||||
gbitmap_destroy(icon_step_uleft);
|
||||
gbitmap_destroy(icon_step_attr);
|
||||
gbitmap_destroy(icon_step_final);
|
||||
}
|
||||
|
||||
static void window_disappear() {
|
||||
@@ -413,19 +418,19 @@ static void window_load() {
|
||||
switch (selected_type_enum) {
|
||||
case 0:
|
||||
// Car icon
|
||||
icon_step_type = gbitmap_create_with_resource(RESOURCE_ID_ICON_CAR_BLACK);
|
||||
icon_step_type = gbitmap_create_with_resource(RESOURCE_ID_ICON_CAR);
|
||||
break;
|
||||
case 1:
|
||||
// Bike icon
|
||||
icon_step_type = gbitmap_create_with_resource(RESOURCE_ID_ICON_BIKE_BLACK);
|
||||
icon_step_type = gbitmap_create_with_resource(RESOURCE_ID_ICON_BIKE);
|
||||
break;
|
||||
case 2:
|
||||
// Train icon
|
||||
icon_step_type = gbitmap_create_with_resource(RESOURCE_ID_ICON_TRAIN_BLACK);
|
||||
icon_step_type = gbitmap_create_with_resource(RESOURCE_ID_ICON_TRAIN);
|
||||
break;
|
||||
case 3:
|
||||
// Walk icon
|
||||
icon_step_type = gbitmap_create_with_resource(RESOURCE_ID_ICON_WALK_BLACK);
|
||||
icon_step_type = gbitmap_create_with_resource(RESOURCE_ID_ICON_WALK);
|
||||
break;
|
||||
default:
|
||||
// Forward icon
|
||||
@@ -437,6 +442,7 @@ static void window_load() {
|
||||
icon_step_uright = gbitmap_create_with_resource(RESOURCE_ID_ICON_STEP_URIGHT);
|
||||
icon_step_uleft = gbitmap_create_with_resource(RESOURCE_ID_ICON_STEP_ULEFT);
|
||||
icon_step_attr = gbitmap_create_with_resource(RESOURCE_ID_ICON_STEP_ATTR);
|
||||
icon_step_final = gbitmap_create_with_resource(RESOURCE_ID_ICON_STEP_FINAL);
|
||||
}
|
||||
|
||||
// Push the window to the window stack
|
||||
@@ -456,12 +462,9 @@ void directions_window_push() {
|
||||
// Push window to screen
|
||||
window_stack_push(window, true);
|
||||
|
||||
// Start the dictation session TODO: Change this for production
|
||||
//dictation_session_start(dictation_session);
|
||||
address = "Meerbusch an der alten Schule"; // WIP address string
|
||||
// Start the dictation session
|
||||
dictation_session_start(dictation_session);
|
||||
|
||||
// Open the connection to the phone
|
||||
app_message_start();
|
||||
// TODO: Remove this for final version; this is a playeholder implementation (skipping the dictation)
|
||||
app_message_send_search_data();
|
||||
}
|
||||
|
||||
@@ -116,6 +116,7 @@ function fetchAndSendRoute(routeType, searchText, messageNumber) {
|
||||
console.log('Search text:', searchText);
|
||||
// Load a route from here api. Data format: { distance, time, stepList[string], stepIconsString }
|
||||
locationService.createRoute(routeType, searchText, function(success, data) {
|
||||
console.log('Will send:', success, data.stepList.length, data.stepIconsString, messageNumber);
|
||||
sendRoute(success, data.distance, data.time, data.stepList, data.stepIconsString, messageNumber);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ function loadCurrentLocation(callback) {
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
// Success
|
||||
function(pos) {
|
||||
//callback(true, 52.5, 13.4); /* THIS IS FOR DEMO / SCREENSHOTS IN THE EMULATOR */
|
||||
callback(true, pos.coords.latitude, pos.coords.longitude);
|
||||
},
|
||||
// Error
|
||||
@@ -58,7 +59,7 @@ function loadLocationForSearch(searchText, currentLat, currentLon, callback) {
|
||||
url = url.concat('&app_code=').concat(hereAppCode);
|
||||
url = url.concat('&gen=9'); /*don't break on here api update*/
|
||||
url = url.concat('&searchtext=').concat(searchText.split(' ').join('+'));
|
||||
url = url.concat('&prox=').concat(currentLat).concat(',').concat(currentLon).concat(',150000'); /* favour results within 150 km range */
|
||||
url = url.concat('&prox=').concat(currentLat).concat(',').concat(currentLon).concat(',50000'); /* favour results within 50 km range */
|
||||
// Perform an request
|
||||
makeJsonHttpGetRequest(url, function(success, res) {
|
||||
if (success) {
|
||||
@@ -66,6 +67,7 @@ function loadLocationForSearch(searchText, currentLat, currentLon, callback) {
|
||||
try {
|
||||
var foundLat = res.Response.View[0].Result[0].Location.NavigationPosition[0].Latitude;
|
||||
var foundLon = res.Response.View[0].Result[0].Location.NavigationPosition[0].Longitude;
|
||||
//callback(true, 52.5, 13.45); /* THIS IS FOR DEMO / SCREENSHOTS IN THE EMULATOR (add 'Schleusenufer' on watch as address string) */
|
||||
callback(true, foundLat, foundLon);
|
||||
} catch (e) {
|
||||
callback(false, 0, 0);
|
||||
@@ -90,6 +92,7 @@ function loadRouteData(routeType, fromLat, fromLon, toLat, toLon, callback) {
|
||||
uRight: 'e',
|
||||
uLeft: 'f',
|
||||
attr: 'g',
|
||||
final: 'h',
|
||||
};
|
||||
// Maps the direction retrived from here api to icon name
|
||||
var directionMap = {
|
||||
@@ -127,7 +130,10 @@ function loadRouteData(routeType, fromLat, fromLon, toLat, toLon, callback) {
|
||||
// Add the text
|
||||
routeData.stepList[index] = step.instruction;
|
||||
// Add the icon
|
||||
if (step.hasOwnProperty('direction')) {
|
||||
if (res.response.route[0].leg[0].maneuver.length == index + 1) {
|
||||
// This is the last step, add the finished icon
|
||||
routeData.stepIconsString = routeData.stepIconsString.concat(icons['final']);
|
||||
} else if (step.hasOwnProperty('direction')) {
|
||||
// Display the specified icon
|
||||
if (directionMap.hasOwnProperty(step.direction)) {
|
||||
routeData.stepIconsString = routeData.stepIconsString.concat(icons[directionMap[step.direction]]);
|
||||
|
||||
@@ -9,14 +9,10 @@ static Window *window;
|
||||
static MenuLayer *transit_mode_menu;
|
||||
|
||||
// Transit mode icons
|
||||
static GBitmap *icon_car_white;
|
||||
static GBitmap *icon_car_black;
|
||||
static GBitmap *icon_bike_white;
|
||||
static GBitmap *icon_bike_black;
|
||||
static GBitmap *icon_train_white;
|
||||
static GBitmap *icon_train_black;
|
||||
static GBitmap *icon_walk_white;
|
||||
static GBitmap *icon_walk_black;
|
||||
static GBitmap *icon_car;
|
||||
static GBitmap *icon_bike;
|
||||
static GBitmap *icon_train;
|
||||
static GBitmap *icon_walk;
|
||||
|
||||
// Callback for number of rows
|
||||
static uint16_t get_num_rows_callback(struct MenuLayer *menu_layer, uint16_t section_index, void *context) {
|
||||
@@ -40,41 +36,23 @@ static int16_t get_cell_height_callback(struct MenuLayer *menu_layer, MenuIndex
|
||||
|
||||
// Draw menu cell callback
|
||||
static void draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) {
|
||||
// Is the current cell highlighted?
|
||||
bool highlighted = menu_cell_layer_is_highlighted(cell_layer);
|
||||
// Determine what row to draw
|
||||
switch (cell_index->row) {
|
||||
// Driving / Car
|
||||
case 0:
|
||||
if (highlighted) {
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Driving", NULL, icon_car_white);
|
||||
} else {
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Driving", NULL, icon_car_black);
|
||||
}
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Driving", NULL, icon_car);
|
||||
break;
|
||||
// Riding the bike
|
||||
case 1:
|
||||
if (highlighted) {
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Cycling", NULL, icon_bike_white);
|
||||
} else {
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Cycling", NULL, icon_bike_black);
|
||||
}
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Cycling", NULL, icon_bike);
|
||||
break;
|
||||
// Going by train / public transit
|
||||
case 2:
|
||||
if (highlighted) {
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Transit", NULL, icon_train_white);
|
||||
} else {
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Transit", NULL, icon_train_black);
|
||||
}
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Transit", NULL, icon_train);
|
||||
break;
|
||||
// walk
|
||||
case 3:
|
||||
if (highlighted) {
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Walk", NULL, icon_walk_white);
|
||||
} else {
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Walk", NULL, icon_walk_black);
|
||||
}
|
||||
menu_cell_basic_draw(ctx, cell_layer, "Walk", NULL, icon_walk);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -134,14 +112,10 @@ static void window_unload() {
|
||||
menu_layer_destroy(transit_mode_menu);
|
||||
|
||||
// Destroy all images
|
||||
gbitmap_destroy(icon_car_white);
|
||||
gbitmap_destroy(icon_car_black);
|
||||
gbitmap_destroy(icon_bike_white);
|
||||
gbitmap_destroy(icon_bike_black);
|
||||
gbitmap_destroy(icon_train_white);
|
||||
gbitmap_destroy(icon_train_black);
|
||||
gbitmap_destroy(icon_walk_white);
|
||||
gbitmap_destroy(icon_walk_black);
|
||||
gbitmap_destroy(icon_car);
|
||||
gbitmap_destroy(icon_bike);
|
||||
gbitmap_destroy(icon_train);
|
||||
gbitmap_destroy(icon_walk);
|
||||
|
||||
// Destroy the window
|
||||
window_destroy(window);
|
||||
@@ -175,14 +149,10 @@ static void window_load() {
|
||||
layer_add_child(window_layer, menu_layer_get_layer(transit_mode_menu));
|
||||
|
||||
// Load the icon images
|
||||
icon_car_white = gbitmap_create_with_resource(RESOURCE_ID_ICON_CAR_WHITE);
|
||||
icon_car_black = gbitmap_create_with_resource(RESOURCE_ID_ICON_CAR_BLACK);
|
||||
icon_bike_white = gbitmap_create_with_resource(RESOURCE_ID_ICON_BIKE_WHITE);
|
||||
icon_bike_black = gbitmap_create_with_resource(RESOURCE_ID_ICON_BIKE_BLACK);
|
||||
icon_train_white = gbitmap_create_with_resource(RESOURCE_ID_ICON_TRAIN_WHITE);
|
||||
icon_train_black = gbitmap_create_with_resource(RESOURCE_ID_ICON_TRAIN_BLACK);
|
||||
icon_walk_white = gbitmap_create_with_resource(RESOURCE_ID_ICON_WALK_WHITE);
|
||||
icon_walk_black = gbitmap_create_with_resource(RESOURCE_ID_ICON_WALK_BLACK);
|
||||
icon_car = gbitmap_create_with_resource(RESOURCE_ID_ICON_CAR);
|
||||
icon_bike = gbitmap_create_with_resource(RESOURCE_ID_ICON_BIKE);
|
||||
icon_train = gbitmap_create_with_resource(RESOURCE_ID_ICON_TRAIN);
|
||||
icon_walk = gbitmap_create_with_resource(RESOURCE_ID_ICON_WALK);
|
||||
}
|
||||
|
||||
// Push the window to the window stack
|
||||
|
||||