This commit is contained in:
jbohack
2023-02-12 17:49:48 -05:00
2 changed files with 6 additions and 34 deletions

View File

@@ -93,7 +93,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
width + 2,
GUI_STATUS_BAR_WORKAREA_HEIGHT + 2);
// Hide battery background
if(xtreme_settings->status_bar) {
if(xtreme_settings->status_bar && xtreme_settings->battery_style != BatteryStyleOff) {
canvas_set_color(gui->canvas, ColorWhite);
canvas_draw_box(
gui->canvas, -1, 0, canvas_width(gui->canvas) + 1, canvas_height(gui->canvas));
@@ -119,7 +119,7 @@ static void gui_redraw_status_bar(Gui* gui, bool need_attention) {
right_used + 4,
GUI_STATUS_BAR_HEIGHT);
// Disable battery border
if(xtreme_settings->status_bar) {
if(xtreme_settings->status_bar && xtreme_settings->battery_style != BatteryStyleOff) {
canvas_set_color(gui->canvas, ColorBlack);
canvas_draw_rframe(
gui->canvas, 0, 0, canvas_width(gui->canvas), canvas_height(gui->canvas), 1);

View File

@@ -189,6 +189,7 @@ static bool browser_folder_init(
return state;
}
// Load files list by chunks, like it was originally, not compatible with sorting, sorting needs to be disabled to use this
static bool browser_folder_load_chunked(
BrowserWorker* browser,
FuriString* path,
@@ -270,8 +271,8 @@ static bool browser_folder_load_chunked(
return (items_cnt == count);
}
static bool
browser_folder_load(BrowserWorker* browser, FuriString* path, uint32_t offset, uint32_t count) {
// Load all files at once, may cause memory overflow so need to limit that to about 400 files
static bool browser_folder_load_full(BrowserWorker* browser, FuriString* path) {
FileInfo file_info;
Storage* storage = furi_record_open(RECORD_STORAGE);
@@ -288,35 +289,6 @@ static bool
if(!storage_dir_open(directory, furi_string_get_cstr(path))) {
break;
}
// items_cnt = 0;
// while(items_cnt < offset) {
// if(!storage_dir_read(directory, &file_info, name_temp, FILE_NAME_LEN_MAX)) {
// break;
// }
// if(storage_file_get_error(directory) == FSE_OK) {
// furi_string_set(name_str, name_temp);
// if(browser_filter_by_name(browser, name_str, (file_info.flags & FSF_DIRECTORY))) {
// items_cnt++;
// }
// } else {
// break;
// }
// }
// if(items_cnt != offset) {
// break;
// }
// ROGUE MASTER MOMENT
// this used to load the file list in chunks, which makes sense
// but then RM made it sort the files, still in chunks...
// so while scrolling, it loads more files and sorts them...
// chances are, the new files are higher in the sorted list...
// so the files keep shifting around while scrolling...
// now this does something intelligent: loads and sorts all in one go.
// might take a few milliseconds longer, but atleast it works
UNUSED(offset);
UNUSED(count);
if(browser->list_load_cb) {
browser->list_load_cb(browser->cb_ctx, 0);
}
@@ -450,7 +422,7 @@ static int32_t browser_worker(void* context) {
browser_folder_load_chunked(
browser, path, browser->load_offset, browser->load_count);
} else {
browser_folder_load(browser, path, browser->load_offset, browser->load_count);
browser_folder_load_full(browser, path);
}
}