static void down_click_handler(ClickRecognizerRef recognizer, void *context){
  // psleep(100); // wait a bit for the OS to reset the window pointers
  #ifdef PBL_COLOR
  switch(history_pi_code){
    case 1:
      window_stack_remove(s_dots_history_window, false);
      display_main_dash();
      return;
    case 2:
      history_pi_code = 1;
      break;
    case 11:
      history_pi_code = 141 ;
      break;
    case 140:
      history_pi_code = 2;
      break;
    case 141:
      history_pi_code = 140;
      break;
  }
  #else
  switch(history_pi_code){
    case 1:
      window_stack_remove(s_dots_history_window, false);
      display_main_dash();
      return;
  }
  #endif
  set_title_dates_y_axis_label();
  layer_mark_dirty(s_dots_layer);

}
Exemplo n.º 2
0
static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
  if (settings.set == false) {
    window_stack_push(s_set_window, true);
  }
  if (unlock == 0) {
    if (settings.c_1 == 2) {
      unlock = 1;
    }
  }
  else if (unlock == 1) {
    if (settings.c_2 == 2) {
      unlock = 2;
    }  
  }
  else if (unlock == 2) {
    if (settings.c_3 == 2) {
      unlock = 3;
    }  
  }
  else if (unlock == 3) {
    if (settings.c_4 == 2) {
      unlock = 0;
      window_stack_remove(s_main_window, true);
    }
  }
}
Exemplo n.º 3
0
void inbox(DictionaryIterator *iter, void *context){
  Tuple *t = dict_read_first(iter);
  if(t) process_tuple(t);
  while(t != NULL){
	t = dict_read_next(iter);
	if(t) process_tuple(t);
  }
	
  if(current == INIT){
	  current = SPLASH;
  }
  else if(current == SPLASH){
	current = HOME;
	window_stack_push(home_window, true);
	window_stack_remove(splash_window, false);
  }
  else if(current == LOADING){
	push_appropriate_window();
  }
  else if(current == MATCHUP){
	//APP_LOG(APP_LOG_LEVEL_INFO, "Old Ally: %d, Old Enemy: %d. Ally: %d, Enemy: %d.", old_matchup_ally_score_int,old_matchup_enemy_score_int,matchup_ally_score_int,matchup_enemy_score_int);
	if( (old_matchup_ally_score_int > old_matchup_enemy_score_int && matchup_ally_score_int < matchup_enemy_score_int)
	 || (old_matchup_ally_score_int < old_matchup_enemy_score_int && matchup_ally_score_int > matchup_enemy_score_int)
	 || (old_matchup_ally_score_int == 0 && old_matchup_enemy_score_int == 0 && (matchup_ally_score_int != 0 || matchup_enemy_score_int != 0)))
	{
		vibes_short_pulse();
	}
	old_matchup_ally_score_int = matchup_ally_score_int;
	old_matchup_enemy_score_int = matchup_enemy_score_int;
	   	  
	layer_mark_dirty(matchup_custom_layer);
  }
}
Exemplo n.º 4
0
static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
  // update and save
  slot_options[(s_screen * 2) + s_slot] = (uint8_t) s_item;
  persist_write_data(SLOT_KEY, slot_options, sizeof(slot_options));
  window_stack_remove(s_main_window, true);
  slots_show(s_screen);
}
Exemplo n.º 5
0
void ui_hide(Window* w)
{
    app_message_register_inbox_received(0);
    app_message_set_context(w);

    window_stack_remove(w, true);
}
Exemplo n.º 6
0
void main_menu_close(void)
{
	if (window != NULL)
	{
		window_stack_remove(window, false);
		window = NULL;
	}
}
Exemplo n.º 7
0
static void backButtonName(ClickRecognizerRef recognizer, void *ctx)
{
	if (position > 0) {
		position--;
		layer_set_frame(inverter_layer_get_layer(sInverterLayer), grectNameLayerForInverterLayer());
	} else {
		window_stack_remove(sWindow, true);
	}
}
Exemplo n.º 8
0
void emergency_conf_select_click_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context)
{
    switch(cell_index->row)
   {
     case 0:
      send_int(0);
      init();
      //remove this window frmo the stack
      window_stack_remove(window, false);
      break;
    case 1:
      send_int(4);
      emergency_init();
      //remove this window frmo the stack
      window_stack_remove(window, false);
      break;
   }
}
Exemplo n.º 9
0
static void handle_bluetooth_connected () {
  window_stack_remove(bluetooth_disconnected_splash_window, true);
  window_stack_push(bluetooth_connected_splash_window, true);

  vibes_long_pulse();
  // Hide splash screen
  app_timer_register(2000, (void*)hide_bluetooth_connected_splash_window, NULL);
  light_enable_interaction();
  //s_bluetooth_disconnection_dismissal_attempt = 0;
}
// Up click handler
static void up_click_handler(ClickRecognizerRef recognizer, void *context) {
  if (current_report > 0){
    current_report -= 1;
    window_stack_remove(report_window, true);
    window_destroy(report_window);
    report_window = window_create();
    window_set_window_handlers(report_window,(WindowHandlers){
      .load = report_window_load,
      .unload = report_window_unload
    });
Exemplo n.º 11
0
static void items_back_callback(MenuLayer *menu_layer, MenuIndex *cell_index, void *data) {
    current_list = 0;
    while (items_active_item_count > 0) {
        items_todo_list_delete(0);
    }

    unlock_info();
    hide_info();

    window_stack_remove(&items_window, true);
}
Exemplo n.º 12
0
EXTFN void chart_unload(Window *window) {
    window_stack_remove(chart_window, true);
    macro_bitmap_layer_destroy(&chart_moon);
#ifndef PBL_ROUND
    text_layer_destroy(chart_name_layer);
#endif
    text_layer_destroy(chart_text);
    layer_destroy(bar_layer);
    fonts_unload_custom_font(notice_font);
    chart_showing = false;
}
Exemplo n.º 13
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);
    }

}
Exemplo n.º 14
0
void push_appropriate_window(void){
  MenuIndex home_row = menu_layer_get_selected_index(home_menu_layer);
  switch(home_row.row){
	case 0: window_stack_push(matchup_window, true); has_initial_matchup_data = true; break;
	case 1: window_stack_push(league_window, true); has_league_data = true; break;
	case 2: window_stack_push(team_window, true); has_team_data = true; break;
	case 3: window_stack_push(credits_window, true); break;
  }
  window_stack_remove(loading_window, false);
	
  current = HOME + 1 + home_row.row;
}
Exemplo n.º 15
0
// De-Initialise UI
static void deinit(void) {
	accel_data_service_unsubscribe();
	app_timer_cancel(show_time);
	app_timer_cancel(inverter_timer);
	app_timer_cancel(time_timer);
  bitmap_layer_destroy(static_1_bitmap);
  text_layer_destroy(time_layer);
  inverter_layer_destroy(static_inverter_layer);
  gbitmap_destroy(s_res_static_1_image);
  window_stack_remove(window, false);
  window_destroy(window);
}
Exemplo n.º 16
0
static void set_alarm_on(bool on){
  if(!on){
    // off state
    vibes_cancel();
    set_spinning(false);
    window_stack_remove(s_spin_window, true);
    return;
  } 
  // on state
  spins = 0;
  set_spinning(false);
}
Exemplo n.º 17
0
void destroy_run_menu_controller(RunMenuController* self) {
  if (active_controller == 0) {
    return;
  }
  
  simple_menu_layer_destroy(active_controller->menu);
  window_stack_remove(self->window, false);
  window_destroy(self->window);  

  active_controller = 0;
  
  free(self);
}
static void back_click_handler(ClickRecognizerRef recognizer, void *context){
  // if(day_offset == 1){
  //   day_offset = 8;
  //   text_layer_set_text(s_day_layer, "14");
  //   layer_mark_dirty(s_dots_layer);
  // }else{
  //   window_stack_remove(s_dots_history_window, false);
  //   psleep(100); // wait a bit for the OS to reset the window pointers
  //   display_main_dash();
  // }
  window_stack_remove(s_dots_history_window, false);
  // psleep(100); // wait a bit for the OS to reset the window pointers
  display_main_dash();
}
static void up_click_handler(ClickRecognizerRef recognizer, void *context){
  // nothing yet
  // #ifdef PBL_COLOR
  //   display_pinteract_circle_hist(history_pi_code);
  // #endif
  // #ifdef PBL_COLOR
  #ifdef PBL_COLOR
  switch(history_pi_code){
    case 1:
      history_pi_code = 2;
      break;
    case 2:
      history_pi_code = 140;
      break;
    case 11:
      window_stack_remove(s_dots_history_window, false);
      display_main_dash();
      return;
    case 140:
      history_pi_code = 141;
      break;
    case 141:
      history_pi_code = 11;
      break;
  }
  #else
  switch(history_pi_code){
    case 1:
      window_stack_remove(s_dots_history_window, false);
      display_main_dash();
      return;
  }
  #endif
  set_title_dates_y_axis_label();
  layer_mark_dirty(s_dots_layer);

}
Exemplo n.º 20
0
static void handle_bluetooth_disconnected () {
  window_stack_remove(bluetooth_connected_splash_window, true);
  window_stack_push(bluetooth_disconnected_splash_window, true);
      
  uint32_t vibes_pluse_segments[] = { 200, 100, 200, 100, 200, 100, 200, 100, 200 };
  VibePattern vibes_pluse_pattern = {
    .durations = vibes_pluse_segments,
    .num_segments = ARRAY_LENGTH(vibes_pluse_segments),
  };

  vibes_enqueue_custom_pattern(vibes_pluse_pattern);
  light_enable_interaction();
  // Hide splash screen
  app_timer_register(5000, (void*)hide_bluetooth_disconnected_splash_window, NULL);
}
Exemplo n.º 21
0
//! Create window data and layers in here, as well as any variable prepping
//! @param window A pointer to the window the load was called by
static void prv_window_load_handler(Window *window) {
  // window properties
  Layer *root = window_get_root_layer(window);
  GRect bounds = layer_get_bounds(root);
  WindowData *data = (WindowData*)malloc(sizeof(WindowData));
  // check return
  if (data) {
    // set window properties
    window_set_user_data(window, data);
    window_set_click_config_provider_with_context(window, prv_click_config_provider, data);
    // create drawing layer and store pointer to window data in it
    data->draw_layer = layer_create_with_data(bounds, sizeof(StickFigure*));
    WindowData **layer_data = (WindowData**)layer_get_data(data->draw_layer);
    (*layer_data) = data;
    layer_set_update_proc(data->draw_layer, prv_layer_update_proc_handler);
    layer_add_child(root, data->draw_layer);

    // create the stick figure
    data->stick_figure = stick_figure_create();
    stick_figure_snap_pose(data->stick_figure, PoseWaitingForStart, prv_get_epoch_ms());

    // create the button
    data->button = drawing_button_create();

    // set some window data properties
    data->start_epoch = 0;

    // load image resources
    data->config_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_CONFIG);
    data->grid_1_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_GRID_1);
    data->grid_2_bmp = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_GRID_2);

    // open app message communication with the phone
    app_message_set_context(data);
    app_message_register_inbox_received(prv_inbox_recived);
    app_message_open(APP_MESSAGE_INBOX_SIZE_MINIMUM, APP_MESSAGE_OUTBOX_SIZE_MINIMUM);

    // start first refresh
    data->app_timer = app_timer_register(REFRESH_RATE_MS_PER_FRAME, prv_app_timer_callback, data);
    return;
  }

  // error handling
  window_stack_remove(window, false);
  APP_LOG(APP_LOG_LEVEL_ERROR, "Error: Failed to allocate memory for WindowData.");
}
Exemplo n.º 22
0
void simply_window_stack_show(SimplyWindowStack *self, SimplyWindow *window, bool is_push) {
  bool animated = (self->simply->splash == NULL);

  self->is_showing = true;
  window_stack_pop_all(!is_push);
  self->is_showing = false;

  if (is_push) {
    window_stack_push(self->pusher, false);
  }

  window_stack_push(window->window, animated);

  if (is_push) {
    window_stack_remove(self->pusher, false);
  }
}
Exemplo n.º 23
0
static void select_click_handler(ClickRecognizerRef recognizer, void *context){
  // invert the current opt from black background white text to
  text_layer_set_background_color(s_num_text_layer_ary[cur_opt], GColorWhite);
  text_layer_set_text_color(s_num_text_layer_ary[cur_opt], GColorBlack);

  cur_opt = (prm_lcl->opt_fptr_ary[cur_opt](NULL)).next_opt_i; // move to the next opt

  // if have reached the final opt, then give the data to the finish function
  if(cur_opt == 4){
    window_stack_remove(s_enter_num_window, false);
    psleep(100); // wait a bit for the OS to reset the window pointers
    (prm_lcl->opt_fptr_ary[3])(cur_num); // this is the final finishing function
  }else{
    // invert the current opt from white background black text
    text_layer_set_background_color(s_num_text_layer_ary[cur_opt], GColorBlack);
    text_layer_set_text_color(s_num_text_layer_ary[cur_opt], GColorWhite);
  }
}
Exemplo n.º 24
0
static void set_back_click_handler(ClickRecognizerRef recognizer, void *context) {
  if (settings.c_1 == 5) {
    settings.c_1 = 4;
  }
  else if (settings.c_2 == 5) {
    settings.c_2 = 4;
  }
  else if (settings.c_3 == 5) {
    settings.c_3 = 4;
  }
  else if (settings.c_4 == 5) {
    settings.c_4 = 4;
    
    window_stack_remove(s_set_window, true);
    settings.set = true;
  }
  length -= 1;
  
  snprintf(s_length_buffer, sizeof(s_length_buffer),"%d",length);
  text_layer_set_text(s_action_label, s_length_buffer);
}
Exemplo n.º 25
0
static void MyWindowDestructor(void *vptr) {
  MyWindow *mw = (MyWindow *)vptr;
  if (mw->myTextLayers) {
    freeObjects(mw->myTextLayers);
    mw->myTextLayers = NULL;
  }
  
  if (mw->appTimer) {
    app_timer_cancel(mw->appTimer);
    mw->appTimer = NULL;
  }
  
  if (mw->w) {
    APP_LOG(APP_LOG_LEVEL_DEBUG, "About to call window_destroy. mw=%p w=%p", mw, mw->w);
    window_stack_remove(mw->w, false);
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Window removed from stack.");
    window_destroy(mw->w);
    APP_LOG(APP_LOG_LEVEL_DEBUG, "Window Destroyed.");
    mw->w = NULL;
  }
  
  free(mw);
}
Exemplo n.º 26
0
static void back_click_handler(ClickRecognizerRef recognizer, void *context) {
  if (unlock == 0) {
    if (settings.c_1 == 4) {
      unlock = 1;
    }
  }
  else if (unlock == 1) {
    if (settings.c_2 == 4) {
      unlock = 2;
    }  
  }
  else if (unlock == 2) {
    if (settings.c_3 == 4) {
      unlock = 3;
    }  
  }
  else if (unlock == 3) {
    if (settings.c_4 == 4) {
      unlock = 0;
      window_stack_remove(s_main_window, true);
    }
  }
}
Exemplo n.º 27
0
/*
 * Close the settings page
 */
static void hide_set_alarm() {
  return_values();
  window_stack_remove(setting_window, true);
}
Exemplo n.º 28
0
void event_timer_callback(void *data) { // destroy all event window layers
  window_stack_remove(event_window, true);
  
}
Exemplo n.º 29
0
static void timer_callback(void *contest)
{
    window_stack_remove(splash, true);
}
Exemplo n.º 30
0
// --------------------------------------------------------
//			menu_timer_cleanup()
//
//   remove menu window so Action bar returns to function
// --------------------------------------------------------
void menu_timer_cleanup() {

	window_stack_remove(&menu_timer_window, false);

}  // menu_timer_cleanup()