Added archive scene
This commit is contained in:
parent
f624b98136
commit
a522c85d27
4 changed files with 96 additions and 6 deletions
69
project/ui/scenes/archive.c
Normal file
69
project/ui/scenes/archive.c
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
// Header
|
||||||
|
#include "archive.h"
|
||||||
|
|
||||||
|
// Structures
|
||||||
|
typedef enum {
|
||||||
|
FP_Scene_Archive_Event_Import,
|
||||||
|
FP_Scene_Archive_Event_Export
|
||||||
|
} FP_Scene_Archive_Event;
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
void FP_Scene_Callback_Archive(void* context, uint32_t index){
|
||||||
|
// Setting context
|
||||||
|
FP_App* app = context;
|
||||||
|
|
||||||
|
// Sending it to the scene manager
|
||||||
|
scene_manager_handle_custom_event(app->scene_manager, index);
|
||||||
|
}
|
||||||
|
void FP_Scene_Enter_Archive(void* context){
|
||||||
|
// Setting the context
|
||||||
|
FP_App* app = context;
|
||||||
|
|
||||||
|
// Reset view
|
||||||
|
submenu_reset(app->submenu);
|
||||||
|
|
||||||
|
// Adding some stuff
|
||||||
|
submenu_add_item(
|
||||||
|
app->submenu,
|
||||||
|
"Import Archive",
|
||||||
|
FP_Scene_Archive_Event_Import,
|
||||||
|
FP_Scene_Callback_Archive,
|
||||||
|
app
|
||||||
|
);
|
||||||
|
submenu_add_item(
|
||||||
|
app->submenu,
|
||||||
|
"Export Archive",
|
||||||
|
FP_Scene_Archive_Event_Export,
|
||||||
|
FP_Scene_Callback_Archive,
|
||||||
|
app
|
||||||
|
);
|
||||||
|
|
||||||
|
// Send view to Flipper
|
||||||
|
view_dispatcher_switch_to_view(app->view_dispatcher, FP_View_Submenu);
|
||||||
|
}
|
||||||
|
void FP_Scene_Exit_Archive(void* context){
|
||||||
|
// Setting context
|
||||||
|
FP_App* app = context;
|
||||||
|
|
||||||
|
// Reset menu
|
||||||
|
submenu_reset(app->submenu);
|
||||||
|
}
|
||||||
|
bool FP_Scene_Event_Archive(void* context, SceneManagerEvent event){
|
||||||
|
// Setting context
|
||||||
|
FP_App* app = context;
|
||||||
|
bool consumed = false;
|
||||||
|
|
||||||
|
// Switching based on event
|
||||||
|
if (event.type == SceneManagerEventTypeCustom) {
|
||||||
|
// We consumed it
|
||||||
|
consumed = true;
|
||||||
|
|
||||||
|
// Not using the app
|
||||||
|
UNUSED(app);
|
||||||
|
} else {
|
||||||
|
consumed = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return result
|
||||||
|
return consumed;
|
||||||
|
}
|
14
project/ui/scenes/archive.h
Normal file
14
project/ui/scenes/archive.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Define once
|
||||||
|
#ifndef H_S_ARCHIVE
|
||||||
|
#define H_S_ARCHIVE
|
||||||
|
|
||||||
|
// Libraries
|
||||||
|
#include "../app.h"
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
void FP_Scene_Callback_Archive(void* context, uint32_t index);
|
||||||
|
void FP_Scene_Enter_Archive(void* context);
|
||||||
|
void FP_Scene_Exit_Archive(void* context);
|
||||||
|
bool FP_Scene_Event_Archive(void* context, SceneManagerEvent event);
|
||||||
|
|
||||||
|
#endif
|
|
@ -76,15 +76,18 @@ bool FP_Scene_Event_MainMenu(void* context, SceneManagerEvent event) {
|
||||||
|
|
||||||
// What to do?
|
// What to do?
|
||||||
switch (event.event) {
|
switch (event.event) {
|
||||||
case FP_Scene_MainMenu_Event_About:
|
|
||||||
scene_manager_next_scene(app->scene_manager, FP_Scene_About);
|
|
||||||
break;
|
|
||||||
case FP_Scene_MainMenu_Event_View:
|
case FP_Scene_MainMenu_Event_View:
|
||||||
scene_manager_next_scene(app->scene_manager, FP_Scene_Overview);
|
scene_manager_next_scene(app->scene_manager, FP_Scene_Overview);
|
||||||
break;
|
break;
|
||||||
case FP_Scene_MainMenu_Event_Create:
|
case FP_Scene_MainMenu_Event_Create:
|
||||||
scene_manager_next_scene(app->scene_manager, FP_Scene_Create);
|
scene_manager_next_scene(app->scene_manager, FP_Scene_Create);
|
||||||
break;
|
break;
|
||||||
|
case FP_Scene_MainMenu_Event_Archive:
|
||||||
|
scene_manager_next_scene(app->scene_manager, FP_Scene_Archive);
|
||||||
|
break;
|
||||||
|
case FP_Scene_MainMenu_Event_About:
|
||||||
|
scene_manager_next_scene(app->scene_manager, FP_Scene_About);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "scenes/send.h"
|
#include "scenes/send.h"
|
||||||
#include "scenes/create.h"
|
#include "scenes/create.h"
|
||||||
#include "scenes/type.h"
|
#include "scenes/type.h"
|
||||||
|
#include "scenes/archive.h"
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
void (*const FP_Scene_Enter_Handlers[])(void*) = {
|
void (*const FP_Scene_Enter_Handlers[])(void*) = {
|
||||||
|
@ -20,7 +21,8 @@ void (*const FP_Scene_Enter_Handlers[])(void*) = {
|
||||||
FP_Scene_Enter_Cred,
|
FP_Scene_Enter_Cred,
|
||||||
FP_Scene_Enter_Send,
|
FP_Scene_Enter_Send,
|
||||||
FP_Scene_Enter_Create,
|
FP_Scene_Enter_Create,
|
||||||
FP_Scene_Enter_Type
|
FP_Scene_Enter_Type,
|
||||||
|
FP_Scene_Enter_Archive
|
||||||
};
|
};
|
||||||
bool (*const FP_Scene_Event_Handlers[])(void*, SceneManagerEvent) = {
|
bool (*const FP_Scene_Event_Handlers[])(void*, SceneManagerEvent) = {
|
||||||
FP_Scene_Event_Auth,
|
FP_Scene_Event_Auth,
|
||||||
|
@ -30,7 +32,8 @@ bool (*const FP_Scene_Event_Handlers[])(void*, SceneManagerEvent) = {
|
||||||
FP_Scene_Event_Cred,
|
FP_Scene_Event_Cred,
|
||||||
FP_Scene_Event_Send,
|
FP_Scene_Event_Send,
|
||||||
FP_Scene_Event_Create,
|
FP_Scene_Event_Create,
|
||||||
FP_Scene_Event_Type
|
FP_Scene_Event_Type,
|
||||||
|
FP_Scene_Event_Archive
|
||||||
};
|
};
|
||||||
void (*const FP_Scene_Exit_Handlers[])(void*) = {
|
void (*const FP_Scene_Exit_Handlers[])(void*) = {
|
||||||
FP_Scene_Exit_Auth,
|
FP_Scene_Exit_Auth,
|
||||||
|
@ -40,7 +43,8 @@ void (*const FP_Scene_Exit_Handlers[])(void*) = {
|
||||||
FP_Scene_Exit_Cred,
|
FP_Scene_Exit_Cred,
|
||||||
FP_Scene_Exit_Send,
|
FP_Scene_Exit_Send,
|
||||||
FP_Scene_Exit_Create,
|
FP_Scene_Exit_Create,
|
||||||
FP_Scene_Exit_Type
|
FP_Scene_Exit_Type,
|
||||||
|
FP_Scene_Exit_Archive
|
||||||
};
|
};
|
||||||
|
|
||||||
// Main Handler
|
// Main Handler
|
||||||
|
|
Loading…
Reference in a new issue