mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-10 05:59:08 -07:00
Support adding search button to favorites
This commit is contained in:
@@ -59,7 +59,15 @@ static void
|
||||
|
||||
const char* app_name = archive_get_flipper_app_name(selected->type);
|
||||
|
||||
if(app_name) {
|
||||
if(selected->type == ArchiveFileTypeSearch) {
|
||||
while(archive_get_tab(browser) != ArchiveTabSearch) {
|
||||
archive_switch_tab(browser, TAB_LEFT);
|
||||
}
|
||||
ArchiveApp* archive;
|
||||
with_view_model(
|
||||
browser->view, ArchiveBrowserViewModel * model, { archive = model->archive; }, false);
|
||||
view_dispatcher_send_custom_event(archive->view_dispatcher, ArchiveBrowserEventSearch);
|
||||
} else if(app_name) {
|
||||
if(selected->is_app) {
|
||||
char* param = strrchr(furi_string_get_cstr(selected->path), '/');
|
||||
if(param != NULL) {
|
||||
|
||||
@@ -503,13 +503,19 @@ static bool archive_view_input(InputEvent* event, void* context) {
|
||||
}
|
||||
|
||||
ArchiveFile_t* selected = archive_get_current_file(browser);
|
||||
bool favorites = archive_get_tab(browser) == ArchiveTabFavorites;
|
||||
if(selected && selected->type == ArchiveFileTypeSearch) {
|
||||
if(event->key == InputKeyOk && event->type == InputTypeShort && cur_item_idx == 0) {
|
||||
browser->callback(ArchiveBrowserEventSearch, browser->context);
|
||||
if((cur_item_idx == 0 || favorites) && event->key == InputKeyOk) {
|
||||
if(event->type == InputTypeShort) {
|
||||
browser->callback(
|
||||
favorites ? ArchiveBrowserEventFileMenuRun : ArchiveBrowserEventSearch,
|
||||
browser->context);
|
||||
} else if(event->type == InputTypeLong) {
|
||||
browser->callback(ArchiveBrowserEventFileMenuOpen, browser->context);
|
||||
}
|
||||
}
|
||||
} else if(event->key == InputKeyOk) {
|
||||
if(selected) {
|
||||
bool favorites = archive_get_tab(browser) == ArchiveTabFavorites;
|
||||
bool folder = selected->type == ArchiveFileTypeFolder;
|
||||
|
||||
if(event->type == InputTypeShort) {
|
||||
|
||||
Reference in New Issue
Block a user