Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Minaylov <nm29719@gmail.com>2022-07-17 10:41:16 +0300
committerGitHub <noreply@github.com>2022-07-17 10:41:16 +0300
commit877c5c812236337756bd8dba8694ac0ccf53da66 (patch)
tree8556aadac4abbd63da680ba4430c340f3621a4da
parentedc6ca0c8f3cd66ccfa2a8b0bf102bb1828d388e (diff)
[FL-1962, FL-2464, FL-2465, FL-2466, FL-2560, FL-2637, FL-2595] Ibutton, Infrared, LfRFID GUI fixes (#1392)
* Ibutton, Infrared, LfRFID GUI fixes * Loading screens update Co-authored-by: あく <alleteam@gmail.com>
-rw-r--r--applications/archive/views/archive_browser_view.c13
-rw-r--r--applications/gui/modules/file_browser.c13
-rw-r--r--applications/gui/modules/loading.c15
-rw-r--r--applications/ibutton/scenes/ibutton_scene_add_type.c4
-rw-r--r--applications/ibutton/scenes/ibutton_scene_exit_confirm.c4
-rw-r--r--applications/ibutton/scenes/ibutton_scene_read_crc_error.c5
-rw-r--r--applications/ibutton/scenes/ibutton_scene_read_key_menu.c6
-rw-r--r--applications/ibutton/scenes/ibutton_scene_read_not_key_error.c5
-rw-r--r--applications/ibutton/scenes/ibutton_scene_saved_key_menu.c5
-rw-r--r--applications/ibutton/scenes/ibutton_scene_start.c5
-rw-r--r--applications/infrared/scenes/infrared_scene_ask_retry.c48
-rw-r--r--applications/infrared/scenes/infrared_scene_config.h1
-rw-r--r--applications/infrared/scenes/infrared_scene_learn_success.c3
-rw-r--r--applications/infrared/scenes/infrared_scene_remote_list.c3
-rw-r--r--applications/infrared/scenes/infrared_scene_start.c1
-rw-r--r--applications/lfrfid/scene/lfrfid_app_scene_exit_confirm.cpp2
-rw-r--r--applications/lfrfid/scene/lfrfid_app_scene_read.cpp4
-rw-r--r--applications/nfc/nfc.c24
-rw-r--r--applications/nfc/nfc_device.c15
-rw-r--r--applications/nfc/nfc_device.h7
-rwxr-xr-xapplications/nfc/nfc_i.h5
-rwxr-xr-xapplications/nfc/scenes/nfc_scene_file_select.c3
-rw-r--r--assets/icons/Archive/loading_10px.pngbin173 -> 4349 bytes
-rw-r--r--assets/icons/Common/Loading_24/frame_01.pngbin194 -> 3650 bytes
-rw-r--r--assets/icons/Common/Loading_24/frame_02.pngbin194 -> 3649 bytes
-rw-r--r--assets/icons/Common/Loading_24/frame_03.pngbin192 -> 3649 bytes
-rw-r--r--assets/icons/Common/Loading_24/frame_04.pngbin190 -> 3645 bytes
-rw-r--r--assets/icons/Common/Loading_24/frame_05.pngbin203 -> 3654 bytes
-rw-r--r--assets/icons/Common/Loading_24/frame_06.pngbin184 -> 3650 bytes
-rw-r--r--assets/icons/Common/Loading_24/frame_07.pngbin203 -> 3655 bytes
30 files changed, 147 insertions, 44 deletions
diff --git a/applications/archive/views/archive_browser_view.c b/applications/archive/views/archive_browser_view.c
index 34b875b8..810d5c8f 100644
--- a/applications/archive/views/archive_browser_view.c
+++ b/applications/archive/views/archive_browser_view.c
@@ -105,17 +105,10 @@ static void archive_draw_frame(Canvas* canvas, uint16_t idx, bool scrollbar, boo
static void archive_draw_loading(Canvas* canvas, ArchiveBrowserViewModel* model) {
furi_assert(model);
- uint8_t width = 49;
- uint8_t height = 47;
- uint8_t x = 128 / 2 - width / 2;
- uint8_t y = 64 / 2 - height / 2 + 6;
+ uint8_t x = 128 / 2 - 24 / 2;
+ uint8_t y = 64 / 2 - 24 / 2;
- elements_bold_rounded_frame(canvas, x, y, width, height);
-
- canvas_set_font(canvas, FontSecondary);
- elements_multiline_text(canvas, x + 7, y + 13, "Loading...");
-
- canvas_draw_icon(canvas, x + 13, y + 19, &A_Loading_24);
+ canvas_draw_icon(canvas, x, y, &A_Loading_24);
}
static void draw_list(Canvas* canvas, ArchiveBrowserViewModel* model) {
diff --git a/applications/gui/modules/file_browser.c b/applications/gui/modules/file_browser.c
index 1cef1d07..4dc0ee54 100644
--- a/applications/gui/modules/file_browser.c
+++ b/applications/gui/modules/file_browser.c
@@ -354,19 +354,12 @@ static void browser_draw_frame(Canvas* canvas, uint16_t idx, bool scrollbar) {
}
static void browser_draw_loading(Canvas* canvas, FileBrowserModel* model) {
- uint8_t width = 49;
- uint8_t height = 47;
- uint8_t x = 128 / 2 - width / 2;
- uint8_t y = 64 / 2 - height / 2;
-
UNUSED(model);
- elements_bold_rounded_frame(canvas, x, y, width, height);
-
- canvas_set_font(canvas, FontSecondary);
- elements_multiline_text(canvas, x + 7, y + 13, "Loading...");
+ uint8_t x = 128 / 2 - 24 / 2;
+ uint8_t y = 64 / 2 - 24 / 2;
- canvas_draw_icon(canvas, x + 13, y + 19, &A_Loading_24);
+ canvas_draw_icon(canvas, x, y, &A_Loading_24);
}
static void browser_draw_list(Canvas* canvas, FileBrowserModel* model) {
diff --git a/applications/gui/modules/loading.c b/applications/gui/modules/loading.c
index 57512697..0fa2c128 100644
--- a/applications/gui/modules/loading.c
+++ b/applications/gui/modules/loading.c
@@ -20,17 +20,16 @@ typedef struct {
static void loading_draw_callback(Canvas* canvas, void* _model) {
LoadingModel* model = (LoadingModel*)_model;
- uint8_t width = 49;
- uint8_t height = 47;
- uint8_t x = (canvas_width(canvas) - width) / 2;
- uint8_t y = (canvas_height(canvas) - height) / 2;
+ canvas_set_color(canvas, ColorWhite);
+ canvas_draw_box(canvas, 0, 0, canvas_width(canvas), canvas_height(canvas));
+ canvas_set_color(canvas, ColorBlack);
- elements_bold_rounded_frame(canvas, x, y, width, height);
+ uint8_t x = canvas_width(canvas) / 2 - 24 / 2;
+ uint8_t y = canvas_height(canvas) / 2 - 24 / 2;
- canvas_set_font(canvas, FontSecondary);
- elements_multiline_text(canvas, x + 7, y + 13, "Loading...");
+ canvas_draw_icon(canvas, x, y, &A_Loading_24);
- canvas_draw_icon_animation(canvas, x + 13, y + 19, model->icon);
+ canvas_draw_icon_animation(canvas, x, y, model->icon);
}
static bool loading_input_callback(InputEvent* event, void* context) {
diff --git a/applications/ibutton/scenes/ibutton_scene_add_type.c b/applications/ibutton/scenes/ibutton_scene_add_type.c
index 273330e7..9a0583a5 100644
--- a/applications/ibutton/scenes/ibutton_scene_add_type.c
+++ b/applications/ibutton/scenes/ibutton_scene_add_type.c
@@ -23,7 +23,8 @@ void ibutton_scene_add_type_on_enter(void* context) {
submenu_add_item(
submenu, "Metakom", SubmenuIndexMetakom, ibutton_scene_add_type_submenu_callback, ibutton);
- submenu_set_selected_item(submenu, SubmenuIndexCyfral);
+ submenu_set_selected_item(
+ submenu, scene_manager_get_scene_state(ibutton->scene_manager, iButtonSceneAddType));
view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewSubmenu);
}
@@ -34,6 +35,7 @@ bool ibutton_scene_add_type_on_event(void* context, SceneManagerEvent event) {
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
+ scene_manager_set_scene_state(ibutton->scene_manager, iButtonSceneAddType, event.event);
consumed = true;
if(event.event == SubmenuIndexCyfral) {
ibutton_key_set_type(key, iButtonKeyCyfral);
diff --git a/applications/ibutton/scenes/ibutton_scene_exit_confirm.c b/applications/ibutton/scenes/ibutton_scene_exit_confirm.c
index abd171f6..c4e90892 100644
--- a/applications/ibutton/scenes/ibutton_scene_exit_confirm.c
+++ b/applications/ibutton/scenes/ibutton_scene_exit_confirm.c
@@ -19,9 +19,9 @@ void ibutton_scene_exit_confirm_on_enter(void* context) {
widget_add_button_element(
widget, GuiButtonTypeRight, "Stay", ibutton_scene_exit_confirm_widget_callback, ibutton);
widget_add_string_element(
- widget, 64, 19, AlignCenter, AlignBottom, FontPrimary, "Exit to iButton menu");
+ widget, 64, 19, AlignCenter, AlignBottom, FontPrimary, "Exit to iButton menu?");
widget_add_string_element(
- widget, 64, 29, AlignCenter, AlignBottom, FontSecondary, "All unsaved data will be lost");
+ widget, 64, 31, AlignCenter, AlignBottom, FontSecondary, "All unsaved data will be lost.");
view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewWidget);
}
diff --git a/applications/ibutton/scenes/ibutton_scene_read_crc_error.c b/applications/ibutton/scenes/ibutton_scene_read_crc_error.c
index 28d59d2d..f822ff6a 100644
--- a/applications/ibutton/scenes/ibutton_scene_read_crc_error.c
+++ b/applications/ibutton/scenes/ibutton_scene_read_crc_error.c
@@ -43,7 +43,10 @@ bool ibutton_scene_read_crc_error_on_event(void* context, SceneManagerEvent even
SceneManager* scene_manager = ibutton->scene_manager;
bool consumed = false;
- if(event.type == SceneManagerEventTypeCustom) {
+ if(event.type == SceneManagerEventTypeBack) {
+ consumed = true;
+ scene_manager_next_scene(scene_manager, iButtonSceneExitConfirm);
+ } else if(event.type == SceneManagerEventTypeCustom) {
consumed = true;
if(event.event == DialogExResultRight) {
scene_manager_next_scene(scene_manager, iButtonSceneReadKeyMenu);
diff --git a/applications/ibutton/scenes/ibutton_scene_read_key_menu.c b/applications/ibutton/scenes/ibutton_scene_read_key_menu.c
index 7d479a46..921b24fc 100644
--- a/applications/ibutton/scenes/ibutton_scene_read_key_menu.c
+++ b/applications/ibutton/scenes/ibutton_scene_read_key_menu.c
@@ -31,8 +31,8 @@ void ibutton_scene_read_key_menu_on_enter(void* context) {
ibutton_scene_read_key_menu_submenu_callback,
ibutton);
}
-
- submenu_set_selected_item(submenu, SubmenuIndexSave);
+ submenu_set_selected_item(
+ submenu, scene_manager_get_scene_state(ibutton->scene_manager, iButtonSceneReadKeyMenu));
view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewSubmenu);
}
@@ -42,6 +42,8 @@ bool ibutton_scene_read_key_menu_on_event(void* context, SceneManagerEvent event
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
+ scene_manager_set_scene_state(
+ ibutton->scene_manager, iButtonSceneReadKeyMenu, event.event);
consumed = true;
if(event.event == SubmenuIndexSave) {
scene_manager_next_scene(ibutton->scene_manager, iButtonSceneSaveName);
diff --git a/applications/ibutton/scenes/ibutton_scene_read_not_key_error.c b/applications/ibutton/scenes/ibutton_scene_read_not_key_error.c
index 45fbefe8..8a752803 100644
--- a/applications/ibutton/scenes/ibutton_scene_read_not_key_error.c
+++ b/applications/ibutton/scenes/ibutton_scene_read_not_key_error.c
@@ -44,7 +44,10 @@ bool ibutton_scene_read_not_key_error_on_event(void* context, SceneManagerEvent
SceneManager* scene_manager = ibutton->scene_manager;
bool consumed = false;
- if(event.type == SceneManagerEventTypeCustom) {
+ if(event.type == SceneManagerEventTypeBack) {
+ consumed = true;
+ scene_manager_next_scene(scene_manager, iButtonSceneExitConfirm);
+ } else if(event.type == SceneManagerEventTypeCustom) {
consumed = true;
if(event.event == DialogExResultRight) {
scene_manager_next_scene(scene_manager, iButtonSceneReadKeyMenu);
diff --git a/applications/ibutton/scenes/ibutton_scene_saved_key_menu.c b/applications/ibutton/scenes/ibutton_scene_saved_key_menu.c
index 36529772..3d588dd0 100644
--- a/applications/ibutton/scenes/ibutton_scene_saved_key_menu.c
+++ b/applications/ibutton/scenes/ibutton_scene_saved_key_menu.c
@@ -42,7 +42,8 @@ void ibutton_scene_saved_key_menu_on_enter(void* context) {
submenu_add_item(
submenu, "Info", SubmenuIndexInfo, ibutton_scene_saved_key_menu_submenu_callback, ibutton);
- submenu_set_selected_item(submenu, SubmenuIndexEmulate);
+ submenu_set_selected_item(
+ submenu, scene_manager_get_scene_state(ibutton->scene_manager, iButtonSceneSavedKeyMenu));
view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewSubmenu);
}
@@ -52,6 +53,8 @@ bool ibutton_scene_saved_key_menu_on_event(void* context, SceneManagerEvent even
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
+ scene_manager_set_scene_state(
+ ibutton->scene_manager, iButtonSceneSavedKeyMenu, event.event);
consumed = true;
if(event.event == SubmenuIndexEmulate) {
scene_manager_next_scene(ibutton->scene_manager, iButtonSceneEmulate);
diff --git a/applications/ibutton/scenes/ibutton_scene_start.c b/applications/ibutton/scenes/ibutton_scene_start.c
index cc8af983..c2844cde 100644
--- a/applications/ibutton/scenes/ibutton_scene_start.c
+++ b/applications/ibutton/scenes/ibutton_scene_start.c
@@ -1,4 +1,5 @@
#include "../ibutton_i.h"
+#include "ibutton/scenes/ibutton_scene.h"
enum SubmenuIndex {
SubmenuIndexRead,
@@ -22,7 +23,8 @@ void ibutton_scene_start_on_enter(void* context) {
submenu_add_item(
submenu, "Add Manually", SubmenuIndexAdd, ibutton_scene_start_submenu_callback, ibutton);
- submenu_set_selected_item(submenu, SubmenuIndexRead);
+ submenu_set_selected_item(
+ submenu, scene_manager_get_scene_state(ibutton->scene_manager, iButtonSceneStart));
view_dispatcher_switch_to_view(ibutton->view_dispatcher, iButtonViewSubmenu);
}
@@ -32,6 +34,7 @@ bool ibutton_scene_start_on_event(void* context, SceneManagerEvent event) {
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
+ scene_manager_set_scene_state(ibutton->scene_manager, iButtonSceneStart, event.event);
consumed = true;
if(event.event == SubmenuIndexRead) {
scene_manager_next_scene(ibutton->scene_manager, iButtonSceneRead);
diff --git a/applications/infrared/scenes/infrared_scene_ask_retry.c b/applications/infrared/scenes/infrared_scene_ask_retry.c
new file mode 100644
index 00000000..48a5cfcd
--- /dev/null
+++ b/applications/infrared/scenes/infrared_scene_ask_retry.c
@@ -0,0 +1,48 @@
+#include "../infrared_i.h"
+
+static void infrared_scene_dialog_result_callback(DialogExResult result, void* context) {
+ Infrared* infrared = context;
+ view_dispatcher_send_custom_event(infrared->view_dispatcher, result);
+}
+
+void infrared_scene_ask_retry_on_enter(void* context) {
+ Infrared* infrared = context;
+ DialogEx* dialog_ex = infrared->dialog_ex;
+
+ dialog_ex_set_header(dialog_ex, "Return to reading?", 64, 0, AlignCenter, AlignTop);
+ dialog_ex_set_text(
+ dialog_ex, "All unsaved data\nwill be lost", 64, 31, AlignCenter, AlignCenter);
+ dialog_ex_set_icon(dialog_ex, 0, 0, NULL);
+ dialog_ex_set_left_button_text(dialog_ex, "Exit");
+ dialog_ex_set_center_button_text(dialog_ex, NULL);
+ dialog_ex_set_right_button_text(dialog_ex, "Stay");
+ dialog_ex_set_result_callback(dialog_ex, infrared_scene_dialog_result_callback);
+ dialog_ex_set_context(dialog_ex, context);
+
+ view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewDialogEx);
+}
+
+bool infrared_scene_ask_retry_on_event(void* context, SceneManagerEvent event) {
+ Infrared* infrared = context;
+ SceneManager* scene_manager = infrared->scene_manager;
+ bool consumed = false;
+
+ if(event.type == SceneManagerEventTypeBack) {
+ consumed = true;
+ } else if(event.type == SceneManagerEventTypeCustom) {
+ if(event.event == DialogExResultLeft) {
+ scene_manager_search_and_switch_to_previous_scene(scene_manager, InfraredSceneLearn);
+ consumed = true;
+ } else if(event.event == DialogExResultRight) {
+ scene_manager_previous_scene(scene_manager);
+ consumed = true;
+ }
+ }
+
+ return consumed;
+}
+
+void infrared_scene_ask_retry_on_exit(void* context) {
+ Infrared* infrared = context;
+ dialog_ex_reset(infrared->dialog_ex);
+}
diff --git a/applications/infrared/scenes/infrared_scene_config.h b/applications/infrared/scenes/infrared_scene_config.h
index 8ff3b167..26a92056 100644
--- a/applications/infrared/scenes/infrared_scene_config.h
+++ b/applications/infrared/scenes/infrared_scene_config.h
@@ -1,5 +1,6 @@
ADD_SCENE(infrared, start, Start)
ADD_SCENE(infrared, ask_back, AskBack)
+ADD_SCENE(infrared, ask_retry, AskRetry)
ADD_SCENE(infrared, edit, Edit)
ADD_SCENE(infrared, edit_delete, EditDelete)
ADD_SCENE(infrared, edit_delete_done, EditDeleteDone)
diff --git a/applications/infrared/scenes/infrared_scene_learn_success.c b/applications/infrared/scenes/infrared_scene_learn_success.c
index ec950ca7..1297ebcf 100644
--- a/applications/infrared/scenes/infrared_scene_learn_success.c
+++ b/applications/infrared/scenes/infrared_scene_learn_success.c
@@ -89,8 +89,7 @@ bool infrared_scene_learn_success_on_event(void* context, SceneManagerEvent even
} else if(event.type == SceneManagerEventTypeCustom) {
if(event.event == DialogExResultLeft) {
if(scene_state == InfraredSceneLearnSuccessStateIdle) {
- scene_manager_search_and_switch_to_previous_scene(
- scene_manager, InfraredSceneLearn);
+ scene_manager_next_scene(scene_manager, InfraredSceneAskRetry);
}
consumed = true;
} else if(event.event == DialogExResultRight) {
diff --git a/applications/infrared/scenes/infrared_scene_remote_list.c b/applications/infrared/scenes/infrared_scene_remote_list.c
index 25b37759..b0038c1a 100644
--- a/applications/infrared/scenes/infrared_scene_remote_list.c
+++ b/applications/infrared/scenes/infrared_scene_remote_list.c
@@ -5,7 +5,6 @@ void infrared_scene_remote_list_on_enter(void* context) {
SceneManager* scene_manager = infrared->scene_manager;
ViewDispatcher* view_dispatcher = infrared->view_dispatcher;
- string_set_str(infrared->file_path, INFRARED_APP_FOLDER);
bool success = dialog_file_browser_show(
infrared->dialogs,
infrared->file_path,
@@ -16,7 +15,7 @@ void infrared_scene_remote_list_on_enter(void* context) {
true);
if(success) {
- view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationHorizontal);
+ view_set_orientation(view_stack_get_view(infrared->view_stack), ViewOrientationVertical);
view_dispatcher_switch_to_view(view_dispatcher, InfraredViewStack);
infrared_show_loading_popup(infrared, true);
diff --git a/applications/infrared/scenes/infrared_scene_start.c b/applications/infrared/scenes/infrared_scene_start.c
index 6b874a3a..d188a6c3 100644
--- a/applications/infrared/scenes/infrared_scene_start.c
+++ b/applications/infrared/scenes/infrared_scene_start.c
@@ -66,6 +66,7 @@ bool infrared_scene_start_on_event(void* context, SceneManagerEvent event) {
scene_manager_next_scene(scene_manager, InfraredSceneLearn);
consumed = true;
} else if(submenu_index == SubmenuIndexSavedRemotes) {
+ string_set_str(infrared->file_path, INFRARED_APP_FOLDER);
scene_manager_next_scene(scene_manager, InfraredSceneRemoteList);
consumed = true;
} else if(submenu_index == SubmenuIndexDebug) {
diff --git a/applications/lfrfid/scene/lfrfid_app_scene_exit_confirm.cpp b/applications/lfrfid/scene/lfrfid_app_scene_exit_confirm.cpp
index d423cec9..bac0247d 100644
--- a/applications/lfrfid/scene/lfrfid_app_scene_exit_confirm.cpp
+++ b/applications/lfrfid/scene/lfrfid_app_scene_exit_confirm.cpp
@@ -19,7 +19,7 @@ void LfRfidAppSceneExitConfirm::on_enter(LfRfidApp* app, bool /* need_restore */
line_1->set_text("Exit to RFID menu?", 64, 19, 128 - 2, AlignCenter, AlignBottom, FontPrimary);
line_2->set_text(
- "All unsaved data will be lost", 64, 29, 0, AlignCenter, AlignBottom, FontSecondary);
+ "All unsaved data will be lost.", 64, 31, 0, AlignCenter, AlignBottom, FontSecondary);
app->view_controller.switch_to<ContainerVM>();
}
diff --git a/applications/lfrfid/scene/lfrfid_app_scene_read.cpp b/applications/lfrfid/scene/lfrfid_app_scene_read.cpp
index f87aa200..67279a16 100644
--- a/applications/lfrfid/scene/lfrfid_app_scene_read.cpp
+++ b/applications/lfrfid/scene/lfrfid_app_scene_read.cpp
@@ -22,9 +22,9 @@ bool LfRfidAppSceneRead::on_event(LfRfidApp* app, LfRfidApp::Event* event) {
app->scene_controller.switch_to_next_scene(LfRfidApp::SceneType::ReadSuccess);
} else {
if(app->worker.any_read()) {
- notification_message(app->notification, &sequence_blink_green_10);
+ notification_message(app->notification, &sequence_blink_yellow_10);
} else if(app->worker.detect()) {
- notification_message(app->notification, &sequence_blink_cyan_10);
+ notification_message(app->notification, &sequence_blink_yellow_10);
} else {
notification_message(app->notification, &sequence_blink_cyan_10);
}
diff --git a/applications/nfc/nfc.c b/applications/nfc/nfc.c
index e98b5d9a..0dc4b3ae 100644
--- a/applications/nfc/nfc.c
+++ b/applications/nfc/nfc.c
@@ -125,6 +125,10 @@ Nfc* nfc_alloc() {
nfc->popup = popup_alloc();
view_dispatcher_add_view(nfc->view_dispatcher, NfcViewPopup, popup_get_view(nfc->popup));
+ // Loading
+ nfc->loading = loading_alloc();
+ view_dispatcher_add_view(nfc->view_dispatcher, NfcViewLoading, loading_get_view(nfc->loading));
+
// Text Input
nfc->text_input = text_input_alloc();
view_dispatcher_add_view(
@@ -179,6 +183,10 @@ void nfc_free(Nfc* nfc) {
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewPopup);
popup_free(nfc->popup);
+ // Loading
+ view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewLoading);
+ loading_free(nfc->loading);
+
// TextInput
view_dispatcher_remove_view(nfc->view_dispatcher, NfcViewTextInput);
text_input_free(nfc->text_input);
@@ -258,12 +266,27 @@ void nfc_blink_stop(Nfc* nfc) {
notification_message(nfc->notifications, &sequence_blink_stop);
}
+void nfc_show_loading_popup(void* context, bool show) {
+ Nfc* nfc = context;
+ TaskHandle_t timer_task = xTaskGetHandle(configTIMER_SERVICE_TASK_NAME);
+
+ if(show) {
+ // Raise timer priority so that animations can play
+ vTaskPrioritySet(timer_task, configMAX_PRIORITIES - 1);
+ view_dispatcher_switch_to_view(nfc->view_dispatcher, NfcViewLoading);
+ } else {
+ // Restore default timer priority
+ vTaskPrioritySet(timer_task, configTIMER_TASK_PRIORITY);
+ }
+}
+
int32_t nfc_app(void* p) {
Nfc* nfc = nfc_alloc();
char* args = p;
// Check argument and run corresponding scene
if((*args != '\0')) {
+ nfc_device_set_loading_callback(nfc->dev, nfc_show_loading_popup, nfc);
uint32_t rpc_ctx = 0;
if(sscanf(p, "RPC %lX", &rpc_ctx) == 1) {
nfc->rpc_ctx = (void*)rpc_ctx;
@@ -281,6 +304,7 @@ int32_t nfc_app(void* p) {
// Exit app
view_dispatcher_stop(nfc->view_dispatcher);
}
+ nfc_device_set_loading_callback(nfc->dev, NULL, nfc);
} else {
scene_manager_next_scene(nfc->scene_manager, NfcSceneStart);
}
diff --git a/applications/nfc/nfc_device.c b/applications/nfc/nfc_device.c
index 155cc3f8..e4f9ac56 100644
--- a/applications/nfc/nfc_device.c
+++ b/applications/nfc/nfc_device.c
@@ -846,6 +846,10 @@ static bool nfc_device_load_data(NfcDevice* dev, string_t path, bool show_dialog
string_init(temp_str);
bool deprecated_version = false;
+ if(dev->loading_cb) {
+ dev->loading_cb(dev->loading_cb_ctx, true);
+ }
+
do {
// Check existance of shadow file
nfc_device_get_shadow_path(path, temp_str);
@@ -887,6 +891,10 @@ static bool nfc_device_load_data(NfcDevice* dev, string_t path, bool show_dialog
parsed = true;
} while(false);
+ if(dev->loading_cb) {
+ dev->loading_cb(dev->loading_cb_ctx, false);
+ }
+
if((!parsed) && (show_dialog)) {
if(deprecated_version) {
dialog_message_show_storage_error(dev->dialogs, "File format deprecated");
@@ -1024,3 +1032,10 @@ bool nfc_device_restore(NfcDevice* dev, bool use_load_path) {
string_clear(path);
return restored;
}
+
+void nfc_device_set_loading_callback(NfcDevice* dev, NfcLoadingCallback callback, void* context) {
+ furi_assert(dev);
+
+ dev->loading_cb = callback;
+ dev->loading_cb_ctx = context;
+}
diff --git a/applications/nfc/nfc_device.h b/applications/nfc/nfc_device.h
index 3b2875c0..fee9b07e 100644
--- a/applications/nfc/nfc_device.h
+++ b/applications/nfc/nfc_device.h
@@ -18,6 +18,8 @@
#define NFC_APP_EXTENSION ".nfc"
#define NFC_APP_SHADOW_EXTENSION ".shd"
+typedef void (*NfcLoadingCallback)(void* context, bool state);
+
typedef enum {
NfcDeviceProtocolUnknown,
NfcDeviceProtocolEMV,
@@ -59,6 +61,9 @@ typedef struct {
string_t load_path;
NfcDeviceSaveFormat format;
bool shadow_file_exist;
+
+ NfcLoadingCallback loading_cb;
+ void* loading_cb_ctx;
} NfcDevice;
NfcDevice* nfc_device_alloc();
@@ -82,3 +87,5 @@ void nfc_device_clear(NfcDevice* dev);
bool nfc_device_delete(NfcDevice* dev, bool use_load_path);
bool nfc_device_restore(NfcDevice* dev, bool use_load_path);
+
+void nfc_device_set_loading_callback(NfcDevice* dev, NfcLoadingCallback callback, void* context);
diff --git a/applications/nfc/nfc_i.h b/applications/nfc/nfc_i.h
index c42ddced..4b806d40 100755
--- a/applications/nfc/nfc_i.h
+++ b/applications/nfc/nfc_i.h
@@ -18,6 +18,7 @@
#include <gui/modules/submenu.h>
#include <gui/modules/dialog_ex.h>
#include <gui/modules/popup.h>
+#include <gui/modules/loading.h>
#include <gui/modules/text_input.h>
#include <gui/modules/byte_input.h>
#include <gui/modules/text_box.h>
@@ -63,6 +64,7 @@ struct Nfc {
Submenu* submenu;
DialogEx* dialog_ex;
Popup* popup;
+ Loading* loading;
TextInput* text_input;
ByteInput* byte_input;
TextBox* text_box;
@@ -77,6 +79,7 @@ typedef enum {
NfcViewMenu,
NfcViewDialogEx,
NfcViewPopup,
+ NfcViewLoading,
NfcViewTextInput,
NfcViewByteInput,
NfcViewTextBox,
@@ -97,4 +100,6 @@ void nfc_blink_start(Nfc* nfc);
void nfc_blink_stop(Nfc* nfc);
+void nfc_show_loading_popup(void* context, bool show);
+
void nfc_rpc_exit_callback(Nfc* nfc);
diff --git a/applications/nfc/scenes/nfc_scene_file_select.c b/applications/nfc/scenes/nfc_scene_file_select.c
index 36614bb8..0278c3b9 100755
--- a/applications/nfc/scenes/nfc_scene_file_select.c
+++ b/applications/nfc/scenes/nfc_scene_file_select.c
@@ -1,13 +1,16 @@
#include "../nfc_i.h"
+#include "nfc/nfc_device.h"
void nfc_scene_file_select_on_enter(void* context) {
Nfc* nfc = context;
// Process file_select return
+ nfc_device_set_loading_callback(nfc->dev, nfc_show_loading_popup, nfc);
if(nfc_file_select(nfc->dev)) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneSavedMenu);
} else {
scene_manager_search_and_switch_to_previous_scene(nfc->scene_manager, NfcSceneStart);
}
+ nfc_device_set_loading_callback(nfc->dev, NULL, nfc);
}
bool nfc_scene_file_select_on_event(void* context, SceneManagerEvent event) {
diff --git a/assets/icons/Archive/loading_10px.png b/assets/icons/Archive/loading_10px.png
index 9cc33b7f..4f626b3d 100644
--- a/assets/icons/Archive/loading_10px.png
+++ b/assets/icons/Archive/loading_10px.png
Binary files differ
diff --git a/assets/icons/Common/Loading_24/frame_01.png b/assets/icons/Common/Loading_24/frame_01.png
index d1f35692..9c49dcad 100644
--- a/assets/icons/Common/Loading_24/frame_01.png
+++ b/assets/icons/Common/Loading_24/frame_01.png
Binary files differ
diff --git a/assets/icons/Common/Loading_24/frame_02.png b/assets/icons/Common/Loading_24/frame_02.png
index b1617692..93a59fe6 100644
--- a/assets/icons/Common/Loading_24/frame_02.png
+++ b/assets/icons/Common/Loading_24/frame_02.png
Binary files differ
diff --git a/assets/icons/Common/Loading_24/frame_03.png b/assets/icons/Common/Loading_24/frame_03.png
index a915f527..7bb66fca 100644
--- a/assets/icons/Common/Loading_24/frame_03.png
+++ b/assets/icons/Common/Loading_24/frame_03.png
Binary files differ
diff --git a/assets/icons/Common/Loading_24/frame_04.png b/assets/icons/Common/Loading_24/frame_04.png
index 7f55b0df..adefde92 100644
--- a/assets/icons/Common/Loading_24/frame_04.png
+++ b/assets/icons/Common/Loading_24/frame_04.png
Binary files differ
diff --git a/assets/icons/Common/Loading_24/frame_05.png b/assets/icons/Common/Loading_24/frame_05.png
index 29d5c6aa..80bf88e9 100644
--- a/assets/icons/Common/Loading_24/frame_05.png
+++ b/assets/icons/Common/Loading_24/frame_05.png
Binary files differ
diff --git a/assets/icons/Common/Loading_24/frame_06.png b/assets/icons/Common/Loading_24/frame_06.png
index 3354ecda..b768a787 100644
--- a/assets/icons/Common/Loading_24/frame_06.png
+++ b/assets/icons/Common/Loading_24/frame_06.png
Binary files differ
diff --git a/assets/icons/Common/Loading_24/frame_07.png b/assets/icons/Common/Loading_24/frame_07.png
index 70bb37f6..190d2edf 100644
--- a/assets/icons/Common/Loading_24/frame_07.png
+++ b/assets/icons/Common/Loading_24/frame_07.png
Binary files differ