void init_handler(AppContextRef ctx) { window_init(&window, "pbl-index"); window_set_background_color(&window, GColorBlack); window_stack_push(&window, true); for (int i=0; i<NUM_LINES; i++) { text_layer_init(&textLayer[0][i], GRect(5, 7+i*30, 144-5-COLUMN2_WIDTH, 30)); text_layer_init(&textLayer[1][i], GRect(144-COLUMN2_WIDTH, 7+i*30, COLUMN2_WIDTH, 30)); text_layer_set_font(&textLayer[0][i], fonts_get_system_font(FONT_KEY_GOTHIC_24)); text_layer_set_font(&textLayer[1][i], fonts_get_system_font(FONT_KEY_GOTHIC_24)); text_layer_set_background_color(&textLayer[0][i], GColorBlack); text_layer_set_background_color(&textLayer[1][i], GColorBlack); text_layer_set_text_color(&textLayer[0][i], GColorWhite); text_layer_set_text_color(&textLayer[1][i], GColorWhite); text_layer_set_text_alignment(&textLayer[1][i], GTextAlignmentRight); } text_layer_set_text(&textLayer[0][0], "pbl-index"); text_layer_set_text(&textLayer[0][1], "by epatel"); text_layer_set_text(&textLayer[0][3], "loading..."); for (int i=0; i<NUM_LINES; i++) { layer_add_child(&window.layer, &textLayer[0][i].layer); layer_add_child(&window.layer, &textLayer[1][i].layer); } http_set_app_id(PBLINDEX_NAMES_COOKIE); http_register_callbacks((HTTPCallbacks){ .failure = failed, .success = success, .reconnect = reconnect, }, NULL);
void handle_init(AppContextRef ctx) { app = ctx; //resource_init_current_app(&APP_RESOURCES); http_set_app_id(0x0fba6c10); http_register_callbacks((HTTPCallbacks){ .success = rcv_resp, .failure = rcv_fail, .location = rcv_location, }, NULL);
bool pebcast_register_callbacks(PebcastCallbacks callbacks, void* context) { pebcast_callbacks = callbacks; http_set_app_id(76782702); return http_register_callbacks((HTTPCallbacks) { .success = http_success, .failure = http_failure, .reconnect=reconnect, .location=location }, NULL);
void handle_init(AppContextRef ctx) { window_init(&window, "Simple Chinese"); window_stack_push(&window, true /* Animated */); window_set_background_color(&window, BACKGROUNDCOLOR); resource_init_current_app(&APP_RESOURCES); layer_init(&line_layer, window.layer.frame); line_layer.update_proc = &line_layer_update_callback; layer_add_child(&window.layer, &line_layer); DTL_init(&time_layer, &window.layer, time_GRECT, time_FONT, _time_upd, _time_upd_cri); DTL_init(&date_layer, &window.layer, date_GRECT, date_FONT, _date_upd, _date_upd_cri); if(!clock_is_24h_style()) DTL_init(&period_layer, &window.layer, period_GRECT, period_FONT, _period_upd, _period_upd_cri); #if INCLUDE_CCD DTL_init(&cdate_layer, &window.layer, cdate_GRECT, cdate_FONT, _cdate_upd, _cdate_upd_cri); #endif #if INCLUDE_SEC DTL_init(&sec_layer, &window.layer, sec_GRECT, sec_FONT, _sec_upd, _sec_upd_cri); #endif DTL_init(&weather_layer, &window.layer, weather_GRECT, weather_FONT, _weather_upd, _weather_upd_cri); DTL_set_alignment(&weather_layer, GTextAlignmentRight); #if DEBUG DTL_init(&debug_layer, &window.layer, debug_GRECT, debug_FONT, NULL, NULL); #endif DTL_init(&info_layer, &window.layer, info_GRECT, info_FONT, NULL, NULL); DTL_set_alignment(&info_layer, GTextAlignmentRight); srand(time(NULL)); int32_t HTTP_APP_ID = RAND_MAX/2 - rand(); http_set_app_id(HTTP_APP_ID); HTTPCallbacks httpcallbacks = { .success = handle_success, .failure = handle_failed, .location = handle_location, .reconnect = handle_reconnect }; http_register_callbacks(httpcallbacks, ctx); }
void handle_init(AppContextRef ctx) { window_init(&window, "PebMinders"); window_stack_push(&window, true /* Animated */); window_set_background_color(&window, GColorBlack); resource_init_current_app(&APP_RESOURCES); init_text_layer( &text_pebminder_layer, GRect( PEBMINDER_X, PEBMINDER_Y, SCREEN_WIDTH - PEBMINDER_X, DATE_Y - PEBMINDER_Y ), fonts_get_system_font(FONT_KEY_GOTHIC_14) ); init_text_layer( &text_date_layer, GRect(DATE_X, DATE_Y, SCREEN_WIDTH-DATE_X, SCREEN_HEIGHT-DATE_Y), fonts_load_custom_font( resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_21) ) ); init_text_layer( &text_time_layer, GRect(TIME_X, TIME_Y, SCREEN_WIDTH-TIME_X, SCREEN_HEIGHT-TIME_Y), fonts_load_custom_font( resource_get_handle(RESOURCE_ID_FONT_ROBOTO_BOLD_SUBSET_49) ) ); layer_init(&line_layer, window.layer.frame); line_layer.update_proc = &line_layer_update_callback; layer_add_child(&window.layer, &line_layer); text_layer_set_text(&text_pebminder_layer, "• Init"); http_set_app_id(APP_ID); http_register_callbacks( (HTTPCallbacks){ .failure=handle_failure, .success=handle_success, .reconnect=handle_reconnect },
void handle_init(AppContextRef ctx) { window_init(&window, "Window Name"); window_stack_push(&window, true /* Animated */); text_layer_init(&nameLayer, GRect(0, 0, 144, 30)); text_layer_init(&offsetLayer, GRect(0, 30, 144, 30)); text_layer_init(&dstLayer, GRect(0, 60, 144, 30)); text_layer_init(&unixLayer, GRect(0, 90, 144, 30)); layer_add_child(&window.layer, &nameLayer.layer); layer_add_child(&window.layer, &offsetLayer.layer); layer_add_child(&window.layer, &dstLayer.layer); layer_add_child(&window.layer, &unixLayer.layer); http_set_app_id(34525634); http_register_callbacks((HTTPCallbacks){ .time=have_time, }, NULL);
// Standard app initialisation void handle_init(AppContextRef ctx) { window_init(&window, "Button App"); window_stack_push(&window, true /* Animated */); text_layer_init(&textLayer, window.layer.frame); text_layer_set_text(&textLayer, "Press select"); text_layer_set_font(&textLayer, fonts_get_system_font(FONT_KEY_GOTHAM_30_BLACK)); layer_add_child(&window.layer, &textLayer.layer); // Attach our desired button functionality window_set_click_config_provider(&window, (ClickConfigProvider) click_config_provider); // Set our app ID http_set_app_id(-1780059304); // Set up handlers. http_register_callbacks((HTTPCallbacks){ .success = success, .failure = failure }, NULL);
void handle_init(AppContextRef _ctx) { (void)_ctx; ctx = _ctx; http_set_app_id(APP_HTTP_COOKIE); window_init(&window, "PebBus"); window_stack_push(&window, true /* Animated */); stopsMenu = stops_init_menu(&window, ctx); layer_add_child(&window.layer, menu_layer_get_layer(stopsMenu)); http_register_callbacks((HTTPCallbacks){ .failure=http_failed, .success=http_success, .reconnect=http_reconnect, .location=http_location }, (void*)ctx);
void handle_init(AppContextRef ctx) { window_init(&window, "mycity"); window_stack_push(&window, true /* Animated */); window_set_background_color(&window, BACKGROUNDCOLOR); DTL_init(&city_layer, &window.layer, city_GRECT, city_FONT, _city_upd, _city_upd_cri); srand(time(NULL)); int32_t HTTP_APP_ID = RAND_MAX/2 - rand(); CITY_HTTP_COOKIE = RAND_MAX/2 - rand(); http_set_app_id(HTTP_APP_ID); HTTPCallbacks httpcallbacks = { .success = handle_success, .failure = handle_failed, .location = handle_location, .reconnect = handle_reconnect }; http_register_callbacks(httpcallbacks, ctx); }
void handle_init(AppContextRef ctx) { (void)ctx; window_init(&window, "KP Sun-Moon-Clock"); window_stack_push(&window, true /* Animated */); window_set_background_color(&window, GColorWhite); resource_init_current_app(&APP_RESOURCES); font_moon = fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_MOON_PHASES_SUBSET_30)); layer_init(&graphics_sun_layer, window.layer.frame); graphics_sun_layer.update_proc = &graphics_sun_layer_update_callback; layer_add_child(&window.layer, &graphics_sun_layer); rotbmp_pair_init_container(RESOURCE_ID_IMAGE_WATCHFACE_WHITE, RESOURCE_ID_IMAGE_WATCHFACE_BLACK, &watchface_container); layer_add_child(&graphics_sun_layer, &watchface_container.layer.layer); rotbmp_pair_layer_set_angle(&watchface_container.layer, 1); watchface_container.layer.layer.frame.origin.x = (144/2) - (watchface_container.layer.layer.frame.size.w/2); watchface_container.layer.layer.frame.origin.y = (168/2) - (watchface_container.layer.layer.frame.size.h/2); text_layer_init(&text_time_layer, window.layer.frame); text_layer_set_text_color(&text_time_layer, GColorBlack); text_layer_set_background_color(&text_time_layer, GColorClear); layer_set_frame(&text_time_layer.layer, GRect(0, 35, 144, 30)); text_layer_set_font(&text_time_layer, fonts_load_custom_font(resource_get_handle(RESOURCE_ID_FONT_ROBOTO_CONDENSED_30))); layer_add_child(&window.layer, &text_time_layer.layer); rotbmp_pair_init_container(RESOURCE_ID_IMAGE_HOUR_WHITE, RESOURCE_ID_IMAGE_HOUR_BLACK, &bitmap_container); rotbmp_pair_layer_set_src_ic(&bitmap_container.layer, GPoint(9,56)); layer_add_child(&window.layer, &bitmap_container.layer.layer); text_layer_init(&moonLayer, GRect(0, 100, 144 /* width */, 168-115 /* height */)); text_layer_set_text_color(&moonLayer, GColorWhite); text_layer_set_background_color(&moonLayer, GColorClear); text_layer_set_font(&moonLayer, font_moon); text_layer_set_text_alignment(&moonLayer, GTextAlignmentCenter); handle_day(ctx, NULL); layer_add_child(&window.layer, &moonLayer.layer); PblTm t; get_time(&t); rotbmp_pair_layer_set_angle(&bitmap_container.layer, TRIG_MAX_ANGLE * get24HourAngle(t.tm_hour, t.tm_min)); bitmap_container.layer.layer.frame.origin.x = (144/2) - (bitmap_container.layer.layer.frame.size.w/2); bitmap_container.layer.layer.frame.origin.y = (168/2) - (bitmap_container.layer.layer.frame.size.h/2); //Day of Week text text_layer_init(&dow_layer, GRect(0, 0, 144, 127+26)); text_layer_set_text_color(&dow_layer, GColorWhite); text_layer_set_background_color(&dow_layer, GColorClear); text_layer_set_font(&dow_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); text_layer_set_text_alignment(&dow_layer, GTextAlignmentLeft); text_layer_set_text(&dow_layer, "xxx"); layer_add_child(&window.layer, &dow_layer.layer); //Day of the Month text text_layer_init(&dom_layer, GRect(0, 10, 144, 137+26)); text_layer_set_text_color(&dom_layer, GColorWhite); text_layer_set_background_color(&dom_layer, GColorClear); text_layer_set_font(&dom_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24)); text_layer_set_text_alignment(&dom_layer, GTextAlignmentLeft); text_layer_set_text(&dom_layer, "00"); layer_add_child(&window.layer, &dom_layer.layer); //Month Text text_layer_init(&mon_layer, GRect(0, 0, 144, 127+26)); text_layer_set_text_color(&mon_layer, GColorWhite); text_layer_set_background_color(&mon_layer, GColorClear); text_layer_set_font(&mon_layer, fonts_get_system_font(FONT_KEY_GOTHIC_14_BOLD)); text_layer_set_text_alignment(&mon_layer, GTextAlignmentRight); text_layer_set_text(&mon_layer, "xxx"); layer_add_child(&window.layer, &mon_layer.layer); //Year Number text text_layer_init(&yon_layer, GRect(0, 10, 144, 137+26)); text_layer_set_text_color(&yon_layer, GColorWhite); text_layer_set_background_color(&yon_layer, GColorClear); text_layer_set_font(&yon_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24)); text_layer_set_text_alignment(&yon_layer, GTextAlignmentRight); text_layer_set_text(&yon_layer, "00"); layer_add_child(&window.layer, &yon_layer.layer); //Sunrise Text text_layer_init(&text_sunrise_layer, window.layer.frame); text_layer_set_text_color(&text_sunrise_layer, GColorWhite); text_layer_set_background_color(&text_sunrise_layer, GColorClear); layer_set_frame(&text_sunrise_layer.layer, GRect(0, 145, 144, 30)); text_layer_set_font(&text_sunrise_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18)); layer_add_child(&window.layer, &text_sunrise_layer.layer); //Sunset Text text_layer_init(&text_sunset_layer, window.layer.frame); text_layer_set_text_color(&text_sunset_layer, GColorWhite); text_layer_set_background_color(&text_sunset_layer, GColorClear); layer_set_frame(&text_sunset_layer.layer, GRect(0, 145, 144, 30)); text_layer_set_font(&text_sunset_layer, fonts_get_system_font(FONT_KEY_GOTHIC_18)); layer_add_child(&window.layer, &text_sunset_layer.layer); http_set_app_id(55122370); http_register_callbacks((HTTPCallbacks){ .time=have_time, .location=have_location }, (void*)ctx);