Example #1
0
void handle_deinit(void) {
  tick_timer_service_unsubscribe();

  persist_write_string(MESSAGE_KEY_DATE_FORMAT_KEY,       PersistDateFormat);
  persist_write_int(MESSAGE_KEY_BT_VIBRATE_KEY,           PersistBTLoss);
  persist_write_int(MESSAGE_KEY_LOW_BATTERY_KEY,          PersistLow_Batt);
  
  battery_state_service_unsubscribe();
  bluetooth_connection_service_unsubscribe();
  app_focus_service_unsubscribe();

  text_layer_destroy(text_time_layer);
  text_layer_destroy(text_date_layer);
  text_layer_destroy(text_dayname_layer);
  text_layer_destroy(text_battery_layer);

  layer_destroy(BatteryLineLayer);
  layer_destroy(BTLayer);

  gbitmap_destroy(image);
  bitmap_layer_destroy(image_layer);

  fonts_unload_custom_font(fontHelvNewLight20);
  fonts_unload_custom_font(fontRobotoBoldSubset40);
  fonts_unload_custom_font(fontRobotoBoldSubset45);


  window_destroy(window);
}
Example #2
0
void handle_deinit() {
  app_message_deregister_callbacks();
  battery_state_service_unsubscribe();
  tick_timer_service_unsubscribe();
  if (has_config) {
    persist_write_int(SECONDS_MODE, seconds_mode);
    persist_write_int(BATTERY_MODE, battery_mode);
    persist_write_int(DATE_MODE, date_mode);
    persist_write_int(BLUETOOTH_MODE, bluetooth_mode);
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Wrote config");
  } else {
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Did not write config");
  }
  fonts_unload_custom_font(font);
  gpath_destroy(sec_path);
  gpath_destroy(min_path);
  gpath_destroy(hour_path);
  inverter_layer_destroy(inverter_layer);
#if DEBUG
  text_layer_destroy(debug_layer);
#endif
  layer_destroy(hands_layer);
  bitmap_layer_destroy(logo_layer);
  gbitmap_destroy(logo);
  bitmap_layer_destroy(battery_layer);
  for (int i = 0; i < 22; i++)
    gbitmap_destroy(battery_images[i]);
  bitmap_layer_destroy(bluetooth_layer);
  for (int i = 0; i < 2; i++)
    gbitmap_destroy(bluetooth_images[i]);
  layer_destroy(background_layer);
  layer_destroy(date_layer);
  window_destroy(window);
}
Example #3
0
void notify_deinit(void) {

    if (subscribed) {
	subscribed = false;
    	/*
    	** Unsubscribe from all events.
    	*/
    	battery_state_service_unsubscribe();
    	bluetooth_connection_service_unsubscribe();

    	/*
    	** Destroy all bitmaps.
    	*/
    	gbitmap_destroy(btdisc);
    	gbitmap_destroy(lowbatt);
    }

    gbitmap_destroy(tick);

    /*
    ** Destroy all layers.
    */
    bitmap_layer_destroy(warn_layer);
    text_layer_destroy(warn_text_layer);
}
Example #4
0
static void main_window_unload(Window *window) {
  // Destroy TextLayer
    text_layer_destroy(s_time_layer);
    text_layer_destroy(s_bg_layer);
    text_layer_destroy(am_layer);
    text_layer_destroy(date_layer);
    text_layer_destroy(s_battery_layer);
    text_layer_destroy(hour_layer);
    text_layer_destroy(min_layer);
    text_layer_destroy(condition_layer);
    text_layer_destroy(temp_layer);
    text_layer_destroy(city_layer);
    text_layer_destroy(battery_text_layer);
    /*text_layer_destroy(s_temperature_layer);
    bitmap_layer_destroy(s_bitmap_layer);
    bitmap_layer_destroy(s_icon_layer);
    bitmap_layer_destroy(bt_layer);*/
    fonts_unload_custom_font(s_custom_font_24);
    fonts_unload_custom_font(s_custom_font_18);
    fonts_unload_custom_font(s_custom_font_12);
    //gbitmap_destroy(blank_bitmap);
    //gbitmap_destroy(bt_bitmap);
    gbitmap_destroy(no_phone_bitmap);
    bitmap_layer_destroy(no_phone_layer);
    bluetooth_connection_service_unsubscribe();
    battery_state_service_unsubscribe();
    tick_timer_service_unsubscribe();
}
Example #5
0
static void handle_deinit() {
  app_message_deregister_callbacks();
  battery_state_service_unsubscribe();
  tick_timer_service_unsubscribe();
  fonts_unload_custom_font(font);
  fonts_unload_custom_font(font2);
  gpath_destroy(min_path);
  gpath_destroy(hour_path);
  gpath_destroy(hour_in_path);
  text_layer_destroy(battp_layer);
  text_layer_destroy(date_layer);
  text_layer_destroy(day_layer);
  text_layer_destroy(time_layer);
  layer_destroy(hands_layer);
  bitmap_layer_destroy(logo_layer);
  gbitmap_destroy(logo);
  bitmap_layer_destroy(battery_layer);
  for (int i = 0; i < 22; i++)
    gbitmap_destroy(battery_images[i]);
  bitmap_layer_destroy(bluetooth_layer);
  for (int i = 0; i < 2; i++)
    gbitmap_destroy(bluetooth_images[i]);
  layer_destroy(background_layer);
  window_destroy(window);
}
Example #6
0
void handle_deinit(void) {

  fonts_unload_custom_font(mTimeFont);

  //fonts_unload_custom_font(mDateFont);
	fonts_unload_custom_font(mTemperatureFont);

	//fonts_unload_custom_font(mHighLowFont);

  layer_remove_from_parent(bitmap_layer_get_layer(mWeatherIconLayer));
  bitmap_layer_destroy(mWeatherIconLayer);
  gbitmap_destroy(mWeatherIcon);

  layer_remove_from_parent(bitmap_layer_get_layer(battery_image_layer));
  bitmap_layer_destroy(battery_image_layer);
  gbitmap_destroy(battery_image);
  battery_image = NULL;
  
  tick_timer_service_unsubscribe();
  bluetooth_connection_service_unsubscribe();
  battery_state_service_unsubscribe();
 
  text_layer_destroy(mHighLowLayer);
  text_layer_destroy(mTimeSeparatorLayer);
  text_layer_destroy(mTemperatureLayer);
  text_layer_destroy(mDateLayer);
  text_layer_destroy(mTimeMinutesLayer);
  text_layer_destroy(mTimeHourLayer);
  layer_destroy(mTimeLayer);
  layer_destroy(mBackgroundLayer);
  remove_invert_top();
  remove_invert_bottom();  
  
  window_destroy(mWindow);
}
Example #7
0
static void main_window_unload(Window *window) {
  int i;

  enabled = 0;
  
  battery_state_service_unsubscribe();
  
  if (s_dow_text_layer) {
    text_layer_destroy(s_dow_text_layer);
    s_dow_text_layer = NULL;
  }
  if (s_batt_text_layer) {
    text_layer_destroy(s_batt_text_layer);
    s_batt_text_layer = NULL;
  }
  if (s_date_text_layer) {
    text_layer_destroy(s_date_text_layer);
    s_date_text_layer = NULL;
  }
  if (s_time_text_layer) {
    text_layer_destroy(s_time_text_layer);
    s_time_text_layer = NULL;
  }
  if (has_small_font) {
    fonts_unload_custom_font(s_small_font);
    has_small_font = 0;
    s_small_font = NULL;
  }
  if (has_large_font) {
    fonts_unload_custom_font(s_large_font);
    has_large_font = 0;
    s_large_font = NULL;
  }

}
Example #8
0
/*
  dealloc
*/
void handle_deinit( void ) {
  // Unsubscribe from services
  tick_timer_service_unsubscribe();
  battery_state_service_unsubscribe();
  bluetooth_connection_service_unsubscribe();

  // Destroy image objects
  destroy_graphics( background_image, background_layer );
  destroy_graphics( battery_image, battery_layer );
  destroy_graphics( bluetooth_image, bluetooth_layer );
  destroy_graphics( icon_bitmap, icon_layer );

  // Destroy text objects
  text_layer_destroy( text_time_layer );
  text_layer_destroy( text_ampm_layer );
  text_layer_destroy( text_secs_layer );
  text_layer_destroy( text_days_layer );
  text_layer_destroy( text_date_layer );
  text_layer_destroy( text_week_layer );
  text_layer_destroy( temp_layer );

  // Destroy inverter layer
  inverter_layer_destroy( currentDayLayer );
  
  // Destroy font objects
  fonts_unload_custom_font( font_time );
  fonts_unload_custom_font( font_days );
  fonts_unload_custom_font( font_date );

  // Clean up AppSync system
  app_sync_deinit( &app );

  // Destroy window
  window_destroy( window );
}
Example #9
0
void window_unload(Window *window) {
  tick_timer_service_unsubscribe();
  battery_state_service_unsubscribe();

  text_layer_destroy(date_layer);
	text_layer_destroy(temp_layer);
  text_layer_destroy(location_layer);
}
Example #10
0
static void deinit(void) {
	tick_timer_service_unsubscribe();
	accel_tap_service_unsubscribe();
	battery_state_service_unsubscribe();
	bitmap_layer_destroy(pow_layer);
	text_layer_destroy(battery_layer);
	window_destroy(my_window);
}
/**
 * Handler for the main window.
 *
 * @param {Window*} window
 */
void mainWindowUnload(Window *window) {
  destroyStrings(&strings);

  // unsubscribe/deregister to all services
  battery_state_service_unsubscribe();
  tick_timer_service_unsubscribe();
  app_message_deregister_callbacks();
}
Example #12
0
static void deinit() {
  APP_LOG(APP_LOG_LEVEL_DEBUG, "start of deinit");
  main_window_deinit();
  tick_timer_service_unsubscribe();
  battery_state_service_unsubscribe();
  autoconfig_deinit();
  APP_LOG(APP_LOG_LEVEL_DEBUG, "end of deinit");
}
void handle_deinit(void) {
  tick_timer_service_unsubscribe();
  battery_state_service_unsubscribe();
  bluetooth_connection_service_unsubscribe();
  app_sync_deinit(&sync);

  window_destroy(clock_window);
}
Example #14
0
void set_lowbat_notification(bool state) {
  watch_config.lowbat = state;
  if (state) {
    battery_state_service_subscribe(battery_state_handler);
  } else {
    battery_state_service_unsubscribe();
    lowbattery_handler(false);
  }
}
Example #15
0
static void main_window_unload(Window *window) {
	tick_timer_service_unsubscribe();
	battery_state_service_unsubscribe();
	bluetooth_connection_service_unsubscribe();
	text_layer_destroy(s_time_layer);
	text_layer_destroy(s_time_element_layer);
	text_layer_destroy(s_connection_layer);
	text_layer_destroy(s_battery_layer);
}
Example #16
0
static void window_unload(Window *window) {
    bluetooth_connection_service_unsubscribe();
    battery_state_service_unsubscribe();
    tick_timer_service_unsubscribe();
    text_layer_destroy(text_beat_layer);
    text_layer_destroy(text_time_layer);
    text_layer_destroy(text_date_layer);
    layer_destroy(background_layer);
}
Example #17
0
static void do_deinit(void) {
	gbitmap_destroy(Anonymous);
	bitmap_layer_destroy(Anonymous_Layer);
	tick_timer_service_unsubscribe();
	battery_state_service_unsubscribe();
	bluetooth_connection_service_unsubscribe();
	text_layer_destroy(time_layer);
	text_layer_destroy(battery_layer);
	window_destroy(window);
}
Example #18
0
void deinit() {
  layer_remove_child_layers(window_get_root_layer(window));
  text_layer_destroy(hour_layer);
  text_layer_destroy(minute_layer);
  text_layer_destroy(date_layer);
  text_layer_destroy(day_layer);
  tick_timer_service_unsubscribe();
  battery_state_service_unsubscribe();
  window_destroy(window);
}
Example #19
0
void events_battery_state_service_unsubscribe(EventHandle handle) {
  int16_t index = linked_list_find(s_handler_list, handle);
  if (index == -1) {
    return;
  }
  free(linked_list_get(s_handler_list, index));
  linked_list_remove(s_handler_list, index);
  if (linked_list_count(s_handler_list) == 0) {
    battery_state_service_unsubscribe();
  }
}
Example #20
0
static void main_window_unload(Window *window) {
   text_layer_destroy(s_time_layer);
   text_layer_destroy(s_stat_layer);
   text_layer_destroy(s_twitter_layer);
   text_layer_destroy(s_battery_layer);
   text_layer_destroy(s_quote_layer);
 
  battery_state_service_unsubscribe();
  accel_data_service_unsubscribe();
   

}
Example #21
0
void handle_deinit(void) {
	text_layer_destroy(text_layer);
	text_layer_destroy(time_layer);
	//text_layer_destroy(date_layer);
	inverter_layer_destroy(inverter_layer);
	
	battery_state_service_unsubscribe();
	bluetooth_connection_service_unsubscribe();
	tick_timer_service_unsubscribe();
	
	window_destroy(window);
}
Example #22
0
void handle_deinit(void) {
   app_sync_deinit(&sync);
   battery_state_service_unsubscribe();
   tick_timer_service_unsubscribe();
   layer_destroy(line_layer);
   text_layer_destroy(text_time_layer);
   text_layer_destroy(text_date_layer);
   text_layer_destroy(text_watchbatt_layer);
   text_layer_destroy(text_event_layer);
   text_layer_destroy(text_location_layer);
   window_destroy(window);
}
Example #23
0
void handle_deinit(void) {
  tick_timer_service_unsubscribe();

  layer_destroy(triangle_overlay_layer);
  layer_destroy(s_hands_layer);
  
  bluetooth_connection_service_unsubscribe();
  battery_state_service_unsubscribe();
  app_focus_service_unsubscribe();
  
  fonts_unload_custom_font(fontRobotoCondensed19);
  
  window_destroy(window);
}
Example #24
0
static void deinit() {
    battery_state_service_unsubscribe();
    tick_timer_service_unsubscribe();
    window_destroy(g_window);
    layer_destroy(g_layer);
#if RESMEM
    free(g_resource_memory);
#else
    fpath_destroy(g_minute);
    fpath_destroy(g_hour);
    fpath_destroy(g_body);
    ffont_destroy(g_font);
#endif
}
Example #25
0
void handle_deinit(void) {
	// Destroy the text layer
  text_layer_destroy(hour_layer);
  text_layer_destroy(date_layer);
  text_layer_destroy(day_layer);
  bitmap_layer_destroy(bluetooth_layer);
  text_layer_destroy(battery_layer);
  
  inverter_layer_destroy(i_date_layer);
	
	// Destroy the window
	window_destroy(window);
  bluetooth_connection_service_unsubscribe();
  battery_state_service_unsubscribe();
}
Example #26
0
static void main_window_unload(Window *window) {
    battery_state_service_unsubscribe();
    tick_timer_service_unsubscribe();
    minute_when_last_updated = -1;
  
    if (s_date_text_layer) {
        text_layer_destroy(s_date_text_layer);
        s_date_text_layer = NULL;
    }
    if (s_batt_text_layer) {
        text_layer_destroy(s_batt_text_layer);
        s_batt_text_layer = NULL;
    }
    layer_destroy(s_wall_time_layer);
}
void battery_disable_display() 
{
  is_animating = false;
  is_enabled = false;

  layer_set_hidden(battery_layer, true);

  // Unsubscribe to the battery monitoring service
  battery_state_service_unsubscribe();

  // Kill the timer
  if (battery_animation_timer) {
    app_timer_cancel(battery_animation_timer);
  }
}
Example #28
0
static void deinit(void) {
	layer_destroy(display_layer);
	text_layer_destroy(date_layer);
	text_layer_destroy(percent_layer);
	bitmap_layer_destroy(battery_layer);
	bitmap_layer_destroy(charge_layer);
	inverter_layer_destroy(battfill_layer);
	fonts_unload_custom_font(font);
	fonts_unload_custom_font(font_tiny);
	gbitmap_destroy(battery_outline);
	gbitmap_destroy(battery_charge);
	tick_timer_service_unsubscribe();
	battery_state_service_unsubscribe();
	window_destroy(window);
}
Example #29
0
void handle_deinit(void) {
    tick_timer_service_unsubscribe();
    battery_state_service_unsubscribe();
    bluetooth_connection_service_unsubscribe();
    accel_tap_service_unsubscribe();
    
    bitmap_layer_destroy(bt_layer);
    gbitmap_destroy(bt);
    
    bitmap_layer_destroy(bg_layer);
    gbitmap_destroy(background);
    
    text_layer_destroy(time_layer);
    text_layer_destroy(date_layer);
    text_layer_destroy(battery_layer);
    text_layer_destroy(game_layer);
}
Example #30
0
static void do_deinit(void) {
  tick_timer_service_unsubscribe();
  battery_state_service_unsubscribe();
  bluetooth_connection_service_unsubscribe();
  
  for (int i = 0; i < TOTAL_IMAGE_SLOTS; i++) {
    gbitmap_destroy(slots[i]);
    bitmap_layer_destroy(digit_slot[i]);
  }
  gbitmap_destroy(conn_image);
  gbitmap_destroy(battery_image);
  text_layer_destroy(date_layer);
  bitmap_layer_destroy(conn_layer);
  bitmap_layer_destroy(battery_layer);
  text_layer_destroy(ampm_layer);
  window_destroy(window);
}