-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add confirmation before exiting USB-UART * Redo the confirm view to be a scene to ignore the back button Co-authored-by: hedger <[email protected]> Co-authored-by: あく <[email protected]>
- Loading branch information
1 parent
f46018b
commit 182c8de
Showing
5 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "gpio_app_i.h" | ||
|
||
void gpio_scene_exit_confirm_dialog_callback(DialogExResult result, void* context) { | ||
GpioApp* app = context; | ||
|
||
view_dispatcher_send_custom_event(app->view_dispatcher, result); | ||
} | ||
|
||
void gpio_scene_exit_confirm_on_enter(void* context) { | ||
GpioApp* app = context; | ||
DialogEx* dialog = app->dialog; | ||
|
||
dialog_ex_set_context(dialog, app); | ||
dialog_ex_set_left_button_text(dialog, "Exit"); | ||
dialog_ex_set_right_button_text(dialog, "Stay"); | ||
dialog_ex_set_header(dialog, "Exit USB-UART?", 22, 12, AlignLeft, AlignTop); | ||
dialog_ex_set_result_callback(dialog, gpio_scene_exit_confirm_dialog_callback); | ||
|
||
view_dispatcher_switch_to_view(app->view_dispatcher, GpioAppViewExitConfirm); | ||
} | ||
|
||
bool gpio_scene_exit_confirm_on_event(void* context, SceneManagerEvent event) { | ||
GpioApp* app = context; | ||
bool consumed = false; | ||
|
||
if(event.type == SceneManagerEventTypeCustom) { | ||
if(event.event == DialogExResultRight) { | ||
consumed = scene_manager_previous_scene(app->scene_manager); | ||
} else if(event.event == DialogExResultLeft) { | ||
scene_manager_search_and_switch_to_previous_scene(app->scene_manager, GpioSceneStart); | ||
} | ||
} else if(event.type == SceneManagerEventTypeBack) { | ||
consumed = true; | ||
} | ||
|
||
return consumed; | ||
} | ||
|
||
void gpio_scene_exit_confirm_on_exit(void* context) { | ||
GpioApp* app = context; | ||
|
||
// Clean view | ||
dialog_ex_reset(app->dialog); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters