2021-05-18 18:54:56 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <gui/gui_i.h>
|
|
|
|
#include <gui/canvas.h>
|
|
|
|
#include <gui/elements.h>
|
|
|
|
#include <furi.h>
|
|
|
|
#include <filesystem-api.h>
|
|
|
|
|
2021-06-25 16:57:42 +00:00
|
|
|
#define MAX_LEN_PX 100
|
2021-06-23 21:46:52 +00:00
|
|
|
#define MAX_NAME_LEN 255
|
2021-05-18 18:54:56 +00:00
|
|
|
#define FRAME_HEIGHT 12
|
|
|
|
#define MENU_ITEMS 4
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
ArchiveFileTypeIButton,
|
|
|
|
ArchiveFileTypeNFC,
|
|
|
|
ArchiveFileTypeSubOne,
|
|
|
|
ArchiveFileTypeLFRFID,
|
|
|
|
ArchiveFileTypeIrda,
|
|
|
|
ArchiveFileTypeFolder,
|
|
|
|
ArchiveFileTypeUnknown,
|
|
|
|
AppIdTotal,
|
|
|
|
} ArchiveFileTypeEnum;
|
|
|
|
|
2021-06-25 16:57:42 +00:00
|
|
|
typedef enum {
|
2021-07-18 18:09:00 +00:00
|
|
|
ArchiveTabFavorites,
|
2021-06-25 16:57:42 +00:00
|
|
|
ArchiveTabLFRFID,
|
|
|
|
ArchiveTabSubOne,
|
|
|
|
ArchiveTabNFC,
|
|
|
|
ArchiveTabIButton,
|
|
|
|
ArchiveTabIrda,
|
|
|
|
ArchiveTabBrowser,
|
|
|
|
ArchiveTabTotal,
|
|
|
|
} ArchiveTabEnum;
|
|
|
|
|
2021-05-18 18:54:56 +00:00
|
|
|
typedef struct {
|
|
|
|
string_t name;
|
|
|
|
ArchiveFileTypeEnum type;
|
2021-06-25 16:57:42 +00:00
|
|
|
bool fav;
|
2021-05-18 18:54:56 +00:00
|
|
|
} ArchiveFile_t;
|
|
|
|
|
|
|
|
static void ArchiveFile_t_init(ArchiveFile_t* obj) {
|
|
|
|
obj->type = ArchiveFileTypeUnknown;
|
|
|
|
string_init(obj->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ArchiveFile_t_init_set(ArchiveFile_t* obj, const ArchiveFile_t* src) {
|
|
|
|
obj->type = src->type;
|
|
|
|
string_init_set(obj->name, src->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ArchiveFile_t_set(ArchiveFile_t* obj, const ArchiveFile_t* src) {
|
|
|
|
obj->type = src->type;
|
|
|
|
string_set(obj->name, src->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ArchiveFile_t_clear(ArchiveFile_t* obj) {
|
|
|
|
string_clear(obj->name);
|
|
|
|
}
|
|
|
|
|
|
|
|
ARRAY_DEF(
|
|
|
|
files_array,
|
|
|
|
ArchiveFile_t,
|
|
|
|
(INIT(API_2(ArchiveFile_t_init)),
|
|
|
|
SET(API_6(ArchiveFile_t_set)),
|
|
|
|
INIT_SET(API_6(ArchiveFile_t_init_set)),
|
|
|
|
CLEAR(API_2(ArchiveFile_t_clear))))
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint8_t tab_idx;
|
|
|
|
uint8_t menu_idx;
|
|
|
|
uint16_t idx;
|
|
|
|
uint16_t list_offset;
|
|
|
|
files_array_t files;
|
|
|
|
bool menu;
|
|
|
|
} ArchiveViewModel;
|
|
|
|
|
|
|
|
void archive_view_render(Canvas* canvas, void* model);
|
2021-06-25 16:57:42 +00:00
|
|
|
void archive_trim_file_ext(char* name);
|
|
|
|
|
|
|
|
static inline bool is_known_app(ArchiveFileTypeEnum type) {
|
|
|
|
return (type != ArchiveFileTypeFolder && type != ArchiveFileTypeUnknown);
|
|
|
|
}
|