static void click_config_provider(void *context) {
  window_set_click_context(BUTTON_ID_UP, context);
  window_set_click_context(BUTTON_ID_DOWN, context);
  window_set_click_context(BUTTON_ID_SELECT, context);

  window_single_click_subscribe(BUTTON_ID_UP, (ClickHandler) up_click_handler);
  window_single_click_subscribe(BUTTON_ID_DOWN, (ClickHandler) down_click_handler);
  window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler);
}
Exemple #2
0
void click_config_provider(void *context)
{
	window_set_click_context(BUTTON_ID_UP, context);
	window_set_click_context(BUTTON_ID_SELECT, context);
	window_set_click_context(BUTTON_ID_DOWN, context);
	window_single_repeating_click_subscribe(BUTTON_ID_UP, (uint16_t) 30, up_single_click_handler);
	window_single_click_subscribe(BUTTON_ID_SELECT, select_single_click_handler);
	//window_long_click_subscribe(BUTTON_ID_SELECT, 100, select_long_click_handler, select_long_click_release_handler);
	window_single_repeating_click_subscribe(BUTTON_ID_DOWN, (uint16_t) 30, down_single_click_handler);
}
Exemple #3
0
void scroll_layer_click_config_provider (void* context) {
    window_single_repeating_click_subscribe(BUTTON_ID_UP,SCROLL_LAYER_CLICK_DELAY,scroll_layer_scroll_up_click_handler);
    window_set_click_context(BUTTON_ID_UP,context);
    window_single_repeating_click_subscribe(BUTTON_ID_DOWN,SCROLL_LAYER_CLICK_DELAY,scroll_layer_scroll_down_click_handler);
    window_set_click_context(BUTTON_ID_DOWN,context);
    ScrollLayerData* scroll=(ScrollLayerData*)layer_get_data((Layer*)context);
    window_set_click_context(BUTTON_ID_SELECT,(scroll->context==0?context:scroll->context));
    if (scroll->callbacks.click_config_provider!=0)
        scroll->callbacks.click_config_provider(context);
}
Exemple #4
0
//! Click configuration provider
//! @param context User specified data to associate with click configuration
static void prv_click_config_provider(void *context) {
  // set click context for each button
  window_set_click_context(BUTTON_ID_UP, context);
  window_set_click_context(BUTTON_ID_SELECT, context);
  window_set_click_context(BUTTON_ID_DOWN, context);
  // set button click callbacks
  window_single_click_subscribe(BUTTON_ID_UP, prv_up_click_handler);
  window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_click_handler);
  window_single_repeating_click_subscribe(BUTTON_ID_DOWN, 50, prv_down_click_handler);
}
static void prv_click_config_provider(Layer *layer) {
  window_set_click_context(BUTTON_ID_UP, layer);
  window_set_click_context(BUTTON_ID_DOWN, layer);
  window_set_click_context(BUTTON_ID_SELECT, layer);
  window_set_click_context(BUTTON_ID_BACK, layer);

  window_single_repeating_click_subscribe(BUTTON_ID_UP, BUTTON_HOLD_REPEAT_MS, prv_up_click_handler);
  window_single_repeating_click_subscribe(BUTTON_ID_DOWN, BUTTON_HOLD_REPEAT_MS, prv_down_click_handler);
  window_single_click_subscribe(BUTTON_ID_SELECT, prv_select_click_handler);
  window_single_click_subscribe(BUTTON_ID_BACK, prv_back_click_handler);
}
Exemple #6
0
void scroll_layer_click_config_provider(ScrollLayer *scroll_layer) {
  // In case there's anything interesting happening in the original handler I don't know about
  scroll_layer_ccp(scroll_layer);
  // Overwrite up/down
  window_single_repeating_click_subscribe(remap[BUTTON_ID_UP], 100, scroll_layer_scroll_up_click_handler);
  window_single_repeating_click_subscribe(remap[BUTTON_ID_DOWN], 100, scroll_layer_scroll_down_click_handler);
  // Update context for the select-click handler
  // (the handler itself, if any, exists in app code and is thus handled by the earlier *_subscribe patches)
  window_set_click_context(remap[BUTTON_ID_SELECT], GET_CONTEXT(scroll_layer));
}
static void local_click_config_provider_wrapper(  ButtonId button_id, void* context )
{
    if ( config_enabled( button_id, CLICKTYPE_SINGLE ) )
        window_single_click_subscribe( button_id, local_click_handler_single ); // single click
    if ( config_enabled( button_id, CLICKTYPE_LONG ) )
        window_long_click_subscribe( button_id, 0, NULL, local_click_handler_long ); // long click, call on up
    if ( config_enabled( button_id, CLICKTYPE_MULTI ) )
        window_multi_click_subscribe( button_id, 2, 2, 0, true, local_click_handler_multi ); // double click, call on last

    window_set_click_context( button_id, context);
}
static void prv_click_config_provider(void *context) {
  // Using multi-click instead of single-click will allow the action bar animation to complete
  const uint8_t min_clicks = 1;
  const uint8_t max_clicks = 2;
  const uint16_t timeout_ms = 25;
  const bool last_click_only = true;
  window_multi_click_subscribe(BUTTON_ID_SELECT, min_clicks, max_clicks, timeout_ms,
                               last_click_only, prv_select_click_handler);

  const uint16_t repeat_interval_ms = 50;
  window_single_repeating_click_subscribe(BUTTON_ID_UP, repeat_interval_ms, prv_up_click_handler);
  window_single_repeating_click_subscribe(BUTTON_ID_DOWN, repeat_interval_ms,
                                          prv_down_click_handler);

  window_set_click_context(BUTTON_ID_SELECT, context);
}