2020#include "root_window.h"
2121#include "converse/session_window.h"
2222#include "menus/root_menu.h"
23+ #include "util/vector_layer.h"
2324
2425struct RootWindow {
2526 Window * window ;
2627 ActionBarLayer * action_bar ;
2728 SessionWindow * session_window ;
2829 GBitmap * dictation_icon ;
2930 GBitmap * more_icon ;
31+ GDrawCommandImage * pony_image ;
32+ GDrawCommandImage * speech_bubble_image ;
33+ VectorLayer * pony_layer ;
34+ VectorLayer * speech_bubble_layer ;
3035 TextLayer * time_layer ;
3136 TextLayer * blurb_layer ;
3237 EventHandle event_handle ;
@@ -49,24 +54,38 @@ RootWindow* root_window_create() {
4954 .appear = prv_window_appear ,
5055 .disappear = prv_window_disappear ,
5156 });
57+ window_set_background_color (window -> window , COLOR_FALLBACK (GColorRichBrilliantLavender , GColorWhite ));
5258 window -> dictation_icon = gbitmap_create_with_resource (RESOURCE_ID_DICTATION_ICON );
5359 window -> more_icon = gbitmap_create_with_resource (RESOURCE_ID_MORE_ICON );
5460 window -> action_bar = action_bar_layer_create ();
5561 action_bar_layer_set_context (window -> action_bar , window );
5662 action_bar_layer_set_icon (window -> action_bar , BUTTON_ID_SELECT , window -> dictation_icon );
5763 action_bar_layer_set_icon (window -> action_bar , BUTTON_ID_DOWN , window -> more_icon );
5864 window_set_user_data (window -> window , window );
59- window -> time_layer = text_layer_create (GRect (0 , 10 , 144 - ACTION_BAR_WIDTH , 40 ));
65+ window -> time_layer = text_layer_create (GRect (0 , 5 , 144 - ACTION_BAR_WIDTH , 40 ));
6066 window -> event_handle = NULL ;
6167 text_layer_set_text_alignment (window -> time_layer , GTextAlignmentCenter );
6268 text_layer_set_font (window -> time_layer , fonts_get_system_font (FONT_KEY_LECO_36_BOLD_NUMBERS ));
6369 text_layer_set_text (window -> time_layer , "12:34" );
70+ text_layer_set_background_color (window -> time_layer , GColorClear );
6471 layer_add_child (window_get_root_layer (window -> window ), (Layer * )window -> time_layer );
65- window -> blurb_layer = text_layer_create (GRect (5 , 55 , 144 - ACTION_BAR_WIDTH - 10 , 113 ));
66- text_layer_set_text_alignment (window -> blurb_layer , GTextAlignmentCenter );
67- text_layer_set_font (window -> blurb_layer , fonts_get_system_font (FONT_KEY_GOTHIC_24 ));
72+ window -> speech_bubble_image = gdraw_command_image_create_with_resource (RESOURCE_ID_ROOT_SCREEN_SPEECH_BUBBLE );
73+ window -> speech_bubble_layer = vector_layer_create (GRect (4 , 56 , 106 , 91 ));
74+ vector_layer_set_vector (window -> speech_bubble_layer , window -> speech_bubble_image );
75+ layer_add_child (window_get_root_layer (window -> window ), vector_layer_get_layer (window -> speech_bubble_layer ));
76+
77+ window -> pony_image = gdraw_command_image_create_with_resource (RESOURCE_ID_ROOT_SCREEN_PONY );
78+ window -> pony_layer = vector_layer_create (GRect (0 , 109 , 57 , 59 ));
79+ vector_layer_set_vector (window -> pony_layer , window -> pony_image );
80+ layer_add_child (window_get_root_layer (window -> window ), vector_layer_get_layer (window -> pony_layer ));
81+
82+ window -> blurb_layer = text_layer_create (GRect (15 , 55 , 95 , 80 ));
83+ text_layer_set_background_color (window -> blurb_layer , GColorClear );
84+ text_layer_set_text_alignment (window -> blurb_layer , GTextAlignmentLeft );
85+ text_layer_set_font (window -> blurb_layer , fonts_get_system_font (FONT_KEY_GOTHIC_24_BOLD ));
6886 text_layer_set_text (window -> blurb_layer , "Hello! How can I help you?" );
6987 layer_add_child (window_get_root_layer (window -> window ), (Layer * )window -> blurb_layer );
88+
7089 return window ;
7190}
7291
@@ -79,6 +98,12 @@ void root_window_destroy(RootWindow* window) {
7998 action_bar_layer_destroy (window -> action_bar );
8099 gbitmap_destroy (window -> dictation_icon );
81100 gbitmap_destroy (window -> more_icon );
101+ text_layer_destroy (window -> time_layer );
102+ text_layer_destroy (window -> blurb_layer );
103+ vector_layer_destroy (window -> pony_layer );
104+ vector_layer_destroy (window -> speech_bubble_layer );
105+ gdraw_command_image_destroy (window -> pony_image );
106+ gdraw_command_image_destroy (window -> speech_bubble_image );
82107 free (window );
83108}
84109
@@ -124,16 +149,16 @@ static void prv_time_changed(struct tm *tick_time, TimeUnits time_changed, void
124149 strftime (rw -> time_string , 6 , "%I:%M" , tick_time );
125150 }
126151 if (tick_time -> tm_hour >= 6 && tick_time -> tm_hour < 12 ) {
127- text_layer_set_text (rw -> blurb_layer , "Good morning! How can I help you today? " );
152+ text_layer_set_text (rw -> blurb_layer , "Good morning!" );
128153 } else if (tick_time -> tm_hour >= 12 && tick_time -> tm_hour < 18 ) {
129- text_layer_set_text (rw -> blurb_layer , "Good afternoon! How can I help you today? " );
154+ text_layer_set_text (rw -> blurb_layer , "Good afternoon!" );
130155 } else if (tick_time -> tm_hour >= 18 && tick_time -> tm_hour < 22 ) {
131- text_layer_set_text (rw -> blurb_layer , "Good evening! How can I help you today? " );
156+ text_layer_set_text (rw -> blurb_layer , "Good evening!" );
132157 } else {
133- text_layer_set_text (rw -> blurb_layer , "Hello there! How can I help you tonight? " );
158+ text_layer_set_text (rw -> blurb_layer , "Hello there!" );
134159 }
135160 text_layer_set_text (rw -> time_layer , rw -> time_string );
136- };
161+ }
137162
138163static void prv_click_config_provider (void * context ) {
139164 window_single_click_subscribe (BUTTON_ID_SELECT , prv_prompt_clicked );
@@ -145,5 +170,5 @@ static void prv_prompt_clicked(ClickRecognizerRef recognizer, void *context) {
145170}
146171
147172static void prv_more_clicked (ClickRecognizerRef recognizer , void * context ) {
148- root_menu_window_push ();
149- }
173+ root_menu_window_push ();
174+ }
0 commit comments