diff --git a/applications/main/archive/views/archive_browser_view.c b/applications/main/archive/views/archive_browser_view.c index 4d330532e..f3a586cee 100644 --- a/applications/main/archive/views/archive_browser_view.c +++ b/applications/main/archive/views/archive_browser_view.c @@ -425,11 +425,20 @@ static bool archive_view_input(InputEvent* event, void* context) { } else { scroll_speed = model->button_held_for_ticks > 9 ? 4 : 2; } + } else if(model->button_held_for_ticks < 0) { + scroll_speed = 0; } if(event->key == InputKeyUp) { if(model->item_idx < scroll_speed) { scroll_speed = model->item_idx; + if(scroll_speed == 0) { + if(model->button_held_for_ticks > 0) { + model->button_held_for_ticks = -1; + } else { + scroll_speed = 1; + } + } } model->item_idx = @@ -442,11 +451,22 @@ static bool archive_view_input(InputEvent* event, void* context) { browser->callback(ArchiveBrowserEventFavMoveUp, browser->context); } model->scroll_counter = 0; + + if(model->button_held_for_ticks < -1) { + model->button_held_for_ticks = 0; + } model->button_held_for_ticks += 1; } else if(event->key == InputKeyDown) { int32_t count = model->item_cnt; if(model->item_idx >= (count - scroll_speed)) { scroll_speed = model->item_cnt - model->item_idx - 1; + if(scroll_speed == 0) { + if(model->button_held_for_ticks > 0) { + model->button_held_for_ticks = -1; + } else { + scroll_speed = 1; + } + } } model->item_idx = (model->item_idx + scroll_speed) % model->item_cnt; @@ -458,6 +478,10 @@ static bool archive_view_input(InputEvent* event, void* context) { browser->callback(ArchiveBrowserEventFavMoveDown, browser->context); } model->scroll_counter = 0; + + if(model->button_held_for_ticks < -1) { + model->button_held_for_ticks = 0; + } model->button_held_for_ticks += 1; } }, diff --git a/applications/main/archive/views/archive_browser_view.h b/applications/main/archive/views/archive_browser_view.h index 47e820599..43322eaf8 100644 --- a/applications/main/archive/views/archive_browser_view.h +++ b/applications/main/archive/views/archive_browser_view.h @@ -111,7 +111,7 @@ typedef struct { int32_t list_offset; size_t scroll_counter; - uint32_t button_held_for_ticks; + int32_t button_held_for_ticks; } ArchiveBrowserViewModel; void archive_browser_set_callback( diff --git a/applications/services/gui/modules/file_browser.c b/applications/services/gui/modules/file_browser.c index 4e6a96183..b547077f7 100644 --- a/applications/services/gui/modules/file_browser.c +++ b/applications/services/gui/modules/file_browser.c @@ -148,7 +148,7 @@ typedef struct { bool hide_ext; size_t scroll_counter; - uint32_t button_held_for_ticks; + int32_t button_held_for_ticks; } FileBrowserModel; static const Icon* BrowserItemIcons[] = { @@ -670,11 +670,20 @@ static bool file_browser_view_input_callback(InputEvent* event, void* context) { } else { scroll_speed = model->button_held_for_ticks > 9 ? 5 : 3; } + } else if(model->button_held_for_ticks < 0) { + scroll_speed = 0; } if(event->key == InputKeyUp) { if(model->item_idx < scroll_speed) { scroll_speed = model->item_idx; + if(scroll_speed == 0) { + if(model->button_held_for_ticks > 0) { + model->button_held_for_ticks = -1; + } else { + scroll_speed = 1; + } + } } model->item_idx = @@ -690,11 +699,21 @@ static bool file_browser_view_input_callback(InputEvent* event, void* context) { } model->scroll_counter = 0; + if(model->button_held_for_ticks < -1) { + model->button_held_for_ticks = 0; + } model->button_held_for_ticks += 1; } else if(event->key == InputKeyDown) { int32_t count = model->item_cnt; if(model->item_idx + scroll_speed >= count) { scroll_speed = count - model->item_idx - 1; + if(scroll_speed == 0) { + if(model->button_held_for_ticks > 0) { + model->button_held_for_ticks = -1; + } else { + scroll_speed = 1; + } + } } model->item_idx = (model->item_idx + scroll_speed) % model->item_cnt; @@ -709,6 +728,9 @@ static bool file_browser_view_input_callback(InputEvent* event, void* context) { } model->scroll_counter = 0; + if(model->button_held_for_ticks < -1) { + model->button_held_for_ticks = 0; + } model->button_held_for_ticks += 1; } },