[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>
This commit is contained in:
@@ -7,6 +7,29 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void elements_scrollbar_pos(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
uint8_t y,
|
||||
uint8_t height,
|
||||
uint16_t pos,
|
||||
uint16_t total) {
|
||||
furi_assert(canvas);
|
||||
// prevent overflows
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
canvas_draw_box(canvas, x - 3, y, 3, height);
|
||||
// dot line
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
for(uint8_t i = y; i < height + y; i += 2) {
|
||||
canvas_draw_dot(canvas, x - 2, i);
|
||||
}
|
||||
// Position block
|
||||
if(total) {
|
||||
float block_h = ((float)height) / total;
|
||||
canvas_draw_box(canvas, x - 3, y + (block_h * pos), 3, MAX(block_h, 1));
|
||||
}
|
||||
}
|
||||
|
||||
void elements_scrollbar(Canvas* canvas, uint8_t pos, uint8_t total) {
|
||||
furi_assert(canvas);
|
||||
|
||||
@@ -23,7 +46,7 @@ void elements_scrollbar(Canvas* canvas, uint8_t pos, uint8_t total) {
|
||||
// Position block
|
||||
if(total) {
|
||||
uint8_t block_h = ((float)height) / total;
|
||||
canvas_draw_box(canvas, width - 3, block_h * pos, 3, block_h);
|
||||
canvas_draw_box(canvas, width - 3, block_h * pos, 3, MAX(block_h, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,23 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Draw scrollbar on canvas at specific position.
|
||||
* @param x - scrollbar position on X axis
|
||||
* @param y - scrollbar position on Y axis
|
||||
* @param height - scrollbar height
|
||||
* @param pos - current element
|
||||
* @param total - total elements
|
||||
*/
|
||||
|
||||
void elements_scrollbar_pos(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
uint8_t y,
|
||||
uint8_t height,
|
||||
uint16_t pos,
|
||||
uint16_t total);
|
||||
|
||||
/*
|
||||
* Draw scrollbar on canvas.
|
||||
* width 3px, height equal to canvas height
|
||||
|
@@ -28,14 +28,6 @@ typedef struct {
|
||||
uint8_t first_visible_byte;
|
||||
} ByteInputModel;
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
static const uint8_t keyboard_origin_x = 7;
|
||||
static const uint8_t keyboard_origin_y = 31;
|
||||
static const uint8_t keyboard_row_count = 2;
|
||||
|
Reference in New Issue
Block a user