flipperzero-firmware/applications/archive/archive_views.h
its your bedtime c97d766e5b
[FL-1181] Archive app (#458)
* fix stack size, file listing works
* fix scrollbar, update docs
* cut long filenames
* Dolphin: overhaul unlocking logic, unlocked message added
* furi - added common_defines.h, minor macro cleanup; fix scrollbar type conversion
* remove door opening animation
* adaptive long file name shortening, item icons, invert selection
* archive: browser tab, file types (beta);  scenes: fix sleep emote
* dont trim unknown extensions
* fix string_size usage
* array container for file list, fixes
* better path handling
* archive: renaming, adding to favorites worksl scrollbar fix: limit min bar height to 1px to prevent disappearance on large lists

Co-authored-by: あく <alleteam@gmail.com>
2021-05-18 21:54:56 +03:00

66 lines
1.4 KiB
C

#pragma once
#include <gui/gui_i.h>
#include <gui/canvas.h>
#include <gui/elements.h>
#include <furi.h>
#include <filesystem-api.h>
#define MAX_LEN_PX 98
#define FRAME_HEIGHT 12
#define MENU_ITEMS 4
typedef enum {
ArchiveFileTypeIButton,
ArchiveFileTypeNFC,
ArchiveFileTypeSubOne,
ArchiveFileTypeLFRFID,
ArchiveFileTypeIrda,
ArchiveFileTypeFolder,
ArchiveFileTypeUnknown,
AppIdTotal,
} ArchiveFileTypeEnum;
typedef struct {
string_t name;
ArchiveFileTypeEnum type;
} 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);