summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2014-07-04 18:30:00 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2014-07-04 18:30:00 +0100
commit6dfc8c9fc5f4e42e12516211bfa6415785dca660 (patch)
tree25d3f492105c4032d4c50eec016a6dcd89f9cbd1
parentde8671e68d75f23481cae419c9fd78805dbfc030 (diff)
downloadaskel-ja-uni-master.tar.bz2
cache root layer during window constructionHEADmaster
-rw-r--r--watchapp/src/watchapp.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/watchapp/src/watchapp.c b/watchapp/src/watchapp.c
index 8234b77..1765850 100644
--- a/watchapp/src/watchapp.c
+++ b/watchapp/src/watchapp.c
@@ -106,11 +106,12 @@ static void click_config_provider(void *context)
static void window_load(Window *window)
{
+ Layer *root_layer = window_get_root_layer(window);
window_set_fullscreen(window, true);
window_set_background_color(window, GColorBlack);
- GRect full = layer_get_bounds(window_get_root_layer(window));
+ GRect full = layer_get_bounds(root_layer);
full.size.h += 16; /* Account for status bar no longer shown */
- layer_set_bounds(window_get_root_layer(window), full);
+ layer_set_bounds(root_layer, full);
// Init the text layer used to show the time
time_layer = text_layer_create(GRect(4, 168-49-8, 144-4 /* width */, 49 /* height */));
text_layer_set_text_color(time_layer, GColorWhite);
@@ -151,12 +152,12 @@ static void window_load(Window *window)
layer_set_update_proc(line_layer, draw_line);
// And stuff the layers into the window
- layer_add_child(window_get_root_layer(window), text_layer_get_layer(time_layer));
- layer_add_child(window_get_root_layer(window), text_layer_get_layer(date_layer));
- layer_add_child(window_get_root_layer(window), text_layer_get_layer(step_layer));
- layer_add_child(window_get_root_layer(window), line_layer);
- layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(battery_layer));
- layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(mode_layer));
+ layer_add_child(root_layer, text_layer_get_layer(time_layer));
+ layer_add_child(root_layer, text_layer_get_layer(date_layer));
+ layer_add_child(root_layer, text_layer_get_layer(step_layer));
+ layer_add_child(root_layer, line_layer);
+ layer_add_child(root_layer, bitmap_layer_get_layer(battery_layer));
+ layer_add_child(root_layer, bitmap_layer_get_layer(mode_layer));
}
static void window_unload(Window *window)