コード例 #1
0
ファイル: main.c プロジェクト: clach04/watchface_oregon_owl
void custom_main_window_unload(Window *window) {
    /* Call generic code */
    main_window_unload(window);

    /* Start of custom code */
    //Destroy GBitmap
    gbitmap_destroy(s_background_bitmap_main);
    gbitmap_destroy(s_background_bitmap_alt);

    //Destroy BitmapLayer
    bitmap_layer_destroy(s_background_layer);
}
コード例 #2
0
ファイル: main.c プロジェクト: dse/watchface-dot-matrix-1
static void message_handler(DictionaryIterator *received, void *context) {

  bool refresh_window = 0;

  app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "this is message_handler");

  /* options */
  Tuple *tuple_black_on_white    = dict_find(received, OPTION_BLACK_ON_WHITE);
  Tuple *tuple_show_date         = dict_find(received, OPTION_SHOW_DATE);
  Tuple *tuple_show_battery      = dict_find(received, OPTION_SHOW_BATTERY);
  Tuple *tuple_larger_clock_font = dict_find(received, OPTION_LARGER_CLOCK_FONT);

  /* options */
  if (tuple_black_on_white) {
    app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "found tuple_black_on_white");
    refresh_window = 1;
    black_on_white = (bool)tuple_black_on_white->value->int32;
  }
  if (tuple_show_date) {
    app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "found tuple_show_data");
    refresh_window = 1;
    show_date = (bool)tuple_show_date->value->int32;
  }
  if (tuple_show_battery) {
    app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "found tuple_show_battery");
    refresh_window = 1;
    show_battery = (bool)tuple_show_battery->value->int32;
  }
  if (tuple_larger_clock_font) {
    app_log(APP_LOG_LEVEL_INFO, __FILE__, __LINE__, "found tuple_larger_clock_font");
    refresh_window = 1;
    larger_clock_font = (bool)tuple_larger_clock_font->value->int32;
  }

  /* options */
  persist_write_bool(OPTION_BLACK_ON_WHITE, black_on_white);
  persist_write_bool(OPTION_SHOW_DATE,      show_date);
  persist_write_bool(OPTION_SHOW_BATTERY,   show_battery);
  persist_write_bool(OPTION_LARGER_CLOCK_FONT, larger_clock_font);

  if (refresh_window) {
    main_window_unload(s_main_window);
    main_window_destroy();
    main_window_create();
    main_window_load(s_main_window);
  }
}