Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
"name": "IMAGE_SNOOZE",
"file": "images/action_bar_icon_snooze.png"
},
{
"type": "bitmap",
"name": "IMAGE_REPLAY",
"file": "images/action_bar_icon_replay.png"
},
{
"type": "bitmap",
"name": "IMAGE_DELETE",
Expand Down
Binary file added resources/images/action_bar_icon_replay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,27 @@ static void popup_window_snooze_timer_callback(CountdownTimer *countdown_timer,



/*
* PopupWindow replay timer callback
* restarts the timer with its original duration
*/

static void popup_window_replay_timer_callback(CountdownTimer *countdown_timer, void *context) {
countdown_timer_update(countdown_timer, countdown_timer_get_duration(countdown_timer), false);
countdown_timer_start(countdown_timer);
popup_window_pop(s_popup_window, true);
// show detail if not on top
if (!detail_window_get_topmost_window(s_detail_window)) {
detail_window_set_countdown_timer(s_detail_window, countdown_timer);
detail_window_push(s_detail_window, false);
}
detail_window_deep_refresh(s_detail_window);
// log activity
s_last_activity = countdown_timer_get_epoch_ms();
}



/*
* PopupWindow stop timer callback
* cancels the current timer vibration sequence
Expand Down Expand Up @@ -418,6 +439,7 @@ static void initialize(void) {
// create pop-up window
PopupWindowCallbacks popup_callbacks = {
.up_click = popup_window_snooze_timer_callback,
.select_click = popup_window_replay_timer_callback,
.down_click = popup_window_stop_timer_callback,
};
s_popup_window = popup_window_create();
Expand Down
9 changes: 6 additions & 3 deletions src/popup_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ struct PopupWindow {
TextLayer *text; //< displays title text
ActionBarLayer *action; //< optional action bar for dialogs
PopupWindowCallbacks callbacks; //< callbacks for optional ActionBar
GBitmap *snooze_icon, *stop_icon; //< icons for ActionBar
GBitmap *snooze_icon, *stop_icon, *replay_icon; //< icons for ActionBar

#ifndef PBL_PLATFORM_APLITE
GDrawCommandSequence *draw_sequence; //< draw command sequence
Expand Down Expand Up @@ -220,15 +220,15 @@ static void up_click_handler(ClickRecognizerRef recognizer, void *context) {
/*
* SELECT click handler callback
*
* nothing yet... here for completeness
* replays the completed timer with its original duration
*/

static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
PopupWindow *popup_window = (PopupWindow*)context;
if (popup_window->callbacks.select_click == NULL) {
return;
}
return popup_window->callbacks.select_click(context);
return popup_window->callbacks.select_click(popup_window->countdown_timer, context);
}


Expand Down Expand Up @@ -267,6 +267,7 @@ static void prv_window_load(Window* window){
// get window parameters
popup_window->stop_icon = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_DISMISS);
popup_window->snooze_icon = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_SNOOZE);
popup_window->replay_icon = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_REPLAY);

// get window parameters
Layer *root = window_get_root_layer(popup_window->window);
Expand All @@ -293,6 +294,7 @@ static void prv_window_load(Window* window){
action_bar_layer_set_context(popup_window->action, popup_window);
action_bar_layer_set_click_config_provider(popup_window->action, click_config_provider);
action_bar_layer_set_icon(popup_window->action, BUTTON_ID_UP, popup_window->snooze_icon);
action_bar_layer_set_icon(popup_window->action, BUTTON_ID_SELECT, popup_window->replay_icon);
action_bar_layer_set_icon(popup_window->action, BUTTON_ID_DOWN, popup_window->stop_icon);

if (popup_window->action_visible) {
Expand All @@ -313,6 +315,7 @@ static void prv_window_unload(Window* window){
window_destroy(popup_window->window);
gbitmap_destroy(popup_window->snooze_icon);
gbitmap_destroy(popup_window->stop_icon);
gbitmap_destroy(popup_window->replay_icon);
#ifndef PBL_PLATFORM_APLITE
if (popup_window->draw_sequence != NULL) {
gdraw_command_sequence_destroy(popup_window->draw_sequence);
Expand Down
2 changes: 1 addition & 1 deletion src/popup_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ typedef void (*PopupWindowUpClick)(CountdownTimer *countdown_timer, void *contex
* called when the SELECT button is pressed
*/

typedef void (*PopupWindowSelectClick)(void *context);
typedef void (*PopupWindowSelectClick)(CountdownTimer *countdown_timer, void *context);



Expand Down