mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-23 04:53:08 +00:00
Add Info to all files, fix file info elements position
This commit is contained in:
parent
7f4b586b13
commit
1fd9240481
4 changed files with 27 additions and 23 deletions
|
@ -143,6 +143,8 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
|
|||
consumed = true;
|
||||
break;
|
||||
case ArchiveBrowserEventFileMenuInfo:
|
||||
scene_manager_set_scene_state(
|
||||
archive->scene_manager, ArchiveAppSceneBrowser, SCENE_STATE_NEED_REFRESH);
|
||||
scene_manager_next_scene(archive->scene_manager, ArchiveAppSceneInfo);
|
||||
consumed = true;
|
||||
break;
|
||||
|
|
|
@ -33,7 +33,11 @@ void archive_scene_info_on_enter(void* context) {
|
|||
path_extract_filename(current->path, filename, false);
|
||||
snprintf(file_info_message, sizeof(file_info_message), "\e#%s\e#", string_get_cstr(filename));
|
||||
widget_add_text_box_element(
|
||||
app->widget, 0, 0, 128, 20, AlignLeft, AlignCenter, file_info_message, false);
|
||||
app->widget, 0, 0, 128, 25, AlignLeft, AlignCenter, file_info_message, false);
|
||||
|
||||
// Directory path
|
||||
path_extract_dirname(string_get_cstr(current->path), dirname);
|
||||
string_replace_str(dirname, STORAGE_ANY_PATH_PREFIX, "");
|
||||
|
||||
// File size
|
||||
FileInfo fileinfo;
|
||||
|
@ -42,16 +46,12 @@ void archive_scene_info_on_enter(void* context) {
|
|||
snprintf(
|
||||
file_info_message,
|
||||
sizeof(file_info_message),
|
||||
"Size: \e#%s\e# Kb.",
|
||||
string_get_cstr(str_size));
|
||||
"Size: \e#%s\e# Kb.\n%s",
|
||||
string_get_cstr(str_size),
|
||||
string_get_cstr(dirname)
|
||||
);
|
||||
widget_add_text_box_element(
|
||||
app->widget, 0, 23, 128, 20, AlignLeft, AlignCenter, file_info_message, false);
|
||||
|
||||
// Directory path
|
||||
path_extract_dirname(string_get_cstr(current->path), dirname);
|
||||
string_replace_str(dirname, STORAGE_ANY_PATH_PREFIX, "");
|
||||
widget_add_text_box_element(
|
||||
app->widget, 0, 23, 128, 20, AlignLeft, AlignCenter, string_get_cstr(dirname), false);
|
||||
app->widget, 0, 25, 128, 25, AlignLeft, AlignCenter, file_info_message, false);
|
||||
|
||||
string_clear(filename);
|
||||
string_clear(dirname);
|
||||
|
@ -65,7 +65,8 @@ bool archive_scene_info_on_event(void* context, SceneManagerEvent event) {
|
|||
ArchiveApp* app = (ArchiveApp*)context;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
return scene_manager_previous_scene(app->scene_manager);
|
||||
scene_manager_next_scene(app->scene_manager, ArchiveAppSceneBrowser);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ static void render_item_menu(Canvas* canvas, ArchiveBrowserViewModel* model) {
|
|||
string_set_str(item_pin, "Unpin");
|
||||
}
|
||||
|
||||
if (selected->type == ArchiveFileTypeFolder) {
|
||||
if(selected->type == ArchiveFileTypeFolder) {
|
||||
FURI_LOG_D(TAG, "Directory type");
|
||||
archive_menu_add_item(
|
||||
menu_array_push_raw(model->context_menu),
|
||||
|
@ -136,6 +136,10 @@ static void render_item_menu(Canvas* canvas, ArchiveBrowserViewModel* model) {
|
|||
menu_array_push_raw(model->context_menu),
|
||||
item_pin,
|
||||
ArchiveBrowserEventFileMenuPin);
|
||||
archive_menu_add_item(
|
||||
menu_array_push_raw(model->context_menu),
|
||||
item_info,
|
||||
ArchiveBrowserEventFileMenuInfo);
|
||||
archive_menu_add_item(
|
||||
menu_array_push_raw(model->context_menu),
|
||||
item_rename,
|
||||
|
@ -152,20 +156,17 @@ static void render_item_menu(Canvas* canvas, ArchiveBrowserViewModel* model) {
|
|||
string_clear(item_rename);
|
||||
string_clear(item_delete);
|
||||
} else {
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
"menu_array_size already set: %d",
|
||||
menu_array_size(model->context_menu));
|
||||
FURI_LOG_D(TAG, "menu_array_size already set: %d", menu_array_size(model->context_menu));
|
||||
}
|
||||
size_t size_menu = menu_array_size(model->context_menu);
|
||||
const uint8_t menu_height = 44;
|
||||
const uint8_t line_height = 11;
|
||||
const uint8_t menu_height = 48;
|
||||
const uint8_t line_height = 10;
|
||||
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
uint8_t calc_height = menu_height - ((MENU_ITEMS - size_menu) * line_height);
|
||||
canvas_draw_box(canvas, 71, 17, 57, calc_height + 2);
|
||||
canvas_draw_box(canvas, 71, 11, 57, calc_height + 4);
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
elements_slightly_rounded_frame(canvas, 70, 16, 58, calc_height + 4);
|
||||
elements_slightly_rounded_frame(canvas, 70, 12, 58, calc_height + 4);
|
||||
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
|
@ -175,10 +176,10 @@ static void render_item_menu(Canvas* canvas, ArchiveBrowserViewModel* model) {
|
|||
model->menu_idx);
|
||||
for(size_t i = 0; i < size_menu; i++) {
|
||||
ArchiveContextMenuItem_t* current = menu_array_get(model->context_menu, i);
|
||||
canvas_draw_str(canvas, 82, 27 + i * line_height, string_get_cstr(current->text));
|
||||
canvas_draw_str(canvas, 82, 21 + i * line_height, string_get_cstr(current->text));
|
||||
}
|
||||
|
||||
canvas_draw_icon(canvas, 74, 20 + model->menu_idx * line_height, &I_ButtonRight_4x7);
|
||||
canvas_draw_icon(canvas, 74, 14 + model->menu_idx * line_height, &I_ButtonRight_4x7);
|
||||
}
|
||||
|
||||
static void archive_draw_frame(Canvas* canvas, uint16_t idx, bool scrollbar, bool moving) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#define MAX_NAME_LEN 255
|
||||
#define MAX_EXT_LEN 6
|
||||
#define FRAME_HEIGHT 12
|
||||
#define MENU_ITEMS 4u
|
||||
#define MENU_ITEMS 5u
|
||||
#define MOVE_OFFSET 5u
|
||||
|
||||
typedef enum {
|
||||
|
|
Loading…
Reference in a new issue