Example #1
0
void itunes_init(void) {
  APP_LOG(APP_LOG_LEVEL_DEBUG, "Window - iTunes init %p", window);

  controlling_volume = false;
  is_playing = false;
  is_shuffling = false;
  shuffle_icon_showing = false;
  refresh_icon_showing = false;
  has_stale_information = true;

  status_bar_icon = gbitmap_create_with_resource(RESOURCE_ID_STATUS_BAR_ICON_ITUNES);
  action_icon_rewind = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_REWIND);
  action_icon_fast_forward = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_FAST_FORWARD);
  action_icon_play = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_PLAY);
  action_icon_pause = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_PAUSE);
  action_icon_volume_up = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_VOLUME_UP);
  action_icon_volume_down = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_VOLUME_DOWN);
  action_icon_refresh = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_REFRESH);
  action_icon_airplay = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_ACTION_AIRPLAY);
  progress_bar_clock = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_PROGRESS_BAR_CLOCK);
  progress_bar_volume_icon = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_PROGRESS_BAR_VOLUME_ICON);
  progress_bar_shuffle = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_PROGRESS_BAR_SHUFFLE);
  progress_bar_no_shuffle = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_PROGRESS_BAR_NO_SHUFFLE);
  dotted_status = gbitmap_create_with_resource(RESOURCE_ID_DOTTED_STATUS);

  window = window_create();
  window_set_status_bar_icon(window, status_bar_icon);
  window_set_window_handlers(window, (WindowHandlers) {
    .load = window_load,
    .unload = window_unload,
    .appear = window_appear,
    .disappear = window_disappear,
  });
Example #2
0
/////////////////////////////////////////// WINDOWS //////////////////////////////////////////
void window_load(Window *window)
{
  // Creating texts. Pebble screen is 144x168 pixels
  // "Incoming Call" text
  incoming_text = text_layer_create(GRect(5, 0, 144, 168));
  text_layer_set_background_color(incoming_text, GColorClear);
  text_layer_set_text_color(incoming_text, GColorBlack);
  text_layer_set_font(incoming_text, fonts_get_system_font(FONT_KEY_GOTHIC_24));
  layer_add_child(window_get_root_layer(window), text_layer_get_layer(incoming_text));
  text_layer_set_text(incoming_text, "Incoming Call");
  
  // Caller name text
  caller_name = text_layer_create(GRect(5, 47, 123, 168));
  text_layer_set_background_color(caller_name, GColorClear);
  text_layer_set_text_color(caller_name, GColorBlack);
  text_layer_set_font(caller_name, fonts_get_system_font(FONT_KEY_GOTHIC_28_BOLD));
  layer_add_child(window_get_root_layer(window), text_layer_get_layer(caller_name));
  //text_layer_set_text(caller_name, name);
  
  // Caller number text
  caller_number = text_layer_create(GRect(5, 120, 123, 168));
  text_layer_set_background_color(caller_number, GColorClear);
  text_layer_set_text_color(caller_number, GColorBlack);
  text_layer_set_font(caller_number, fonts_get_system_font(FONT_KEY_GOTHIC_24));
  layer_add_child(window_get_root_layer(window), text_layer_get_layer(caller_number));
  //text_layer_set_text(caller_number, number);
  
  //Load bitmaps into GBitmap structures
  options_bitmap = gbitmap_create_with_resource(RESOURCE_ID_OPTIONS);
  callicon_bitmap = gbitmap_create_with_resource(RESOURCE_ID_CALLICON);
  // Create BitmapLayers to show GBitmaps and add to Window. "Option" image is 21 x 146 pixels
  options_layer = bitmap_layer_create(GRect(123, 4, 21, 146));
  bitmap_layer_set_bitmap(options_layer, options_bitmap);
  layer_add_child(window_get_root_layer(window), bitmap_layer_get_layer(options_layer));
  
   window_set_status_bar_icon(window, callicon_bitmap);
}