Merge pull request #334 from Willy-JL/last-filebrowser-fixes

(Hopefully) last filebrowser fixes
This commit is contained in:
MX 2023-02-13 19:18:47 +03:00 committed by GitHub
commit 0abb88842a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 4 deletions

View File

@ -74,7 +74,9 @@ static void archive_list_item_cb(
browser->view,
ArchiveBrowserViewModel * model,
{
files_array_sort(model->files);
if(model->item_cnt <= BROWSER_SORT_THRESHOLD) {
files_array_sort(model->files);
}
model->list_loading = false;
},
true);

View File

@ -398,15 +398,20 @@ static bool archive_view_input(InputEvent* event, void* context) {
bool in_menu;
bool move_fav_mode;
bool is_loading;
with_view_model(
browser->view,
ArchiveBrowserViewModel * model,
{
in_menu = model->menu;
move_fav_mode = model->move_fav;
is_loading = model->folder_loading || model->list_loading;
},
false);
if(is_loading) {
return false;
}
if(in_menu) {
if(event->type != InputTypeShort) {
return true; // RETURN

View File

@ -478,7 +478,7 @@ static void browser_list_item_cb(
browser->view,
FileBrowserModel * model,
{
if(model->item_cnt < 430) {
if(model->item_cnt <= BROWSER_SORT_THRESHOLD) {
FuriString* selected = NULL;
if(model->item_idx > 0) {
selected = furi_string_alloc_set(
@ -646,7 +646,10 @@ static bool file_browser_view_input_callback(InputEvent* event, void* context) {
bool is_loading = false;
with_view_model(
browser->view, FileBrowserModel * model, { is_loading = model->folder_loading; }, false);
browser->view,
FileBrowserModel * model,
{ is_loading = model->folder_loading || model->list_loading; },
false);
if(is_loading) {
return false;

View File

@ -418,7 +418,7 @@ static int32_t browser_worker(void* context) {
if(flags & WorkerEvtLoad) {
FURI_LOG_D(
TAG, "Load offset: %lu cnt: %lu", browser->load_offset, browser->load_count);
if(items_cnt > 430) {
if(items_cnt > BROWSER_SORT_THRESHOLD) {
browser_folder_load_chunked(
browser, path, browser->load_offset, browser->load_count);
} else {

View File

@ -7,6 +7,8 @@
extern "C" {
#endif
#define BROWSER_SORT_THRESHOLD 400
typedef struct BrowserWorker BrowserWorker;
typedef void (*BrowserWorkerFolderOpenCallback)(
void* context,