//PRESENTATION: Sends data to android static void send_to_droid_click_handler(ClickRecognizerRef recognizer, void *context) { char new_str[strlen(text_layer_get_text(s_tracking_layer))+ strlen(" ") + strlen(text_layer_get_text(s_reps_layer))+1]; new_str[0] = '\0'; // ensures the memory is an empty string strcat(new_str,text_layer_get_text(s_tracking_layer)); strcat(new_str," "); strcat(new_str,text_layer_get_text(s_reps_layer) ); sendString(KEY_EXERCISE_VALUE, new_str); }
void display_time(struct tm *t) { static char timeText[] = "00"; static char hourText[] = "00"; static char amText[] = "am"; static char pmText[] = "pm"; // Always update the minute strftime(timeText, sizeof(timeText), "%M", t); text_layer_set_text(minuteLayer, timeText); // Update the hour only if it's changed if (hour != t->tm_hour) { hour = t->tm_hour; char *format = clock_is_24h_style() ? "%k" : "%l"; strftime(hourText, sizeof(hourText), format, t); text_layer_set_text(hourLayer, hourText); } // Update am/pm if it's not the 24h style set in settings if (!clock_is_24h_style()) { char *value = amText; if (t->tm_hour >= 12) { value = pmText; } const char *currentText = text_layer_get_text(amLayer); if (memcmp(currentText, value, 2*sizeof(char)) != 0) { // Update text layer text_layer_set_text(amLayer, value); } } }
void animation_up_stopped(Animation *animation, bool finished, void *data) { // Animation stopped! if (prev_word == text_layer_get_text(text_layer_body)) text_layer_set_text(text_layer_body, "Loading..."); text_layer_set_text(text_layer_body_next, "Loading..."); layer_set_frame(text_layer_get_layer(text_layer_body), GRect(0,50, 144, 154)); layer_set_frame(text_layer_get_layer(text_layer_body_next), GRect(0, 160, 144, 154)); }
static void second_handler(struct tm *tick_time, TimeUnits units_changed) { if (strcmp(text_layer_get_text(s_hacking_layer),"_hacking is our weapon")==0){ text_layer_set_text(s_hacking_layer, "hacking is our weapon"); }else{ text_layer_set_text(s_hacking_layer, "_hacking is our weapon"); } update_time(); battery_handler(battery_state_service_peek()); }
static void slide_in_text(SlidingTextData *data, SlidingRow *row, char* new_text) { (void) data; const char *old_text = text_layer_get_text(row->label); if (old_text) { row->next_string = new_text; row->state = PREPARE_TO_MOVE; } else { text_layer_set_text(row->label, new_text); GRect frame = layer_get_frame(text_layer_get_layer(row->label)); frame.origin.x = row->right_pos; layer_set_frame(text_layer_get_layer(row->label), frame); row->state = MOVING_IN; } }
static void sync_tuple_changed_callback(const uint32_t key, const Tuple* new_tuple, const Tuple* old_tuple, void* context) { switch (key) { case DISTANCE_KEY: text_layer_set_text(text_distance_layer, new_tuple->value->cstring); rot_arrow = (strncmp(text_layer_get_text(text_distance_layer), "NO", 2) != 0) ? true : false; break; case AZIMUTH_KEY: bearing = new_tuple->value->int16; layer_mark_dirty(arrow_layer); break; case DECLINATION_KEY: declination = new_tuple->value->int16; gotdecl = true; layer_mark_dirty(arrow_layer); break; } }
void animation_up_started(Animation *animation, void *data) { // Animation started! prev_word = text_layer_get_text(text_layer_body); }