예제 #1
0
void handle_init(AppContextRef ctx) {
  // Create the main window and push it in fullscreen mode
  window_init(&window, "Window Name");
  window_stack_push(&window, true /* Animated */);
  window_set_fullscreen(&window, true);

  // Initialize ressources and load the background image
  resource_init_current_app(&APP_RESOURCES);
  bmp_init_container(RESOURCE_ID_BACKGROUND_IMAGE, &background_image);
  layer_add_child(&window.layer, &background_image.layer.layer);

  // Create a text field to display the time until the next pass
  text_layer_init(&nextpass_text_layer, GRect(0, 126, 144, 34));
  text_layer_set_font(&nextpass_text_layer, fonts_get_system_font(FONT_KEY_BITHAM_34_MEDIUM_NUMBERS));
  text_layer_set_text_alignment(&nextpass_text_layer, GTextAlignmentCenter);
  text_layer_set_background_color(&nextpass_text_layer, GColorClear);
  layer_add_child(window_get_root_layer(&window), (Layer*)&time_text_layer);

  // Create a text field to display the current time
  text_layer_init(&time_text_layer, GRect(37, 0, 70, 24));
  text_layer_set_font(&time_text_layer, fonts_get_system_font(FONT_KEY_GOTHIC_24));
  text_layer_set_text_alignment(&time_text_layer, GTextAlignmentCenter);
  text_layer_set_background_color(&time_text_layer, GColorClear);
  layer_add_child(window_get_root_layer(&window), (Layer*)&nextpass_text_layer);


  // Add background and both text fields to the window

  // Start an HTTP Request
  start_http_request();
}
예제 #2
0
void up_single_click_handler(ClickRecognizerRef recognizer, Window *window) {
	currId = currId - 1;
	if (currId < 0) {
		currId = cnt - 1;
	}
	if (currId == 0) currId = 6;
	start_http_request(currId);
	text_layer_set_text(&textLayer, message);
}
예제 #3
0
static void check_request_queue()
{
  while ((running_requests < MAX_HTTP_REQUESTS)&&(request_list)) {
    struct http_fetch_buf *hfb=(struct http_fetch_buf *)
      g_list_first(request_list)->data;
    request_list=g_list_remove_link(request_list,g_list_first(request_list));
    start_http_request(hfb);
  }
}
예제 #4
0
void select_single_click_handler(ClickRecognizerRef recognizer, Window *window) {
	text_layer_set_text(&textLayer, "Connecting...");
	currId=1;
	start_http_request(1);
}
예제 #5
0
void down_single_click_handler(ClickRecognizerRef recognizer, Window *window) {
	currId = (currId + 1) % cnt;
	if (currId == 0) currId = 1;
	start_http_request(currId);
	text_layer_set_text(&textLayer, message);
}