예제 #1
0
파일: pom.c 프로젝트: Belphemur/PblPom
/** Select (middle button) click handler. Launches into settings menu. */
void pomOnMainWindowSelectClick(ClickRecognizerRef recognizer, void *context) {
    if (window_stack_contains_window(app.menuWindow)) {
        WARN("Window already in window stack");
        return;
    }
    window_stack_push(app.menuWindow, true);
}
예제 #2
0
파일: msg.c 프로젝트: SeaPea/HomeP
// Show or update window with the given message, modality, and seconds to hide the message after (0 means no auto-hide)
void show_msg(char *msg, bool modal, int hide_after) {
  s_modal = modal;
  
  if (s_window == NULL || !window_stack_contains_window(s_window)) {
    initialise_ui();
    init_click_events(click_config_provider);
    window_set_window_handlers(s_window, (WindowHandlers) {
      .unload = handle_window_unload,
    });
예제 #3
0
void update_stops_loading_text(realtime_transport_type_t ttype, char *text) {
    if (!window_stack_contains_window(transport_type_to_window_map[ttype])) {
        return;
    }

    loading_layer_set_text(transport_type_to_loadinglayer_map[ttype], text);

    if (command_timeout_timer != NULL) {
        app_timer_cancel(command_timeout_timer);
        command_timeout_timer = NULL;
    }
}
예제 #4
0
bool error_window_push(char *error_text) {
	if (window && window_stack_contains_window(window)) {
		return false;
	}

	if (text) free(text);
	text = strdup(error_text);
	if (text_layer) text_layer_set_text(text_layer, text);
	window_stack_push(window, true);

	return true;
}
예제 #5
0
/**
 * Refresh
 */
void refresh_stops_window(realtime_transport_type_t ttype) {
    if (!window_stack_contains_window(transport_type_to_window_map[ttype])) {
        return;
    }

    menu_layer_reload_data(transport_type_to_menulayer_map[ttype]);
    layer_hide(transport_type_to_loadinglayer_map[ttype]);

    if (command_timeout_timer != NULL) {
        app_timer_cancel(command_timeout_timer);
        command_timeout_timer = NULL;
    }
}
예제 #6
0
static void message_received(DictionaryIterator* received, void* context) {

    Tuple* t = dict_find(received, MESSAGE_KEY_PUBLIC_API_KEY);
    if (t && t->type == TUPLE_INT) {
        strncpy(s_result_text, "Please provide your Public API Key in the settings.", sizeof s_result_text);
        window_set_background_color(s_result_screen, GColorBlue);
        s_result_text_color = GColorWhite;
        window_stack_push(s_result_screen, true);
        window_stack_remove(s_load_screen, false);
    }

    t = dict_find(received, MESSAGE_KEY_PROGRESS);
    if (t) {
        strncpy(s_result_text, t->value->cstring, sizeof s_result_text);
        layer_mark_dirty(window_get_root_layer(s_load_screen));
        window_stack_remove(s_result_screen, true);
        if (!window_stack_contains_window(s_load_screen)) {
            window_stack_push(s_load_screen, true);
        }
    }

    t = dict_find(received, MESSAGE_KEY_SUCCESS);
    if (t) {
        strncpy(s_result_text, t->value->cstring, sizeof s_result_text);
        window_set_background_color(s_result_screen, GColorScreaminGreen);
        s_result_text_color = GColorBlack;
        window_stack_push(s_result_screen, true);
        window_stack_remove(s_load_screen, false);
        app_timer_register(6000, &success_auto_close, NULL);
    }

    t = dict_find(received, MESSAGE_KEY_ERROR);
    if (t && t->type == TUPLE_CSTRING) {
        strncpy(s_result_text, t->value->cstring, sizeof s_result_text);
        window_set_background_color(s_result_screen, GColorFolly);
        s_result_text_color = GColorWhite;
        window_stack_push(s_result_screen, true);
        window_stack_remove(s_load_screen, false);
    }

}
예제 #7
0
void handle_tick(struct tm *tick_time, TimeUnits units){
	if(current == MATCHUP && window_stack_contains_window(matchup_window) && tick_time->tm_min%5 == 0) send_request("MATCHUP");
}