Пример #1
0
void main_window_load(Window *window) 
{
  Layer *window_layer = window_get_root_layer(window);
  GRect window_bounds = layer_get_bounds(window_layer);
  window_set_background_color(window,  GColorBlack );
  
  LOCAL_action_bar = action_bar_layer_create();
  
  
  for ( int loop = 0; loop < N_LAYERS; loop ++ )
  {
     local_create_layer( window_layer, &window_bounds, loop );
  }
  action_bar_layer_add_to_window(LOCAL_action_bar, window);

  // then add status bar  
  LOCAL_status_bar = status_bar_layer_create();
  int16_t width = layer_get_bounds(window_layer).size.w - ACTION_BAR_WIDTH;
  GRect frame = GRect(0, 0, width, STATUS_BAR_LAYER_HEIGHT);
  layer_set_frame(status_bar_layer_get_layer(LOCAL_status_bar), frame);
  layer_add_child(window_layer, status_bar_layer_get_layer(LOCAL_status_bar));  
   
  // Update all
  main_window_reload_config();
  main_window_update_elapsed( time(NULL) );  
}
Пример #2
0
static void initialise_ui(void) {
  s_window = window_create();
  window_set_fullscreen(s_window, false);
  
  s_res_image_action_increment = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_INCREMENT);
  s_res_image_action_decrement = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_DECREMENT);
  s_res_font_dd_50 = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_DD_50));
  s_res_gothic_18 = fonts_get_system_font(FONT_KEY_GOTHIC_18);
  // action_bar_layer
  action_bar_layer = action_bar_layer_create();
  action_bar_layer_add_to_window(action_bar_layer, s_window);
  action_bar_layer_set_background_color(action_bar_layer, GColorWhite);
  action_bar_layer_set_icon(action_bar_layer, BUTTON_ID_UP, s_res_image_action_increment);
  action_bar_layer_set_icon(action_bar_layer, BUTTON_ID_DOWN, s_res_image_action_decrement);
  layer_add_child(window_get_root_layer(s_window), (Layer *)action_bar_layer);
  
  // number_text_layer
  number_text_layer = text_layer_create(GRect(6, 39, 116, 50));
  text_layer_set_text(number_text_layer, "0");
  text_layer_set_text_alignment(number_text_layer, GTextAlignmentCenter);
  text_layer_set_font(number_text_layer, s_res_font_dd_50);
  layer_add_child(window_get_root_layer(s_window), (Layer *)number_text_layer);
  
  // title_text_layer
  title_text_layer = text_layer_create(GRect(2, 93, 123, 20));
  text_layer_set_text(title_text_layer, "Text layer");
  text_layer_set_text_alignment(title_text_layer, GTextAlignmentCenter);
  text_layer_set_font(title_text_layer, s_res_gothic_18);
  layer_add_child(window_get_root_layer(s_window), (Layer *)title_text_layer);
}
static void main_window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);

  s_action_bar = action_bar_layer_create();
  action_bar_layer_add_to_window(s_action_bar, window);
  action_bar_layer_set_click_config_provider(s_action_bar, click_config_provider);

  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_UP, s_icon_plus);
  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_DOWN, s_icon_minus);

  int width = layer_get_frame(window_layer).size.w - ACTION_BAR_WIDTH - 3;

  s_header_layer = text_layer_create(GRect(4, 0, width, 60));
  text_layer_set_font(s_header_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
  text_layer_set_background_color(s_header_layer, GColorClear);
  text_layer_set_text(s_header_layer, "Drink Counter");
  layer_add_child(window_layer, text_layer_get_layer(s_header_layer));

  s_body_layer = text_layer_create(GRect(4, 44, width, 60));
  text_layer_set_font(s_body_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
  text_layer_set_background_color(s_body_layer, GColorClear);
  layer_add_child(window_layer, text_layer_get_layer(s_body_layer));

  s_label_layer = text_layer_create(GRect(4, 44 + 28, width, 60));
  text_layer_set_font(s_label_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18));
  text_layer_set_background_color(s_label_layer, GColorClear);
  text_layer_set_text(s_label_layer, "of drinks on the wall");
  layer_add_child(window_layer, text_layer_get_layer(s_label_layer));

  update_text();
}
Пример #4
0
void scores_name_window_load (Window *window) {
	GRect windowBounds = layer_get_frame(ui.windowLayer);
	GRect titleBounds = GRect(0, 0, 120, 30);
	ui.titleLayer = text_layer_create(titleBounds);
	text_layer_set_text_color(ui.titleLayer, GColorWhite);
	text_layer_set_background_color(ui.titleLayer, GColorBlack);
	text_layer_set_text(ui.titleLayer, "  Enter Name");
  	text_layer_set_font(ui.titleLayer, fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD));
  	text_layer_set_text_alignment(ui.titleLayer, GTextAlignmentLeft);
	layer_add_child(ui.windowLayer, text_layer_get_layer(ui.titleLayer));
	
	ui.frontArrow = gbitmap_create_with_resource(RESOURCE_ID_FRONT_ARROW);
	ui.backArrow = gbitmap_create_with_resource(RESOURCE_ID_BACK_ARROW);
	ui.nextArrow = gbitmap_create_with_resource(RESOURCE_ID_NEXT_ARROW);
	
	ui.actionBarLayer = action_bar_layer_create();
	action_bar_layer_add_to_window(ui.actionBarLayer, ui.window);
	action_bar_layer_set_click_config_provider(ui.actionBarLayer, scores_name_click_config_provider);
	action_bar_layer_set_icon(ui.actionBarLayer, BUTTON_ID_UP, ui.backArrow);
	action_bar_layer_set_icon(ui.actionBarLayer, BUTTON_ID_DOWN, ui.frontArrow);
	action_bar_layer_set_icon(ui.actionBarLayer, BUTTON_ID_SELECT, ui.nextArrow);
	
	GRect selectorBounds = GRect(100, 30, 20, (windowBounds.size.h - 30));
	ui.selectorLayer = text_layer_create(selectorBounds);
	text_layer_set_text_color(ui.selectorLayer, GColorClear);
	text_layer_set_background_color(ui.selectorLayer, GColorBlack);
	text_layer_set_text(ui.selectorLayer, "");
  	text_layer_set_font(ui.selectorLayer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
  	text_layer_set_text_alignment(ui.selectorLayer, GTextAlignmentCenter);
	layer_add_child(ui.windowLayer, text_layer_get_layer(ui.selectorLayer));
	
	GRect activeBounds = GRect(20, 70, 60, 1);
	ui.activeLayer = text_layer_create(activeBounds);
	text_layer_set_text_color(ui.activeLayer, GColorClear);
	text_layer_set_background_color(ui.activeLayer, GColorBlack);
	text_layer_set_text(ui.activeLayer, "");
  	text_layer_set_font(ui.activeLayer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
  	text_layer_set_text_alignment(ui.activeLayer, GTextAlignmentCenter);
	layer_add_child(ui.windowLayer, text_layer_get_layer(ui.activeLayer));
	
	int r, c, x = 0, y = 0, index = 0;
	for (c=5;c>=0;c--) {
		x = (c + 1) * 5 + (c * 15);
		
		for (r=0;r<3;r++) {
			y = (r + 1) * 40;
			index = status.indexes[r] - (5 - c);
			if (index < 0) index = 25 + (index + 1);
			
			GRect letterBounds = GRect(x, y, 30, 30);
			ui.letterLayers[c][r] = text_layer_create(letterBounds);
			text_layer_set_text_color(ui.letterLayers[c][r], ((c >= 5)?GColorWhite:GColorBlack));
			text_layer_set_background_color(ui.letterLayers[c][r], GColorClear);
			text_layer_set_text(ui.letterLayers[c][r], letters[index]);
			text_layer_set_font(ui.letterLayers[c][r], fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
			text_layer_set_text_alignment(ui.letterLayers[c][r], GTextAlignmentLeft);
			layer_add_child(ui.windowLayer, text_layer_get_layer(ui.letterLayers[c][r]));
		}
	}
}
Пример #5
0
static void initialise_ui(void) {
    s_window = window_create();
    window_set_fullscreen(s_window, true);

    s_res_yes = gbitmap_create_with_resource(RESOURCE_ID_YES);
    s_res_no = gbitmap_create_with_resource(RESOURCE_ID_NO);
    s_res_gothic_24 = fonts_get_system_font(FONT_KEY_GOTHIC_24);
    s_res_gothic_24_bold = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);
    // s_actionbarlayer_1
    s_actionbarlayer_1 = action_bar_layer_create();
    action_bar_layer_add_to_window(s_actionbarlayer_1, s_window);
    action_bar_layer_set_background_color(s_actionbarlayer_1, GColorBlack);
    action_bar_layer_set_icon(s_actionbarlayer_1, BUTTON_ID_UP, s_res_yes);
    action_bar_layer_set_icon(s_actionbarlayer_1, BUTTON_ID_DOWN, s_res_no);
    layer_add_child(window_get_root_layer(s_window), (Layer *)s_actionbarlayer_1);

    // s_textlayer_1
    s_textlayer_1 = text_layer_create(GRect(6, 14, 114, 99));
    text_layer_set_text(s_textlayer_1, "You're close to a weighing machine!");
    text_layer_set_text_alignment(s_textlayer_1, GTextAlignmentCenter);
    text_layer_set_font(s_textlayer_1, s_res_gothic_24);
    layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_1);

    // s_textlayer_2
    s_textlayer_2 = text_layer_create(GRect(12, 99, 100, 57));
    text_layer_set_text(s_textlayer_2, "Input your weight?");
    text_layer_set_text_alignment(s_textlayer_2, GTextAlignmentCenter);
    text_layer_set_font(s_textlayer_2, s_res_gothic_24_bold);
    layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_2);
}
Пример #6
0
static void initialise_ui(void) {
    s_window = window_create();
    window_set_background_color(s_window, GColorBlack);
    IF_2(window_set_fullscreen(s_window, true));

    s_res_img_upaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_UPACTION);
    s_res_img_nextaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_NEXTACTION);
    s_res_img_downaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_DOWNACTION);
    s_res_gothic_18_bold = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);
    s_res_bitham_30_black = fonts_get_system_font(FONT_KEY_BITHAM_30_BLACK);
    // action_layer
    action_layer = action_bar_layer_create();
    action_bar_layer_add_to_window(action_layer, s_window);
    action_bar_layer_set_background_color(action_layer, GColorWhite);
    action_bar_layer_set_icon(action_layer, BUTTON_ID_UP, s_res_img_upaction);
    action_bar_layer_set_icon(action_layer, BUTTON_ID_SELECT, s_res_img_nextaction);
    action_bar_layer_set_icon(action_layer, BUTTON_ID_DOWN, s_res_img_downaction);
    layer_set_frame(action_bar_layer_get_layer(action_layer), GRect(124, 0, 20, 168));
    IF_3(layer_set_bounds(action_bar_layer_get_layer(action_layer), GRect(-5, 0, 30, 168)));
    layer_add_child(window_get_root_layer(s_window), (Layer *)action_layer);

    time_layer = layer_create(GRect(0, 0, 124, 168));
    layer_set_update_proc(time_layer, draw_time);
    layer_add_child(window_get_root_layer(s_window), time_layer);
}
Пример #7
0
void action_bar_nav_v_kodi(Window *window){
  // Initialize the action bar:
  action_bar = action_bar_layer_create();
  action_bar_layer_set_background_color(action_bar, GColorGreen);
  // Associate the action bar with the window:
  action_bar_layer_add_to_window(action_bar, window);
  // Set the click config provider:
  action_bar_layer_set_click_config_provider(action_bar, click_config_provider_kodi_nav_v);

  // Set the icons:
  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ICON_DOTV);
  // The loading of the icons is omitted for brevity... See gbitmap_create_with_resource()
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_SELECT, s_background_bitmap, true);
  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ICON_UP);
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_UP, s_background_bitmap, true);
  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ICON_DOWN);
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_DOWN, s_background_bitmap, true);

  // Use tap service? If not, use data service
  if (TAP_NOT_DATA) {
    // Subscribe to the accelerometer tap service
    accel_tap_service_subscribe(tap_handler_kodi_nav_v);
  } else {
    // Subscribe to the accelerometer data service
    int num_samples = 3;
    accel_data_service_subscribe(num_samples, data_handler);

    // Choose update rate
    accel_service_set_sampling_rate(ACCEL_SAMPLING_10HZ);
  }
}
Пример #8
0
static void main_window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect window_bounds = layer_get_bounds(window_layer);
  window_set_background_color(s_main_window, GColorMalachite);
  
  s_bitmap = gbitmap_create_with_resource(RESOURCE_ID_FACE);
  s_bitmap_layer = bitmap_layer_create(window_bounds);
  bitmap_layer_set_bitmap(s_bitmap_layer, s_bitmap);
  bitmap_layer_set_compositing_mode(s_bitmap_layer, GCompOpSet);
  layer_add_child(window_layer, bitmap_layer_get_layer(s_bitmap_layer));

  action_bar = action_bar_layer_create();
  action_bar_layer_add_to_window(action_bar, s_main_window);
  action_bar_layer_set_click_config_provider(action_bar, click_config_provider);
  
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_UP, menu_daily_up, true);
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_SELECT, menu_stats_select, true);
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_DOWN, menu_settings_down, true);
    
  s_output_layer = text_layer_create(GRect(5, 0, window_bounds.size.w - 5, window_bounds.size.h));
  text_layer_set_font(s_output_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
  text_layer_set_background_color(s_output_layer, GColorClear);
  text_layer_set_text(s_output_layer, "Press a Button");
  text_layer_set_text_alignment(s_output_layer, PBL_IF_ROUND_ELSE(GTextAlignmentCenter, GTextAlignmentLeft));
  
  layer_add_child(window_layer, text_layer_get_layer(s_output_layer));
}
Пример #9
0
static void initialize_ui() {
  s_window = window_create();
  window_set_fullscreen(s_window, false);
  window_set_background_color(s_window, GColorBlack);
  Layer *window_layer = window_get_root_layer(s_window);
  GRect bounds = layer_get_frame(window_layer);
  
  s_icon_vol_up = gbitmap_create_with_resource(RESOURCE_ID_ICON_VOL_UP);
  s_icon_pause = gbitmap_create_with_resource(RESOURCE_ID_ICON_PAUSE);
  s_icon_play = gbitmap_create_with_resource(RESOURCE_ID_ICON_PLAY);
  s_icon_vol_dn = gbitmap_create_with_resource(RESOURCE_ID_ICON_VOL_DN);
  s_icon_speaker = gbitmap_create_with_resource(RESOURCE_ID_ICON_SPEAKER);
  s_res_gothic_24_bold = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);
  s_res_gothic_18 = fonts_get_system_font(FONT_KEY_GOTHIC_18);

  // s_lyr_backround
  s_lyr_background = layer_create(bounds);
  layer_set_update_proc(s_lyr_background, lyr_background_update_proc);
  layer_add_child(window_layer, (Layer *) s_lyr_background);
  // s_player_bar
  s_action_bar = action_bar_layer_create();
  action_bar_layer_add_to_window(s_action_bar, s_window);
  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_UP, s_icon_vol_up);
  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_SELECT, s_icon_pause);
  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_DOWN, s_icon_vol_dn);
  action_bar_layer_set_click_config_provider(s_action_bar, click_provider);
  layer_add_child(window_layer, (Layer *) s_action_bar);
  // s_txt_title
  s_txt_title = text_layer_create(GRect(4, 0, 116, 76));
  text_layer_set_background_color(s_txt_title, GColorClear);
  text_layer_set_text_color(s_txt_title, GColorWhite);
  text_layer_set_text_alignment(s_txt_title, GTextAlignmentCenter);
  text_layer_set_font(s_txt_title, s_res_gothic_24_bold);
  text_layer_set_text(s_txt_title, "Loading...");
  layer_add_child(window_layer, (Layer *) s_txt_title);
  // s_txt_artist
  s_txt_artist = text_layer_create(GRect(4, 78, 116, 56));
  text_layer_set_background_color(s_txt_artist, GColorClear);
  text_layer_set_text_color(s_txt_artist, GColorWhite);
  text_layer_set_text_alignment(s_txt_artist, GTextAlignmentCenter);
  text_layer_set_font(s_txt_artist, s_res_gothic_18);
  layer_add_child(window_layer, (Layer *) s_txt_artist);
  // s_bmap_speaker
  s_bmp_speaker = bitmap_layer_create(GRect(2, 134, 8, 12));
  bitmap_layer_set_bitmap(s_bmp_speaker, s_icon_speaker);
  layer_add_child(window_layer, (Layer *) s_bmp_speaker);
  // s_lyr_volume
  s_lyr_volume = layer_create_with_data(GRect(16, 136, 100, 8), sizeof(uint32_t));
  layer_set_update_proc(s_lyr_volume, lyr_volume_update_proc);
  uint32_t *len = (uint32_t *) layer_get_data(s_lyr_volume);
	*len = 0;
  layer_add_child(window_layer, (Layer *) s_lyr_volume);
  
  app_message_register_inbox_received(inbox_received_callback);
  app_message_register_inbox_dropped(inbox_dropped_callback);

  outbox_send("GET_STATUS");
}
Пример #10
0
static void main_window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  APP_LOG(APP_LOG_LEVEL_DEBUG, "window height = %d", layer_get_frame(window_layer).size.h);

  s_action_bar = action_bar_layer_create();
  action_bar_layer_add_to_window(s_action_bar, window);
  action_bar_layer_set_click_config_provider(s_action_bar, 
                                             click_config_provider);

  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_UP, s_icon_plus);
  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_DOWN, s_icon_minus);
  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_SELECT, s_icon_done);
  
  
  int width = layer_get_frame(window_layer).size.w - ACTION_BAR_WIDTH - 3;

  // Header Text Layer
  s_header_layer = text_layer_create(GRect(4, 0, width, 60));
  text_layer_set_font(s_header_layer, 
                      fonts_get_system_font(FONT_KEY_GOTHIC_24));
  text_layer_set_background_color(s_header_layer, GColorClear);
  text_layer_set_text(s_header_layer, "Mood Tracker");
  layer_add_child(window_layer, text_layer_get_layer(s_header_layer));

  // Body Text Layer
  s_body_layer = text_layer_create(GRect(4, 44, width, 60));
  text_layer_set_font(s_body_layer, 
                      fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
  text_layer_set_background_color(s_body_layer, GColorClear);
  layer_add_child(window_layer, text_layer_get_layer(s_body_layer));

  // Label Text Layer
  s_label_layer = text_layer_create(GRect(4, 44 + 28, width, 60));
  text_layer_set_font(s_label_layer, 
                      fonts_get_system_font(FONT_KEY_GOTHIC_18));
  text_layer_set_background_color(s_label_layer, GColorClear);
  
  text_layer_set_text(s_label_layer, "of mood today");
  layer_add_child(window_layer, text_layer_get_layer(s_label_layer));
  
#ifdef PBL_COLOR
  // Set the Window background color to a color that is similar to hospital 
  // walls
  window_set_background_color(window, GColorCadetBlue);
  // Set the actionbar background color to a color that is similar to medical 
  // staff uniforms
  action_bar_layer_set_background_color(s_action_bar, GColorCobaltBlue);
  
  text_layer_set_text_color(s_header_layer, GColorBlack);
  text_layer_set_text_color(s_body_layer, GColorBlack);
  text_layer_set_text_color(s_label_layer, GColorBlack);
#endif

  update_text();
}
Пример #11
0
void action_bar_init(Window* window) {
  // Initialize the action bar:
  action_bar = action_bar_layer_create();
  action_bar_layer_add_to_window(action_bar, window);
  action_bar_layer_set_click_config_provider(action_bar, click_config_provider);

  action_bar_layer_set_icon(action_bar, BUTTON_ID_UP, start_button);
  action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, next_button);
  //action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, reset_buttonp);
  action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, menu_button);
}
Пример #12
0
static void windows_squeezebox_load(Window *window){
  // layer_mark_dirty(simple_menu_layer_get_layer(s_simple_menu_layer));

  // Initialize the action bar:
  action_bar = action_bar_layer_create();
  action_bar_layer_set_background_color(action_bar, GColorRed);
  // Associate the action bar with the window:
  action_bar_layer_add_to_window(action_bar, window);
  // Set the click config provider:
  action_bar_layer_set_click_config_provider(action_bar, click_config_provider2);

  // Set the icons:
  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ICON_PLAY);
  // The loading of the icons is omitted for brevity... See gbitmap_create_with_resource()
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_SELECT, s_background_bitmap, true);
  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ICON_PREVIOUS);
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_UP, s_background_bitmap, true);
  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ICON_NEXT);
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_DOWN, s_background_bitmap, true);

  // Create title TextLayer
  s_title_info_layer = text_layer_create(GRect(0, 30, 144, 25));
  text_layer_set_background_color(s_title_info_layer, GColorClear);
  text_layer_set_text_color(s_title_info_layer, GColorRed);
  text_layer_set_text(s_title_info_layer, "title");
  // s_weather_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_PERFECT_DOS_20));
  // text_layer_set_font(s_title_info_layer, s_weather_font);
  // Add it as a child layer to the Window's root layer
  layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_title_info_layer));

  // Create album TextLayer
  s_album_info_layer = text_layer_create(GRect(0, 60, 144, 25));
  text_layer_set_background_color(s_album_info_layer, GColorClear);
  text_layer_set_text_color(s_album_info_layer, GColorRed);
  text_layer_set_text(s_album_info_layer, "album");
  // s_weather_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_PERFECT_DOS_20));
  // text_layer_set_font(s_album_info_layer, s_weather_font);
  // Add it as a child layer to the Window's root layer
  layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_album_info_layer));

  // Create artist TextLayer
  s_artist_info_layer = text_layer_create(GRect(0, 90, 144, 25));
  text_layer_set_background_color(s_artist_info_layer, GColorClear);
  text_layer_set_text_color(s_artist_info_layer, GColorRed);
  text_layer_set_text(s_artist_info_layer, "artist");
  // s_weather_font = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_PERFECT_DOS_20));
  // text_layer_set_font(s_artist_info_layer, s_weather_font);
  // Add it as a child layer to the Window's root layer
  layer_add_child(window_get_root_layer(window), text_layer_get_layer(s_artist_info_layer));

  //Request track info
  send_int("sb", "track_info");
}
Пример #13
0
static void main_window_load(Window *window) {
// Create time TextLayer
//   s_time_layer = text_layer_create(GRect(0, 55, 144, 50));
//   text_layer_set_background_color(s_time_layer, GColorClear);
//   text_layer_set_text_color(s_time_layer, GColorBlack);
  
  s_res_gothic_18_bold = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);
  s_res_logo = gbitmap_create_with_resource(RESOURCE_ID_BILL);
  // s_actionbar
  s_actionbar = action_bar_layer_create();
  action_bar_layer_add_to_window(s_actionbar, s_window);
  action_bar_layer_set_background_color(s_actionbar, GColorClear);
  action_bar_layer_set_icon(s_actionbar, BUTTON_ID_SELECT, s_res_logo);
  action_bar_layer_set_click_config_provider(s_actionbar, click_config_provider);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_actionbar);
  rbl = rot_bitmap_layer_create(arrow);
  GRect gr = layer_get_frame((Layer *)rbl);
  gr.origin.x = 35;
  gr.origin.y = 25;
  layer_set_frame((Layer *)rbl, gr);
  s_time = text_layer_create(GRect(0, 110, 144, 30));
  text_layer_set_text(s_time, "20 m away");
  text_layer_set_text_alignment(s_time, GTextAlignmentCenter);
  layer_add_child(window_get_root_layer(window), (Layer *)s_time);
  s_name = text_layer_create(GRect(0, 130, 144, 30));
  text_layer_set_background_color(s_name, GColorBlack);
  text_layer_set_text_color(s_name, GColorWhite);
  text_layer_set_text(s_name, "Md. Nafees");
  text_layer_set_text_alignment(s_name, GTextAlignmentCenter);
  layer_add_child(window_get_root_layer(window), (Layer *)s_name);
//   int h = 1337;
//   snprintf(buf, 100, "%d", h);
//   text_layer_set_text(s_time_layer, buf);
  
  
  // s_orderid
  s_orderid = text_layer_create(GRect(0, 0, 144, 24));
  text_layer_set_background_color(s_orderid, GColorBlack);
  text_layer_set_text_color(s_orderid, GColorWhite);
  text_layer_set_text(s_orderid, "Order #1337");
  text_layer_set_text_alignment(s_orderid, GTextAlignmentCenter);
  text_layer_set_font(s_orderid, s_res_gothic_18_bold);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_orderid);
  
  //rot_bitmap_layer_create()

  // Improve the layout to be more like a watchface
//   text_layer_set_font(s_time_layer, fonts_get_system_font(FONT_KEY_BITHAM_42_BOLD));
//   text_layer_set_text_alignment(s_time_layer, GTextAlignmentCenter);

  // Add it as a child layer to the Window's root layer
  layer_add_child(window_get_root_layer(window), (Layer *)(rbl));
}
Пример #14
0
// initializes action bar
static void action_bar_init(Window *window) {
  GBitmap *add_icon = gbitmap_create_with_resource(RESOURCE_IDS[0]);
  GBitmap *subtract_icon = gbitmap_create_with_resource(RESOURCE_IDS[1]);
  GBitmap *stroke_icon = gbitmap_create_with_resource(RESOURCE_IDS[2]);

  action_bar_layer = action_bar_layer_create();
  action_bar_layer_add_to_window(action_bar_layer, window);
  action_bar_layer_set_click_config_provider(action_bar_layer, click_config_provider);
  action_bar_layer_set_icon(action_bar_layer, BUTTON_ID_UP, add_icon);
  action_bar_layer_set_icon(action_bar_layer, BUTTON_ID_SELECT, stroke_icon);
  action_bar_layer_set_icon(action_bar_layer, BUTTON_ID_DOWN, subtract_icon);
}
Пример #15
0
static void initialise_ui(void) {
  
  s_window = window_create();
  Layer *root_layer = window_get_root_layer(s_window);
  GRect bounds = layer_get_bounds(root_layer); 
  window_set_background_color(s_window, COLOR_FALLBACK(GColorBulgarianRose, GColorBlack)); 
  IF_2(window_set_fullscreen(s_window, false));
  
#ifdef PBL_ROUND
  int dev_layer_left = (bounds.size.w - DEV_LAYER_WIDTH)/2;
  int dev_layer_top = (bounds.size.h - DEV_LAYER_HEIGHT)/2;
#else
  int dev_layer_left = ((bounds.size.w - DEV_LAYER_WIDTH - ACTION_BAR_WIDTH)/2) + 4;
  int dev_layer_top = ((bounds.size.h - DEV_LAYER_HEIGHT - 14)/2) + IF_32(14, 0);
#endif
  
  s_rect_above = GRect(dev_layer_left, -(DEV_LAYER_HEIGHT+2), DEV_LAYER_WIDTH, DEV_LAYER_HEIGHT);
  s_rect_onscreen = GRect(dev_layer_left, dev_layer_top, DEV_LAYER_WIDTH, DEV_LAYER_HEIGHT);
  s_rect_below = GRect(dev_layer_left, bounds.size.h+2, DEV_LAYER_WIDTH, DEV_LAYER_HEIGHT);
  
  // s_devicecard_layer
  s_devicecard_layer = devicecard_layer_create(s_rect_onscreen);
  layer_add_child(root_layer, s_devicecard_layer->layer);
  
  // s_layer_spots
  s_layer_spots = layer_create(PBL_IF_RECT_ELSE(GRect((dev_layer_left/2)-SPOT_RADIUS, dev_layer_top, 
                                                (SPOT_RADIUS*2)+1 , DEV_LAYER_HEIGHT), bounds));
  layer_add_child(root_layer, (Layer *)s_layer_spots);
  
#ifndef PBL_SDK_2
  s_status_bar = status_bar_layer_create();
  status_bar_layer_set_colors(s_status_bar, COLOR_FALLBACK(GColorBulgarianRose, GColorBlack), GColorWhite);
  layer_add_child(root_layer, status_bar_layer_get_layer(s_status_bar));
#endif
  
  s_res_image_action_up = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_UP);
  s_res_image_action_set = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_SET);
  s_res_image_action_down = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_DOWN);
  
  // s_actionbar_main
  s_actionbar_main = action_bar_layer_create();
  action_bar_layer_add_to_window(s_actionbar_main, s_window);
  action_bar_layer_set_background_color(s_actionbar_main, GColorWhite);
  action_bar_layer_set_icon(s_actionbar_main, BUTTON_ID_UP, s_res_image_action_up);
  action_bar_layer_set_icon(s_actionbar_main, BUTTON_ID_SELECT, s_res_image_action_set);
  action_bar_layer_set_icon(s_actionbar_main, BUTTON_ID_DOWN, s_res_image_action_down);
#ifdef PBL_RECT
  layer_set_frame(action_bar_layer_get_layer(s_actionbar_main), GRect(bounds.size.w-20, 0, 20, bounds.size.h));
  IF_3(layer_set_bounds(action_bar_layer_get_layer(s_actionbar_main), GRect(-5, 0, 30, bounds.size.h)));
#endif
  layer_add_child(root_layer, (Layer *)s_actionbar_main);
}
Пример #16
0
static void window_load(Window *window) {
	action_bar = action_bar_layer_create();
	action_bar_layer_add_to_window(action_bar, window);
	action_bar_layer_set_click_config_provider(action_bar, click_config_provider);

	action_bar_layer_set_icon(action_bar, BUTTON_ID_UP, action_icon_vol_up);
	action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, action_icon_vol_down);
	action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, action_icon_play);

	Layer *window_layer = window_get_root_layer(window);
	GRect bounds = layer_get_bounds(window_layer);

	title_layer = text_layer_create((GRect) { .origin = { 5, 0 }, .size = { bounds.size.w - 28, 52 } });
Пример #17
0
static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);

  s_icon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CONFIRM);

  const GEdgeInsets icon_insets = {.top = 7, .right = 28, .bottom = 56, .left = 14};
  s_icon_layer = bitmap_layer_create(grect_inset(bounds, icon_insets));
  bitmap_layer_set_bitmap(s_icon_layer, s_icon_bitmap);
  bitmap_layer_set_compositing_mode(s_icon_layer, GCompOpSet);
  layer_add_child(window_layer, bitmap_layer_get_layer(s_icon_layer));

  const GEdgeInsets label_insets = {.top = 112, .right = ACTION_BAR_WIDTH, .left = ACTION_BAR_WIDTH / 2};
  s_label_layer = text_layer_create(grect_inset(bounds, label_insets));
  text_layer_set_text(s_label_layer, DIALOG_CHOICE_WINDOW_MESSAGE);
  text_layer_set_background_color(s_label_layer, GColorClear);
  text_layer_set_text_alignment(s_label_layer, GTextAlignmentCenter);
  text_layer_set_font(s_label_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD));
  layer_add_child(window_layer, text_layer_get_layer(s_label_layer));

  s_tick_bitmap = gbitmap_create_with_resource(RESOURCE_ID_TICK);
  s_cross_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CROSS);

  s_action_bar_layer = action_bar_layer_create();
  action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_UP, s_tick_bitmap);
  action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_DOWN, s_cross_bitmap);
  action_bar_layer_add_to_window(s_action_bar_layer, window);
}

static void window_unload(Window *window) {
  text_layer_destroy(s_label_layer);
  action_bar_layer_destroy(s_action_bar_layer);
  bitmap_layer_destroy(s_icon_layer);

  gbitmap_destroy(s_icon_bitmap);
  gbitmap_destroy(s_tick_bitmap);
  gbitmap_destroy(s_cross_bitmap);

  window_destroy(window);
  s_main_window = NULL;
}

void dialog_choice_window_push() {
  if(!s_main_window) {
    s_main_window = window_create();
    window_set_background_color(s_main_window, PBL_IF_COLOR_ELSE(GColorJaegerGreen, GColorWhite));
    window_set_window_handlers(s_main_window, (WindowHandlers) {
        .load = window_load,
        .unload = window_unload,
    });
  }
static void action_bar_setup(Window *window)
{
  abl_action = action_bar_layer_create();
  action_bar_layer_add_to_window(abl_action, window);
  action_bar_layer_set_click_config_provider(abl_action, abl_click_config_provider);

  gb_arrow_up = gbitmap_create_with_resource(RESOURCE_ID_ARROW_UP);
  gb_arrow_down = gbitmap_create_with_resource(RESOURCE_ID_ARROW_DOWN);
  gb_arrow_reload = gbitmap_create_with_resource(RESOURCE_ID_ARROW_RELOAD);

  action_bar_layer_set_icon(abl_action, BUTTON_ID_UP, gb_arrow_up);
  action_bar_layer_set_icon(abl_action, BUTTON_ID_DOWN, gb_arrow_down);
  action_bar_layer_set_icon(abl_action, BUTTON_ID_SELECT, gb_arrow_reload);
}
Пример #19
0
static void main_window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  //*********************************************************************************
   GRect bounds = layer_get_bounds(window_layer);

  // We do this to account for the offset due to the status bar
  // at the top of the app window.

  GPoint center = grect_center_point(&bounds);
  GSize image_size = gbitmap_get_bounds(back_icon).size;
  
    //GRect image_frame = GRect(center.x-8, center.y-10, image_size.w, image_size.h);
  //image_frame.origin.x -= image_size.w / 2;
  //image_frame.origin.y -= image_size.h / 2;
  
  GRect image_frame = GRect(center.x-14, center.y-10, image_size.w, image_size.h);
  image_frame.origin.x -= image_size.w / 2;
  image_frame.origin.y -= image_size.h / 2;
    
  // Use GCompOpClear to display the black portions of the image
  s_black_layer = bitmap_layer_create(image_frame);
  bitmap_layer_set_bitmap(s_black_layer, back_icon);
  bitmap_layer_set_compositing_mode(s_black_layer, GCompOpSet);
  layer_add_child(window_layer, bitmap_layer_get_layer(s_black_layer));
  //**************************************************************************************************
  
  // Create ActionBar
  // Initialize the action bar:
  s_action_bar_layer = action_bar_layer_create();
  // Associate the action bar with the window:
  action_bar_layer_add_to_window(s_action_bar_layer, window);
  // Set the click config provider:
  action_bar_layer_set_click_config_provider(s_action_bar_layer, config_provider);
  // Set the icons:
  // The loading the icons is omitted for brevity... See HeapBitmap.
  action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_UP, my_icon_location);
  action_bar_layer_set_icon(s_action_bar_layer, BUTTON_ID_DOWN, my_icon_stop);
  
    
  // Create output TextLayer
  s_output_layer = text_layer_create(GRect(5, 135, 105, 25));
  //text_layer_set_font(s_output_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
  text_layer_set_text(s_output_layer, " Save pos");
  text_layer_set_text_color(s_output_layer,GColorWhite);
  text_layer_set_background_color(s_output_layer,GColorBlack);
  text_layer_set_overflow_mode(s_output_layer, GTextOverflowModeWordWrap);
  layer_add_child(window_layer, text_layer_get_layer(s_output_layer));
  
}
Пример #20
0
static void initialise_ui(void) {
  s_window = window_create();
  window_set_background_color(s_window, GColorBlack);
  IF_2(window_set_fullscreen(s_window, true));
  
  s_res_img_upaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_UPACTION);
  s_res_img_okaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_OKACTION);
  s_res_img_downaction = gbitmap_create_with_resource(RESOURCE_ID_IMG_DOWNACTION);
  s_res_gothic_24 = fonts_get_system_font(FONT_KEY_GOTHIC_24);
  s_res_gothic_28 = fonts_get_system_font(FONT_KEY_GOTHIC_28);
  // s_actionbarlayer
  s_actionbarlayer = action_bar_layer_create();
  action_bar_layer_add_to_window(s_actionbarlayer, s_window);
  action_bar_layer_set_background_color(s_actionbarlayer, GColorWhite);
  action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_UP, s_res_img_upaction);
  action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_SELECT, s_res_img_okaction);
  action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_DOWN, s_res_img_downaction);
  layer_set_frame(action_bar_layer_get_layer(s_actionbarlayer), GRect(124, 0, 20, 168));
  IF_3(layer_set_bounds(action_bar_layer_get_layer(s_actionbarlayer), GRect(-5, 0, 30, 168)));
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_actionbarlayer);
  
  // s_textlayer_info
  s_textlayer_info = text_layer_create(GRect(7, 25, 117, 32));
  text_layer_set_background_color(s_textlayer_info, GColorClear);
  text_layer_set_text_color(s_textlayer_info, GColorWhite);
  text_layer_set_text(s_textlayer_info, "Skip Until:");
  text_layer_set_text_alignment(s_textlayer_info, GTextAlignmentCenter);
  text_layer_set_font(s_textlayer_info, s_res_gothic_24);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_info);
  
  // s_textlayer_date
  s_textlayer_date = text_layer_create(GRect(2, 64, 122, 32));
  text_layer_set_background_color(s_textlayer_date, GColorClear);
  text_layer_set_text_color(s_textlayer_date, GColorWhite);
  text_layer_set_text(s_textlayer_date, "Thu, Feb 22");
  text_layer_set_text_alignment(s_textlayer_date, GTextAlignmentCenter);
  text_layer_set_font(s_textlayer_date, s_res_gothic_28);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_date);
  
  // s_textlayer_status
  s_textlayer_status = text_layer_create(GRect(7, 100, 117, 32));
  text_layer_set_background_color(s_textlayer_status, GColorClear);
  text_layer_set_text_color(s_textlayer_status, GColorWhite);
  text_layer_set_text(s_textlayer_status, "(No skipping)");
  text_layer_set_text_alignment(s_textlayer_status, GTextAlignmentCenter);
  text_layer_set_font(s_textlayer_status, s_res_gothic_24);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_status);
}
Пример #21
0
void win_add_duration_init(void) {
  window = window_create();

  layer = layer_create_fullscreen(window);
  layer_set_update_proc(layer, layer_update);
  layer_add_to_window(layer, window);

  layer_action_bar = action_bar_layer_create();
  action_bar_layer_add_to_window(layer_action_bar, window);
  action_bar_layer_set_click_config_provider(layer_action_bar, layer_action_bar_click_config_provider);
  action_bar_layer_set_icon(layer_action_bar, BUTTON_ID_UP, bitmaps_get_bitmap(RESOURCE_ID_ACTION_INC));
  action_bar_layer_set_icon(layer_action_bar, BUTTON_ID_DOWN, bitmaps_get_bitmap(RESOURCE_ID_ACTION_DEC));
  action_bar_layer_set_icon(layer_action_bar, BUTTON_ID_SELECT, bitmaps_get_bitmap(RESOURCE_ID_ACTION_OK));

  font_duration = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_AUDI_70_BOLD));
}
Пример #22
0
/** Window Callbacks **/
static void window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);

  icon_confirm = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_CHECK);
  icon_cancel = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_X);
  icon_select = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_SOCIAL);

  action_bar = action_bar_layer_create();
  action_bar_layer_add_to_window(action_bar, window);
  action_bar_layer_set_click_config_provider(action_bar, click_config_provider);
  action_bar_layer_set_icon(action_bar, BUTTON_ID_DOWN, icon_confirm);
  action_bar_layer_set_icon(action_bar, BUTTON_ID_SELECT, icon_select);
  action_bar_layer_set_icon(action_bar, BUTTON_ID_UP, icon_cancel);

  prompt_text = text_layer_create((GRect) { .origin = { 10, 10 }, .size = { bounds.size.w - 30, 120 } });
Пример #23
0
void window_load( Window *window )
{
	// Initialize the action bar:
	actionBar = action_bar_layer_create();
	// Associate the action bar with the window:
	action_bar_layer_add_to_window( actionBar, window );
	// Set the click config provider:
	action_bar_layer_set_click_config_provider( actionBar, click_config_provider );
	
	// Set the icons:
	bitmapRing = gbitmap_create_with_resource( RESOURCE_ID_IMAGE_RING_ICON );
	bitmapSilence = gbitmap_create_with_resource( RESOURCE_ID_IMAGE_SILENCE_ICON );
	
	// Set the icons:
	action_bar_layer_set_icon( actionBar, BUTTON_ID_UP, bitmapRing );
	action_bar_layer_set_icon( actionBar, BUTTON_ID_DOWN, bitmapSilence );
}
Пример #24
0
void window_load(Window *window)
{
  Layer *window_layer = window_get_root_layer(window);

  text_layer_1 = text_layer_create(GRect(0, 0, 104, 30));
  text_layer_set_text_color(text_layer_1, GColorBlack);
  text_layer_set_background_color(text_layer_1, GColorWhite);
  text_layer_set_font(text_layer_1, fonts_get_system_font(FONT_KEY_GOTHIC_24));
  layer_add_child(window_layer, text_layer_get_layer(text_layer_1));

  s_action_bar = action_bar_layer_create();
  action_bar_layer_add_to_window(s_action_bar, window);
  action_bar_layer_set_click_config_provider(s_action_bar, click_config_provider);
  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_DOWN, s_icon_reset);
  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_SELECT, s_icon_play);
  action_bar_layer_set_icon(s_action_bar, BUTTON_ID_UP, s_icon_calib);
  
  text_layer_2 = text_layer_create(GRect(0, 30, 104, 40));
  text_layer_set_font(text_layer_2, fonts_get_system_font(FONT_KEY_GOTHIC_24));
  layer_add_child(window_layer, text_layer_get_layer(text_layer_2));
  
  text_layer_3 = text_layer_create(GRect(0, 70, 104, 20));
  layer_add_child(window_layer, text_layer_get_layer(text_layer_3));
  text_layer_set_overflow_mode(text_layer_3, GTextOverflowModeWordWrap);
  
  text_layer_4 = text_layer_create(GRect(0, 90, 104, 20));
  layer_add_child(window_layer, text_layer_get_layer(text_layer_4));
  int calib_stored = persist_exists(CALIB_PKEY) ? persist_read_int(CALIB_PKEY) : CALIB_DEFAULT;
  if (calib_stored != 0) {
    text_layer_set_text(text_layer_1, "HELLO,");
    text_layer_set_text(text_layer_2, "DRINK SAFE");
    text_layer_set_text(text_layer_4, "Flick to start");
    display(text_layer_3,"Calib: %d", calib_stored);
  }
  else {
    text_layer_set_text(text_layer_1, "PLEASE");
    text_layer_set_text(text_layer_2, "CALIBRATE");
    text_layer_set_text(text_layer_3, "Press UP button");
    text_layer_set_text(text_layer_4, "to calibrate.");
  }
  accel_data_service_subscribe(1, accel_handler);
  accel_service_set_sampling_rate(ACCEL_SAMPLING_10HZ);

  accel_tap_service_subscribe(accel_tap_handler);
}
Пример #25
0
static void initialise_ui(void) {
  s_window = window_create();
  window_set_background_color(s_window, GColorBlack);
  IF_A(window_set_fullscreen(s_window, true));
  
  s_res_img_standby = gbitmap_create_with_resource(RESOURCE_ID_IMG_STANDBY);
  s_res_img_settings = gbitmap_create_with_resource(RESOURCE_ID_IMG_SETTINGS);
  s_res_roboto_bold_subset_49 = fonts_get_system_font(FONT_KEY_ROBOTO_BOLD_SUBSET_49);
  s_res_gothic_18_bold = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);
  // action_layer
  action_layer = action_bar_layer_create();
  action_bar_layer_add_to_window(action_layer, s_window);
  action_bar_layer_set_background_color(action_layer, GColorWhite);
  action_bar_layer_set_icon(action_layer, BUTTON_ID_UP, s_res_img_standby);
  action_bar_layer_set_icon(action_layer, BUTTON_ID_DOWN, s_res_img_settings);
  layer_set_frame(action_bar_layer_get_layer(action_layer), GRect(124, 0, 20, 168));
  IF_B(layer_set_bounds(action_bar_layer_get_layer(action_layer), GRect(-5, 0, 30, 168)));
  layer_add_child(window_get_root_layer(s_window), (Layer *)action_layer);
  
  // clockbg_layer
  clockbg_layer = text_layer_create(GRect(0, 60, 144, 50));
  text_layer_set_background_color(clockbg_layer, GColorBlack);
  text_layer_set_text_color(clockbg_layer, GColorClear);
  text_layer_set_text(clockbg_layer, "    ");
  layer_add_child(window_get_root_layer(s_window), (Layer *)clockbg_layer);
  
  // clock_layer
  clock_layer = text_layer_create(GRect(0, 52, 144, 65));
  text_layer_set_background_color(clock_layer, GColorClear);
  text_layer_set_text_color(clock_layer, GColorWhite);
  text_layer_set_text(clock_layer, "23:55");
  text_layer_set_text_alignment(clock_layer, GTextAlignmentCenter);
  text_layer_set_font(clock_layer, s_res_roboto_bold_subset_49);
  layer_add_child(window_get_root_layer(s_window), (Layer *)clock_layer);
  
  // onoff_layer
  onoff_layer = text_layer_create(GRect(2, 2, 119, 56));
  layer_set_update_proc(text_layer_get_layer(onoff_layer), draw_onoff); 
  layer_add_child(window_get_root_layer(s_window), (Layer *)onoff_layer);
  
  // info_layer
  info_layer = text_layer_create(GRect(2, 110, 119, 56));
  layer_set_update_proc(text_layer_get_layer(info_layer), draw_info); 
  layer_add_child(window_get_root_layer(s_window), (Layer *)info_layer);
}
Пример #26
0
static void action_bar_movie_kodi(Window *window){
  // Initialize the action bar:
  action_bar = action_bar_layer_create();
  action_bar_layer_set_background_color(action_bar, GColorRed);
  // Associate the action bar with the window:
  action_bar_layer_add_to_window(action_bar, window);
  // Set the click config provider:
  action_bar_layer_set_click_config_provider(action_bar, click_config_provider_kodi_movie);

  // Set the icons:
  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ICON_PLAY);
  // The loading of the icons is omitted for brevity... See gbitmap_create_with_resource()
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_SELECT, s_background_bitmap, true);
  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ICON_PREVIOUS);
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_UP, s_background_bitmap, true);
  s_background_bitmap = gbitmap_create_with_resource(RESOURCE_ID_ICON_NEXT);
  action_bar_layer_set_icon_animated(action_bar, BUTTON_ID_DOWN, s_background_bitmap, true);
}
Пример #27
0
static void initialise_ui(void) {
  s_window = window_create();
  #ifndef PBL_SDK_3
    window_set_fullscreen(s_window, false);
  #endif
  
  s_res_gothic_24_bold = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);
  s_res_gothic_18 = fonts_get_system_font(FONT_KEY_GOTHIC_18);
  s_res_gothic_14 = fonts_get_system_font(FONT_KEY_GOTHIC_14);
  // s_actionbarlayer
  s_actionbarlayer = action_bar_layer_create();
  action_bar_layer_add_to_window(s_actionbarlayer, s_window);
  action_bar_layer_set_background_color(s_actionbarlayer, GColorBlack);
  action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_UP, bitmap_add);
  action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_SELECT, bitmap_play);
  action_bar_layer_set_icon(s_actionbarlayer, BUTTON_ID_DOWN, bitmap_minus);
  action_bar_layer_set_click_config_provider(s_actionbarlayer, action_bar_click_config_provider);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_actionbarlayer);
  
  // s_textlayer_name
  s_textlayer_name = text_layer_create(GRect(5, 7, 100, 24));
  text_layer_set_font(s_textlayer_name, s_res_gothic_24_bold);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_name);
  
  // s_textlayer_days
  layers[0] = text_layer_create(GRect(16-6, 60, 30+6, 24));
  text_layer_set_text_alignment(layers[0], GTextAlignmentRight);
  text_layer_set_font(layers[0], s_res_gothic_18);
  layer_add_child(window_get_root_layer(s_window), (Layer *)layers[0]);
  
  for (uint8_t l=1; l<N_LAYERS; l++) {
    layers[l] = text_layer_create(GRect(30+20*l, 60, 20, 24));
    text_layer_set_text_alignment(layers[l], GTextAlignmentCenter);
    text_layer_set_font(layers[l], s_res_gothic_18);
    layer_add_child(window_get_root_layer(s_window), (Layer *)layers[l]);
  }
  
  // s_textlayer_help
  s_textlayer_help = text_layer_create(GRect(5, 118, 109, 34));
  text_layer_set_text(s_textlayer_help, "SHORT press: 1 unit\nLONG press: 5 units");
  text_layer_set_font(s_textlayer_help, s_res_gothic_14);
  layer_add_child(window_get_root_layer(s_window), (Layer *)s_textlayer_help);
}
Пример #28
0
static void settings_load(Window *settings) {
	Layer *settings_layer = window_get_root_layer(settings);
	
	//Set up Settings Action Bar
	up_arrow_icon = gbitmap_create_with_resource(RESOURCE_ID_ICON_UP_ARROW);
	down_arrow_icon = gbitmap_create_with_resource(RESOURCE_ID_ICON_DOWN_ARROW);
	ok_icon = gbitmap_create_with_resource(RESOURCE_ID_ICON_OK);
	settings_action_bar = action_bar_layer_create();
	action_bar_layer_add_to_window(settings_action_bar, settings);
	action_bar_layer_set_background_color(settings_action_bar, GColorWhite);
	action_bar_layer_set_click_config_provider(settings_action_bar, settings_click_config_provider);
	action_bar_layer_set_icon(settings_action_bar, BUTTON_ID_UP, up_arrow_icon);
	action_bar_layer_set_icon(settings_action_bar, BUTTON_ID_DOWN, down_arrow_icon);
	action_bar_layer_set_icon(settings_action_bar, BUTTON_ID_SELECT, ok_icon);
	
	// Settings US Text Layer
	settings_US_text_layer = text_layer_create(GRect(20, 32, 80, 30));
	text_layer_set_text_color(settings_US_text_layer, GColorWhite);
	text_layer_set_background_color(settings_US_text_layer, GColorClear);
	if (units == 0) {
		text_layer_set_font(settings_US_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
	}
	else {
		text_layer_set_font(settings_US_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
	}
	text_layer_set_text_alignment(settings_US_text_layer, GTextAlignmentCenter);
	text_layer_set_text(settings_US_text_layer, "US");
	layer_add_child(settings_layer, text_layer_get_layer(settings_US_text_layer));
	
	// Settings Metric Text Layer
	settings_METRIC_text_layer = text_layer_create(GRect(20, 82, 80, 30));
	text_layer_set_text_color(settings_METRIC_text_layer, GColorWhite);
	text_layer_set_background_color(settings_METRIC_text_layer, GColorClear);
	if (units == 0) {
		text_layer_set_font(settings_METRIC_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
	}
	else {
		text_layer_set_font(settings_METRIC_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
	}
	text_layer_set_text_alignment(settings_METRIC_text_layer, GTextAlignmentCenter);
	text_layer_set_text(settings_METRIC_text_layer, "METRIC");
	layer_add_child(settings_layer, text_layer_get_layer(settings_METRIC_text_layer));
}
Пример #29
0
static void initialise_ui(void) {
  
  Layer *root_layer = NULL;
  GRect bounds; 
  s_window = window_create_fullscreen(&root_layer, &bounds);
  
  s_res_img_standby = gbitmap_create_with_resource(RESOURCE_ID_IMG_STANDBY);
  s_res_img_settings = gbitmap_create_with_resource(RESOURCE_ID_IMG_SETTINGS);
  s_res_roboto_bold_subset_49 = fonts_get_system_font(FONT_KEY_ROBOTO_BOLD_SUBSET_49);
  s_res_gothic_18_bold = fonts_get_system_font(FONT_KEY_GOTHIC_18_BOLD);
  // action_layer
  action_layer = action_bar_layer_create();
  action_bar_layer_add_to_window(action_layer, s_window);
  action_bar_layer_set_background_color(action_layer, GColorWhite);
  action_bar_layer_set_icon(action_layer, BUTTON_ID_UP, s_res_img_standby);
  action_bar_layer_set_icon(action_layer, BUTTON_ID_DOWN, s_res_img_settings);
#ifdef PBL_RECT
  layer_set_frame(action_bar_layer_get_layer(action_layer), GRect(bounds.size.w-20, 0, 20, bounds.size.h));
  IF_3(layer_set_bounds(action_bar_layer_get_layer(action_layer), GRect(-6, 0, 31, bounds.size.h)));
  // Put Action Bar underneath other layers on rectangular Pebbles
  layer_add_child(root_layer, action_bar_layer_get_layer(action_layer));
#endif
  
  // clock_layer
  clock_layer = layer_create_with_proc(root_layer, draw_clock,
                                       GRect(0 - PBL_IF_RECT_ELSE(0, ACTION_BAR_WIDTH/2), (bounds.size.h/2)-32-PBL_IF_ROUND_ELSE(2, 0), bounds.size.w, 65));
  
  // onoff_layer
  onoff_layer = layer_create_with_proc(root_layer, draw_onoff,
                                      PBL_IF_RECT_ELSE(GRect(2, (bounds.size.h/2)-82, 119, 56),
                                                   GRect(-10, (bounds.size.h/2)-82, bounds.size.w+11, 56)));
  
  // info_layer
  info_layer = layer_create_with_proc(root_layer, draw_info,
                                     PBL_IF_RECT_ELSE(GRect(2, (bounds.size.h/2)+26, 119, 56),
                                                 GRect(-10, (bounds.size.h/2)+24, bounds.size.w+11, 56)));
  
#ifdef PBL_ROUND
  // Put Action Bar on top for Pebble Round
  layer_add_child(root_layer, (Layer *)action_layer);
#endif
}
Пример #30
0
void help_window_load(Window *window) {
  Layer *window_layer = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(window_layer);
  int16_t width = bounds.size.w - ACTION_BAR_WIDTH;
  
  s_check_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CHECK);
  
  s_help_action_bar = action_bar_layer_create();
  action_bar_layer_set_icon_animated(s_help_action_bar, BUTTON_ID_SELECT, s_check_bitmap, true);
  action_bar_layer_set_background_color(s_help_action_bar, GColorElectricUltramarine);
  action_bar_layer_set_click_config_provider(s_help_action_bar, help_click_config_provider);
  
  s_help_layer = text_layer_create(GRect(bounds.origin.x, bounds.origin.y + PBL_IF_ROUND_ELSE(60, 50), width - 5, bounds.size.h));
  text_layer_set_text(s_help_layer, PBL_IF_ROUND_ELSE("Example Reminder:\n\n\"Remind me to pick up milk at 5pm\" ", "Example Reminder:\n\n\"Remind me to pick up milk at 5pm\" "));
  text_layer_set_font(s_help_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14));
  text_layer_set_text_alignment(s_help_layer, GTextAlignmentCenter);
  
  layer_add_child(window_layer, text_layer_get_layer(s_help_layer));
  action_bar_layer_add_to_window(s_help_action_bar, window);
}