final 1.0

* added a final icon
* changed the icons taken from material design to pebble seeding lang
icons
This commit is contained in:
dyedgreen
2016-06-25 20:45:22 +02:00
parent 170e527691
commit ba0cbd5e63
25 changed files with 52 additions and 90 deletions
+14 -32
View File
@@ -33,50 +33,26 @@
"resources": { "resources": {
"media": [ "media": [
{ {
"file": "images/car_black.png", "file": "images/car.png",
"name": "ICON_CAR_BLACK", "name": "ICON_CAR",
"targetPlatforms": null, "targetPlatforms": null,
"type": "bitmap" "type": "bitmap"
}, },
{ {
"file": "images/car_white.png", "file": "images/bike.png",
"name": "ICON_CAR_WHITE", "name": "ICON_BIKE",
"targetPlatforms": null, "targetPlatforms": null,
"type": "bitmap" "type": "bitmap"
}, },
{ {
"file": "images/train_black.png", "file": "images/train.png",
"name": "ICON_TRAIN_BLACK", "name": "ICON_TRAIN",
"targetPlatforms": null, "targetPlatforms": null,
"type": "bitmap" "type": "bitmap"
}, },
{ {
"file": "images/train_white.png", "file": "images/walk.png",
"name": "ICON_TRAIN_WHITE", "name": "ICON_WALK",
"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",
"targetPlatforms": null, "targetPlatforms": null,
"type": "bitmap" "type": "bitmap"
}, },
@@ -133,6 +109,12 @@
"name": "ICON_STEP_ATTR", "name": "ICON_STEP_ATTR",
"targetPlatforms": null, "targetPlatforms": null,
"type": "bitmap" "type": "bitmap"
},
{
"file": "images/step_final.png",
"name": "ICON_STEP_FINAL",
"targetPlatforms": null,
"type": "bitmap"
} }
] ]
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

After

Width:  |  Height:  |  Size: 317 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 451 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

+1 -1
View File
@@ -151,7 +151,7 @@ void directions_draw_step(GContext *ctx, GRect bounds, GColor color, char *text,
graphics_fill_rect(ctx, header_box, 0, GCornerNone); graphics_fill_rect(ctx, header_box, 0, GCornerNone);
// Draw icon // Draw icon
graphics_context_set_compositing_mode(ctx, GCompOpSet); 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 // Draw text
GRect text_box = GRect(7, 7 + header_box.size.h, bounds.size.w - 14, bounds.size.h - header_box.size.h - 14); 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); graphics_context_set_text_color(ctx, color_text);
+12 -9
View File
@@ -40,6 +40,7 @@ static GBitmap *icon_step_left;
static GBitmap *icon_step_uright; static GBitmap *icon_step_uright;
static GBitmap *icon_step_uleft; static GBitmap *icon_step_uleft;
static GBitmap *icon_step_attr; static GBitmap *icon_step_attr;
static GBitmap *icon_step_final;
// Dictation input // Dictation input
static DictationSession *dictation_session; static DictationSession *dictation_session;
@@ -105,6 +106,9 @@ static void draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex
case 'g': case 'g':
icon = icon_step_attr; icon = icon_step_attr;
break; break;
case 'h':
icon = icon_step_final;
break;
default: default:
icon = icon_step_type; icon = icon_step_type;
} }
@@ -344,6 +348,7 @@ static void window_unload() {
gbitmap_destroy(icon_step_uright); gbitmap_destroy(icon_step_uright);
gbitmap_destroy(icon_step_uleft); gbitmap_destroy(icon_step_uleft);
gbitmap_destroy(icon_step_attr); gbitmap_destroy(icon_step_attr);
gbitmap_destroy(icon_step_final);
} }
static void window_disappear() { static void window_disappear() {
@@ -413,19 +418,19 @@ static void window_load() {
switch (selected_type_enum) { switch (selected_type_enum) {
case 0: case 0:
// Car icon // 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; break;
case 1: case 1:
// Bike icon // 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; break;
case 2: case 2:
// Train icon // 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; break;
case 3: case 3:
// Walk icon // 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; break;
default: default:
// Forward icon // Forward icon
@@ -437,6 +442,7 @@ static void window_load() {
icon_step_uright = gbitmap_create_with_resource(RESOURCE_ID_ICON_STEP_URIGHT); 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_uleft = gbitmap_create_with_resource(RESOURCE_ID_ICON_STEP_ULEFT);
icon_step_attr = gbitmap_create_with_resource(RESOURCE_ID_ICON_STEP_ATTR); 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 // Push the window to the window stack
@@ -456,12 +462,9 @@ void directions_window_push() {
// Push window to screen // Push window to screen
window_stack_push(window, true); window_stack_push(window, true);
// Start the dictation session TODO: Change this for production // Start the dictation session
//dictation_session_start(dictation_session); dictation_session_start(dictation_session);
address = "Meerbusch an der alten Schule"; // WIP address string
// Open the connection to the phone // Open the connection to the phone
app_message_start(); app_message_start();
// TODO: Remove this for final version; this is a playeholder implementation (skipping the dictation)
app_message_send_search_data();
} }
+1
View File
@@ -116,6 +116,7 @@ function fetchAndSendRoute(routeType, searchText, messageNumber) {
console.log('Search text:', searchText); console.log('Search text:', searchText);
// Load a route from here api. Data format: { distance, time, stepList[string], stepIconsString } // Load a route from here api. Data format: { distance, time, stepList[string], stepIconsString }
locationService.createRoute(routeType, searchText, function(success, data) { 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); sendRoute(success, data.distance, data.time, data.stepList, data.stepIconsString, messageNumber);
}); });
} }
+8 -2
View File
@@ -39,6 +39,7 @@ function loadCurrentLocation(callback) {
navigator.geolocation.getCurrentPosition( navigator.geolocation.getCurrentPosition(
// Success // Success
function(pos) { function(pos) {
//callback(true, 52.5, 13.4); /* THIS IS FOR DEMO / SCREENSHOTS IN THE EMULATOR */
callback(true, pos.coords.latitude, pos.coords.longitude); callback(true, pos.coords.latitude, pos.coords.longitude);
}, },
// Error // Error
@@ -58,7 +59,7 @@ function loadLocationForSearch(searchText, currentLat, currentLon, callback) {
url = url.concat('&app_code=').concat(hereAppCode); url = url.concat('&app_code=').concat(hereAppCode);
url = url.concat('&gen=9'); /*don't break on here api update*/ url = url.concat('&gen=9'); /*don't break on here api update*/
url = url.concat('&searchtext=').concat(searchText.split(' ').join('+')); 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 // Perform an request
makeJsonHttpGetRequest(url, function(success, res) { makeJsonHttpGetRequest(url, function(success, res) {
if (success) { if (success) {
@@ -66,6 +67,7 @@ function loadLocationForSearch(searchText, currentLat, currentLon, callback) {
try { try {
var foundLat = res.Response.View[0].Result[0].Location.NavigationPosition[0].Latitude; var foundLat = res.Response.View[0].Result[0].Location.NavigationPosition[0].Latitude;
var foundLon = res.Response.View[0].Result[0].Location.NavigationPosition[0].Longitude; 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); callback(true, foundLat, foundLon);
} catch (e) { } catch (e) {
callback(false, 0, 0); callback(false, 0, 0);
@@ -90,6 +92,7 @@ function loadRouteData(routeType, fromLat, fromLon, toLat, toLon, callback) {
uRight: 'e', uRight: 'e',
uLeft: 'f', uLeft: 'f',
attr: 'g', attr: 'g',
final: 'h',
}; };
// Maps the direction retrived from here api to icon name // Maps the direction retrived from here api to icon name
var directionMap = { var directionMap = {
@@ -127,7 +130,10 @@ function loadRouteData(routeType, fromLat, fromLon, toLat, toLon, callback) {
// Add the text // Add the text
routeData.stepList[index] = step.instruction; routeData.stepList[index] = step.instruction;
// Add the icon // 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 // Display the specified icon
if (directionMap.hasOwnProperty(step.direction)) { if (directionMap.hasOwnProperty(step.direction)) {
routeData.stepIconsString = routeData.stepIconsString.concat(icons[directionMap[step.direction]]); routeData.stepIconsString = routeData.stepIconsString.concat(icons[directionMap[step.direction]]);
+16 -46
View File
@@ -9,14 +9,10 @@ static Window *window;
static MenuLayer *transit_mode_menu; static MenuLayer *transit_mode_menu;
// Transit mode icons // Transit mode icons
static GBitmap *icon_car_white; static GBitmap *icon_car;
static GBitmap *icon_car_black; static GBitmap *icon_bike;
static GBitmap *icon_bike_white; static GBitmap *icon_train;
static GBitmap *icon_bike_black; static GBitmap *icon_walk;
static GBitmap *icon_train_white;
static GBitmap *icon_train_black;
static GBitmap *icon_walk_white;
static GBitmap *icon_walk_black;
// Callback for number of rows // Callback for number of rows
static uint16_t get_num_rows_callback(struct MenuLayer *menu_layer, uint16_t section_index, void *context) { 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 // Draw menu cell callback
static void draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) { 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 // Determine what row to draw
switch (cell_index->row) { switch (cell_index->row) {
// Driving / Car // Driving / Car
case 0: case 0:
if (highlighted) { menu_cell_basic_draw(ctx, cell_layer, "Driving", NULL, icon_car);
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);
}
break; break;
// Riding the bike // Riding the bike
case 1: case 1:
if (highlighted) { menu_cell_basic_draw(ctx, cell_layer, "Cycling", NULL, icon_bike);
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);
}
break; break;
// Going by train / public transit // Going by train / public transit
case 2: case 2:
if (highlighted) { menu_cell_basic_draw(ctx, cell_layer, "Transit", NULL, icon_train);
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);
}
break; break;
// walk // walk
case 3: case 3:
if (highlighted) { menu_cell_basic_draw(ctx, cell_layer, "Walk", NULL, icon_walk);
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);
}
break; break;
} }
} }
@@ -134,14 +112,10 @@ static void window_unload() {
menu_layer_destroy(transit_mode_menu); menu_layer_destroy(transit_mode_menu);
// Destroy all images // Destroy all images
gbitmap_destroy(icon_car_white); gbitmap_destroy(icon_car);
gbitmap_destroy(icon_car_black); gbitmap_destroy(icon_bike);
gbitmap_destroy(icon_bike_white); gbitmap_destroy(icon_train);
gbitmap_destroy(icon_bike_black); gbitmap_destroy(icon_walk);
gbitmap_destroy(icon_train_white);
gbitmap_destroy(icon_train_black);
gbitmap_destroy(icon_walk_white);
gbitmap_destroy(icon_walk_black);
// Destroy the window // Destroy the window
window_destroy(window); window_destroy(window);
@@ -175,14 +149,10 @@ static void window_load() {
layer_add_child(window_layer, menu_layer_get_layer(transit_mode_menu)); layer_add_child(window_layer, menu_layer_get_layer(transit_mode_menu));
// Load the icon images // Load the icon images
icon_car_white = gbitmap_create_with_resource(RESOURCE_ID_ICON_CAR_WHITE); icon_car = gbitmap_create_with_resource(RESOURCE_ID_ICON_CAR);
icon_car_black = gbitmap_create_with_resource(RESOURCE_ID_ICON_CAR_BLACK); icon_bike = gbitmap_create_with_resource(RESOURCE_ID_ICON_BIKE);
icon_bike_white = gbitmap_create_with_resource(RESOURCE_ID_ICON_BIKE_WHITE); icon_train = gbitmap_create_with_resource(RESOURCE_ID_ICON_TRAIN);
icon_bike_black = gbitmap_create_with_resource(RESOURCE_ID_ICON_BIKE_BLACK); icon_walk = gbitmap_create_with_resource(RESOURCE_ID_ICON_WALK);
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);
} }
// Push the window to the window stack // Push the window to the window stack