/*
 * Function: main_window_unload
 * ----------------------------------------------------------------------------
 *   Main window unload handler.
 *   Destroys the layers and the window.
 *
 *   window: the window that has been unloaded
 * ----------------------------------------------------------------------------
 */
static void main_window_unload(Window *window) {
  text_layer_destroy(s_header_layer);
  text_layer_destroy(s_body_layer);
  text_layer_destroy(s_label_layer);

  action_bar_layer_destroy(s_action_bar);
}
示例#2
0
static void window_unload(Window *window)
{
    cancel_reset_timer();

    if (actionBar)
    {
        action_bar_layer_destroy(actionBar);
        actionBar = NULL;
    }

    if (bitmapRing)
    {
        gbitmap_destroy( bitmapRing );
        bitmapRing = NULL;
    }
    if (bitmapSilence)
    {
        gbitmap_destroy( bitmapSilence );
        bitmapSilence = NULL;
    }

    if (statusTextLayer)
    {
        text_layer_destroy(statusTextLayer);
        statusTextLayer = NULL;
    }
}
示例#3
0
void window_unload(Window *window)
{
  int t_parada = (numero1*100) + (numero2*10) + (numero3);
  if ((t_parada/100)>(total_paradas-1))
    t_parada=100;
  persist_write_int(PRINCIPAL_PKEY, t_parada);
    //APP_LOG(APP_LOG_LEVEL_DEBUG, "Se guarda: %d + %d", (numero1*10000) + (numero2*1000) + (numero3*100), letra);

  posicion = 0;
  gbitmap_destroy(arriba_bitmap);
  gbitmap_destroy(abajo_bitmap);
  gbitmap_destroy(pulsar_bitmap);
  gbitmap_destroy(play_bitmap);
  gbitmap_destroy(buscar_bitmap);
  
  action_bar_layer_destroy(action_bar);

  text_layer_destroy(textoparada_layer);
  text_layer_destroy(dig1_layer);
  text_layer_destroy(dig2_layer);
	text_layer_destroy(dig3_layer);
  text_layer_destroy(mensaje_layer);
  layer_destroy(marcador);
   window_destroy(window);

}
static void action_bar_teardown(void)
{
  action_bar_layer_destroy(abl_action);
  gbitmap_destroy(gb_arrow_up);
  gbitmap_destroy(gb_arrow_down);
  gbitmap_destroy(gb_arrow_reload);
}
示例#5
0
// frees memory from the heap
static void destroy_ui(void) {
  window_destroy(s_window);
  action_bar_layer_destroy(s_actionbarlayer_1);
  bitmap_layer_destroy(s_bitmaplayer_bar_1);
  bitmap_layer_destroy(s_bitmaplayer_titlebox_1);
  bitmap_layer_destroy(s_bitmaplayer_titlebox_2);
  bitmap_layer_destroy(s_bitmaplayer_unitbox_1);
  bitmap_layer_destroy(s_bitmaplayer_unitbox_2);
  
  text_layer_destroy(s_textlayer_laps_num);
  text_layer_destroy(s_textlayer_laps_title);
  text_layer_destroy(s_textlayer_dist_unit);
  text_layer_destroy(s_textlayer_dist_num);
  text_layer_destroy(s_textlayer_dist_title);
  text_layer_destroy(s_textlayer_time);
  text_layer_destroy(s_textlayer_timer);
  text_layer_destroy(s_textlayer_stats);
  
  gbitmap_destroy(s_res_image_action_icon_reset);
  gbitmap_destroy(s_res_image_action_icon_play_pause);
  gbitmap_destroy(s_res_image_action_icon_increment);
  gbitmap_destroy(s_res_image_action_icon_finish);
  gbitmap_destroy(s_res_image_action_icon_play);
  gbitmap_destroy(s_res_image_action_icon_pause);
}
示例#6
0
static void destroy_ui(void) {
    window_destroy(s_window);
    action_bar_layer_destroy(s_actionbarlayer_1);
    text_layer_destroy(s_textlayer_1);
    text_layer_destroy(s_textlayer_2);
    gbitmap_destroy(s_res_yes);
    gbitmap_destroy(s_res_no);
}
示例#7
0
static void destroy_ui(void) {
    window_destroy(s_window);
    action_bar_layer_destroy(action_layer);
    layer_destroy(time_layer);
    gbitmap_destroy(s_res_img_upaction);
    gbitmap_destroy(s_res_img_nextaction);
    gbitmap_destroy(s_res_img_downaction);
}
示例#8
0
static void destroy_ui(void) {
  window_destroy(s_window);
  action_bar_layer_destroy(s_actionbarlayer);
  text_layer_destroy(s_textlayer_name);
  text_layer_destroy(s_textlayer_help);
  
  for (uint8_t l=0; l<N_LAYERS; l++) text_layer_destroy(layers[l]);
}
示例#9
0
static void action_bar_deinit(){
    gbitmap_destroy(s_play_icon);
    gbitmap_destroy(s_pause_icon);
    gbitmap_destroy(s_refresh_icon);
    gbitmap_destroy(s_share_icon);
    bluetooth_connection_service_unsubscribe();
    action_bar_layer_destroy(action_bar);
}
示例#10
0
static void resort_unload(Window *resort) {
	text_layer_destroy(resort_top_text_layer);
	text_layer_destroy(resort_center_text_layer);
	text_layer_destroy(resort_bottom_text_layer);
	action_bar_layer_destroy(resort_action_bar);
	gbitmap_destroy(right_arrow_icon);
	window_stack_pop(true);
}
示例#11
0
static void destroy_ui(void) {
  window_destroy(s_window);
  action_bar_layer_destroy(action_bar_layer);
  text_layer_destroy(number_text_layer);
  text_layer_destroy(title_text_layer);
  gbitmap_destroy(s_res_image_action_increment);
  gbitmap_destroy(s_res_image_action_decrement);
  fonts_unload_custom_font(s_res_font_dd_50);
}
示例#12
0
static void destroy_ui(void) {
  window_destroy(s_window);
  action_bar_layer_destroy(action_layer);
  layer_destroy(clock_layer);
  layer_destroy(onoff_layer);
  layer_destroy(info_layer);
  gbitmap_destroy(s_res_img_standby);
  gbitmap_destroy(s_res_img_settings);
}
示例#13
0
static void destroy_ui(void) {
  window_destroy(s_window);
  action_bar_layer_destroy(s_actionbarlayer);
  text_layer_destroy(s_textlayer_info);
  text_layer_destroy(s_textlayer_date);
  text_layer_destroy(s_textlayer_status);
  gbitmap_destroy(s_res_img_upaction);
  gbitmap_destroy(s_res_img_okaction);
  gbitmap_destroy(s_res_img_downaction);
}
示例#14
0
static void destroy_ui(void) {
  window_destroy(s_window);
  action_bar_layer_destroy(layer_actionbar);
  text_layer_destroy(layer_location);
  text_layer_destroy(layer_details);
  bitmap_layer_destroy(layer_logo);
  gbitmap_destroy(s_res_icon_up);
  gbitmap_destroy(s_res_icon_etc);
  gbitmap_destroy(s_res_icon_down);
}
示例#15
0
static void destroy_ui(void) {
  window_destroy(s_window);
  action_bar_layer_destroy(s_actionbarlayer);
  layer_destroy(s_info_layer);
  gbitmap_destroy(s_res_img_upaction);
  gbitmap_destroy(s_res_img_okaction);
  gbitmap_destroy(s_res_img_downaction);
  
  free(s_date);
}
示例#16
0
static void window_unload(Window *window) {
	app_sync_deinit(&sync);
	text_layer_destroy(wind_layer);
	text_layer_destroy(weather_layer);
	text_layer_destroy(area_name_layer);
	text_layer_destroy(temps_layer);
	text_layer_destroy(snowfall_layer);
	text_layer_destroy(update_layer);
	gbitmap_destroy(settings_icon);
	action_bar_layer_destroy(window_action_bar);
}
示例#17
0
文件: main.c 项目: imclab/rest
static void destroy_ui(void) {
  window_destroy(s_window);
  action_bar_layer_destroy(s_actionbarlayer_main);
  text_layer_destroy(s_textlayer_120);
  text_layer_destroy(s_textlayer_60);
  text_layer_destroy(s_textlayer_90);
  text_layer_destroy(s_textlayer_count);
  text_layer_destroy(s_textlayer_over);
  inverter_layer_destroy(s_inverterlayer_theme);
  gbitmap_destroy(s_res_image_go);
}
示例#18
0
static void window_unload(Window *window) {
  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;
}
示例#19
0
static void windows_kodi_unload(Window *window){
  action_bar_layer_destroy(action_bar);
  text_layer_destroy(s_title_info_layer);
  text_layer_destroy(s_album_info_layer);

  if (TAP_NOT_DATA) {
    accel_tap_service_unsubscribe();
  } else {
    accel_data_service_unsubscribe();
  }
}
示例#20
0
文件: mainwin.c 项目: SeaPea/HomeP
static void destroy_ui(void) {
  IF_3(status_bar_layer_destroy(s_status_bar));
  action_bar_layer_destroy(s_actionbar_main);
  devicecard_layer_destroy(s_devicecard_layer);
  devicecard_layer_destroy(s_devicecard_layer_old);
  layer_destroy(s_layer_spots);
  gbitmap_destroy(s_res_image_action_up);
  gbitmap_destroy(s_res_image_action_set);
  gbitmap_destroy(s_res_image_action_down);
  window_destroy(s_window);
}
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,
    });
  }
示例#22
0
static void destroy_ui() {
  window_destroy(s_window);
  gbitmap_destroy(s_icon_vol_up);
  gbitmap_destroy(s_icon_pause);
  gbitmap_destroy(s_icon_play);
  gbitmap_destroy(s_icon_vol_dn);
  gbitmap_destroy(s_icon_speaker);
  layer_destroy(s_lyr_background);
  action_bar_layer_destroy(s_action_bar);
  text_layer_destroy(s_txt_title);
  text_layer_destroy(s_txt_artist);
  bitmap_layer_destroy(s_bmp_speaker);
  layer_destroy(s_lyr_volume);
}
示例#23
0
static void gui_main_window_unload(Window *window) {
  text_layer_destroy(s_text_center_descr);

  text_layer_destroy(s_text_upper_descr);
  text_layer_destroy(s_text_upper_time1);
  text_layer_destroy(s_text_upper_time2);
  text_layer_destroy(s_text_lower_descr);
  text_layer_destroy(s_text_lower_time1);
  text_layer_destroy(s_text_lower_time2);

  action_bar_layer_destroy(s_action_bar);

  layer_destroy(s_layer_content);
  layer_destroy(s_layer_bg);
}
示例#24
0
static void destroy_ui(void) {
  window_destroy(s_window);
  text_layer_destroy(s_time_layer);
  text_layer_destroy(s_xy_values_layer);
  action_bar_layer_destroy(s_actionbarlayer_1);
  bitmap_layer_destroy(s_left_stop);
  bitmap_layer_destroy(s_right_stop);
  bitmap_layer_destroy(s_transmitting);
  text_layer_destroy(s_delay_text);
  fonts_unload_custom_font(s_res_content_regular_12);
  fonts_unload_custom_font(s_res_content_regular_24);
  gbitmap_destroy(s_res_left_led);
  gbitmap_destroy(s_res_send_button);
  gbitmap_destroy(s_res_right_led);
  fonts_unload_custom_font(s_res_content_regular_16);
}
示例#25
0
static void on_window_unload(Window *window) {
  deinit_stroke_datas();
  action_bar_layer_destroy(action_bar_layer);

  if(b_stroke_selected) {
    bitmap_layer_destroy(stroke_image_layer);
    text_layer_destroy(stroke_name_layer);
    text_layer_destroy(stroke_count_layer);
  } else {
    text_layer_destroy(intro_up_help);
    text_layer_destroy(intro_select_help);
    text_layer_destroy(intro_down_help);  
  }
  
  persist_write_bool(STROKE_SELECTED, b_stroke_selected);
  persist_write_int(CURRENT_STROKE, i_current_stroke);
}
示例#26
0
void main_window_unload(Window *window) 
{
  // Destroy TextLayer
  for ( int loop = 0; loop < N_LAYERS ; loop ++ )
  {
     text_layer_destroy(LOCAL_layers[loop].layer);
     text_layer_destroy(LOCAL_layers_small[loop].layer);
     
     if ( LOCAL_icon[loop] != NULL )
     {
        gbitmap_destroy( LOCAL_icon[loop] );  
        LOCAL_icon[loop] = NULL;
     }   
  }
  
  action_bar_layer_destroy( LOCAL_action_bar );
  status_bar_layer_destroy( LOCAL_status_bar );
}
示例#27
0
/*
 * Throw away the resources we gathered
 */
static void dispose_resources(void) {
  window_destroy(setting_window);
  action_bar_layer_destroy(button_layer);
  text_layer_destroy(title_layer);
  text_layer_destroy(from_layer);
  text_layer_destroy(fields[F_FROM_HOUR]);
  text_layer_destroy(fields[F_FROM_MINUTE]);
  text_layer_destroy(from_colon_layer);
  text_layer_destroy(to_layer);
  text_layer_destroy(fields[F_TO_HOUR]);
  text_layer_destroy(to_color_layer);
  text_layer_destroy(fields[F_TO_MINUTE]);
  text_layer_destroy(fields[F_SMART_ALARM]);
  text_layer_destroy(fields[F_DONE]);
  gbitmap_destroy(up_button_res);
  gbitmap_destroy(next_button_res);
  gbitmap_destroy(tick_button_res);
  gbitmap_destroy(down_button_res);
}
示例#28
0
static void destroy_ui(void) {
  window_destroy(s_window);
  text_layer_destroy(textlayer_bus_no);
  text_layer_destroy(textlayer_busstop_name);
  text_layer_destroy(textlayer_busstop_code);
  text_layer_destroy(textlayer_arrive_now);
  text_layer_destroy(textlayer_arrive_next);
  text_layer_destroy(textlayer_nextbus_label);
  bitmap_layer_destroy(bitmaplayer_current);
  bitmap_layer_destroy(bitmaplayer_next);
  text_layer_destroy(textlayer_debug);
  action_bar_layer_destroy(actionbar_layer);
  text_layer_destroy(textlayer_pages);
  bitmap_layer_destroy(bitmap_wab_now);
  bitmap_layer_destroy(bitmap_wab_next);
  gbitmap_destroy(s_res_bus_nodata);
  gbitmap_destroy(s_res_actionicon_previous_white);
  gbitmap_destroy(s_res_actionicon_refresh_white);
  gbitmap_destroy(s_res_actionicon_next_white);
}
示例#29
0
static void settings_unload(Window *settings) {
	text_layer_destroy(settings_US_text_layer);
	text_layer_destroy(settings_METRIC_text_layer);
	action_bar_layer_destroy(settings_action_bar);
	window_stack_pop(true);
}
示例#30
0
static void prv_window_load(Window *window) {
  GoalStarNumberWindow *number_window = window_get_user_data(window);
  if (!number_window) {
    return;
  }

  Layer *window_root_layer = window_get_root_layer(window);
  const GRect window_root_layer_bounds = layer_get_bounds(window_root_layer);

  number_window->checkmark_icon = gbitmap_create_with_resource(RESOURCE_ID_CHECKMARK);
  number_window->up_icon = gbitmap_create_with_resource(RESOURCE_ID_UP);
  number_window->down_icon = gbitmap_create_with_resource(RESOURCE_ID_DOWN);

  const GTextAlignment text_layer_alignment = GTextAlignmentRight;
  const GTextOverflowMode text_layer_overflow_mode = GTextOverflowModeTrailingEllipsis;

  const GFont label_text_font = fonts_get_system_font(FONT_KEY_GOTHIC_14);
  const int16_t label_text_font_height = 14;

  const int16_t value_text_max_font_height = 36;

  const int16_t horizontal_padding = 5;
  GRect text_container_frame = grect_inset(window_root_layer_bounds,
                                           GEdgeInsets(0, ACTION_BAR_WIDTH + horizontal_padding,
                                                       0, horizontal_padding));
  text_container_frame.size.h = label_text_font_height + value_text_max_font_height;
  grect_align(&text_container_frame, &window_root_layer_bounds, GAlignLeft, true /* clip */);
  text_container_frame.origin.y -= gbitmap_get_bounds(number_window->checkmark_icon).size.h / 2;

  GRect label_text_layer_frame = (GRect) {
    .size = GSize(text_container_frame.size.w, label_text_font_height),
  };
  grect_align(&label_text_layer_frame, &text_container_frame, GAlignTop, true /* clip */);
  number_window->label_text_layer = text_layer_create(label_text_layer_frame);
  TextLayer *label_text_layer = number_window->label_text_layer;
  text_layer_set_text(label_text_layer, number_window->label);
  text_layer_set_text_color(label_text_layer, GColorBlack);
  text_layer_set_background_color(label_text_layer, GColorClear);
  text_layer_set_font(label_text_layer, label_text_font);
  text_layer_set_overflow_mode(label_text_layer, text_layer_overflow_mode);
  text_layer_set_text_alignment(label_text_layer, text_layer_alignment);
  layer_add_child(window_root_layer, text_layer_get_layer(label_text_layer));

  GRect value_text_layer_frame = (GRect) {
    .size = GSize(text_container_frame.size.w, value_text_max_font_height),
  };
  grect_align(&value_text_layer_frame, &text_container_frame, GAlignBottom, true /* clip */);
  number_window->value_text_layer = text_layer_create(value_text_layer_frame);
  TextLayer *value_text_layer = number_window->value_text_layer;
  prv_update_value_text_layer(number_window);
  text_layer_set_text_color(value_text_layer, GColorBlack);
  text_layer_set_background_color(value_text_layer, GColorClear);
  text_layer_set_overflow_mode(value_text_layer, text_layer_overflow_mode);
  text_layer_set_text_alignment(value_text_layer, text_layer_alignment);
  layer_add_child(window_root_layer, text_layer_get_layer(value_text_layer));

  number_window->action_bar_layer = action_bar_layer_create();
  ActionBarLayer *action_bar_layer = number_window->action_bar_layer;
  action_bar_layer_set_click_config_provider(action_bar_layer, prv_click_config_provider);
  action_bar_layer_set_context(action_bar_layer, number_window);
  action_bar_layer_set_icon(action_bar_layer, BUTTON_ID_SELECT, number_window->checkmark_icon);
  action_bar_layer_set_icon(action_bar_layer, BUTTON_ID_UP, number_window->up_icon);
  action_bar_layer_set_icon(action_bar_layer, BUTTON_ID_DOWN, number_window->down_icon);
  action_bar_layer_add_to_window(action_bar_layer, window);
}

static void prv_window_unload(Window *window) {
  GoalStarNumberWindow *number_window = window_get_user_data(window);
  if (number_window) {
    text_layer_destroy(number_window->label_text_layer);
    text_layer_destroy(number_window->value_text_layer);
    action_bar_layer_destroy(number_window->action_bar_layer);
    gbitmap_destroy(number_window->checkmark_icon);
    gbitmap_destroy(number_window->up_icon);
    gbitmap_destroy(number_window->down_icon);
  }
}

static void prv_goal_star_number_window_init(GoalStarNumberWindow *number_window, const char *label,
                                             GoalStarNumberWindowCallbacks callbacks,
                                             void *callback_context) {
  if (!number_window) {
    return;
  }

  *number_window = (GoalStarNumberWindow) {
    .label = label,
    .value = 0,
    .min = GOAL_STAR_NUMBER_WINDOW_MIN,
    .max = GOAL_STAR_NUMBER_WINDOW_MAX,
    .step_size = 1,
    .callbacks = callbacks,
    .callback_context = callback_context,
  };

  number_window->window = window_create();
  Window *window = number_window->window;
  window_set_window_handlers(window, (WindowHandlers) {
    .load = prv_window_load,
    .unload = prv_window_unload,
  });
  window_set_background_color(window, GColorLightGray);
  window_set_user_data(window, number_window);
}

GoalStarNumberWindow *goal_star_number_window_create(const char *label,
                                                     GoalStarNumberWindowCallbacks callbacks,
                                                     void *callback_context) {
  GoalStarNumberWindow *number_window = calloc(1, sizeof(*number_window));
  prv_goal_star_number_window_init(number_window, label, callbacks, callback_context);
  return number_window;
}