1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 04:34:43 +04:00

Desktop favorites pt2

This commit is contained in:
gid9798
2023-08-17 13:40:55 +03:00
parent 3990c93013
commit f73f369952
5 changed files with 83 additions and 9 deletions

View File

@@ -54,9 +54,14 @@ typedef enum {
typedef enum { typedef enum {
DummyAppLeft = 0, DummyAppLeft = 0,
DummyAppLeftLong,
DummyAppRight, DummyAppRight,
DummyAppRightLong,
DummyAppUpLong,
DummyAppDown, DummyAppDown,
DummyAppDownLong,
DummyAppOk, DummyAppOk,
DummyAppOkLong,
DummyAppNumber, DummyAppNumber,
} DummyAppShortcut; } DummyAppShortcut;

View File

@@ -206,6 +206,26 @@ bool desktop_scene_main_on_event(void* context, SceneManagerEvent event) {
desktop_scene_main_open_app_or_profile( desktop_scene_main_open_app_or_profile(
desktop, &desktop->settings.dummy_apps[DummyAppOk]); desktop, &desktop->settings.dummy_apps[DummyAppOk]);
break; break;
case DesktopDummyEventOpenUpLong:
desktop_scene_main_open_app_or_profile(
desktop, &desktop->settings.dummy_apps[DummyAppUpLong]);
break;
case DesktopDummyEventOpenDownLong:
desktop_scene_main_open_app_or_profile(
desktop, &desktop->settings.dummy_apps[DummyAppDownLong]);
break;
case DesktopDummyEventOpenLeftLong:
desktop_scene_main_open_app_or_profile(
desktop, &desktop->settings.dummy_apps[DummyAppLeftLong]);
break;
case DesktopDummyEventOpenRightLong:
desktop_scene_main_open_app_or_profile(
desktop, &desktop->settings.dummy_apps[DummyAppRightLong]);
break;
case DesktopDummyEventOpenOkLong:
desktop_scene_main_open_app_or_profile(
desktop, &desktop->settings.dummy_apps[DummyAppOkLong]);
break;
case DesktopLockedEventUpdate: case DesktopLockedEventUpdate:
desktop_view_locked_update(desktop->locked_view); desktop_view_locked_update(desktop->locked_view);

View File

@@ -15,11 +15,11 @@ typedef enum {
DesktopDummyEventOpenLeft, DesktopDummyEventOpenLeft,
DesktopDummyEventOpenDown, DesktopDummyEventOpenDown,
DesktopDummyEventOpenOk, DesktopDummyEventOpenOk,
// TODO add long press in Dummy mode & RightLong
DesktopDummyEventOpenUpLong, DesktopDummyEventOpenUpLong,
DesktopDummyEventOpenDownLong, DesktopDummyEventOpenDownLong,
DesktopDummyEventOpenLeftLong, DesktopDummyEventOpenLeftLong,
DesktopDummyEventOpenRightLong,
DesktopDummyEventOpenOkLong,
DesktopLockedEventUnlocked, DesktopLockedEventUnlocked,
DesktopLockedEventUpdate, DesktopLockedEventUpdate,

View File

@@ -91,15 +91,19 @@ bool desktop_main_input_callback(InputEvent* event, void* context) {
// Right key short is handled by animation manager // Right key short is handled by animation manager
} else if(event->type == InputTypeLong) { } else if(event->type == InputTypeLong) {
if(event->key == InputKeyOk) { if(event->key == InputKeyOk) {
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { // Not working in DummyMode
main_view->callback(DesktopAnimationEventNewIdleAnimation, main_view->context); // if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
} // main_view->callback(DesktopAnimationEventNewIdleAnimation, main_view->context);
// }
main_view->callback(DesktopDummyEventOpenOkLong, main_view->context);
} else if(event->key == InputKeyUp) { } else if(event->key == InputKeyUp) {
main_view->callback(DesktopDummyEventOpenUpLong, main_view->context); main_view->callback(DesktopDummyEventOpenUpLong, main_view->context);
} else if(event->key == InputKeyDown) { } else if(event->key == InputKeyDown) {
main_view->callback(DesktopDummyEventOpenDownLong, main_view->context); main_view->callback(DesktopDummyEventOpenDownLong, main_view->context);
} else if(event->key == InputKeyLeft) { } else if(event->key == InputKeyLeft) {
main_view->callback(DesktopDummyEventOpenLeftLong, main_view->context); main_view->callback(DesktopDummyEventOpenLeftLong, main_view->context);
} else if(event->key == InputKeyRight) {
main_view->callback(DesktopDummyEventOpenRightLong, main_view->context);
} }
} }
} }

View File

@@ -17,9 +17,14 @@ typedef enum {
DesktopSettingsFavoriteRightShort, DesktopSettingsFavoriteRightShort,
DesktopSettingsFavoriteRightLong, DesktopSettingsFavoriteRightLong,
DesktopSettingsDummyLeft, DesktopSettingsDummyLeft,
DesktopSettingsDummyLeftLong,
DesktopSettingsDummyRight, DesktopSettingsDummyRight,
DesktopSettingsDummyRightLong,
DesktopSettingsDummyUpLong,
DesktopSettingsDummyDown, DesktopSettingsDummyDown,
DesktopSettingsDummyDownLong,
DesktopSettingsDummyOk, DesktopSettingsDummyOk,
DesktopSettingsDummyOkLong,
} DesktopSettingsEntry; } DesktopSettingsEntry;
#define AUTO_LOCK_DELAY_COUNT 9 #define AUTO_LOCK_DELAY_COUNT 9
@@ -143,9 +148,14 @@ void desktop_settings_scene_start_on_enter(void* context) {
variable_item_list_add(variable_item_list, "Favorite App - Right Long", 1, NULL, NULL); variable_item_list_add(variable_item_list, "Favorite App - Right Long", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "DummyMode App - Left", 1, NULL, NULL); variable_item_list_add(variable_item_list, "DummyMode App - Left", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "DummyMode App - Left Long", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "DummyMode App - Right", 1, NULL, NULL); variable_item_list_add(variable_item_list, "DummyMode App - Right", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "DummyMode App - Right Long", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "DummyMode App - Up Long", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "DummyMode App - Down", 1, NULL, NULL); variable_item_list_add(variable_item_list, "DummyMode App - Down", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "DummyMode App - Down Long", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "DummyMode App - Ok", 1, NULL, NULL); variable_item_list_add(variable_item_list, "DummyMode App - Ok", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "DummyMode App - Ok Long", 1, NULL, NULL);
variable_item_list_set_enter_callback( variable_item_list_set_enter_callback(
variable_item_list, desktop_settings_scene_start_var_list_enter_callback, app); variable_item_list, desktop_settings_scene_start_var_list_enter_callback, app);
@@ -208,6 +218,13 @@ bool desktop_settings_scene_start_on_event(void* context, SceneManagerEvent even
SCENE_STATE_SET_DUMMY_APP | DummyAppLeft); SCENE_STATE_SET_DUMMY_APP | DummyAppLeft);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite); scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
break; break;
case DesktopSettingsDummyLeftLong:
scene_manager_set_scene_state(
app->scene_manager,
DesktopSettingsAppSceneFavorite,
SCENE_STATE_SET_DUMMY_APP | DummyAppLeftLong);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
break;
case DesktopSettingsDummyRight: case DesktopSettingsDummyRight:
scene_manager_set_scene_state( scene_manager_set_scene_state(
app->scene_manager, app->scene_manager,
@@ -215,6 +232,20 @@ bool desktop_settings_scene_start_on_event(void* context, SceneManagerEvent even
SCENE_STATE_SET_DUMMY_APP | DummyAppRight); SCENE_STATE_SET_DUMMY_APP | DummyAppRight);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite); scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
break; break;
case DesktopSettingsDummyRightLong:
scene_manager_set_scene_state(
app->scene_manager,
DesktopSettingsAppSceneFavorite,
SCENE_STATE_SET_DUMMY_APP | DummyAppRightLong);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
break;
case DesktopSettingsDummyUpLong:
scene_manager_set_scene_state(
app->scene_manager,
DesktopSettingsAppSceneFavorite,
SCENE_STATE_SET_DUMMY_APP | DummyAppUpLong);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
break;
case DesktopSettingsDummyDown: case DesktopSettingsDummyDown:
scene_manager_set_scene_state( scene_manager_set_scene_state(
app->scene_manager, app->scene_manager,
@@ -222,6 +253,13 @@ bool desktop_settings_scene_start_on_event(void* context, SceneManagerEvent even
SCENE_STATE_SET_DUMMY_APP | DummyAppDown); SCENE_STATE_SET_DUMMY_APP | DummyAppDown);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite); scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
break; break;
case DesktopSettingsDummyDownLong:
scene_manager_set_scene_state(
app->scene_manager,
DesktopSettingsAppSceneFavorite,
SCENE_STATE_SET_DUMMY_APP | DummyAppDownLong);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
break;
case DesktopSettingsDummyOk: case DesktopSettingsDummyOk:
scene_manager_set_scene_state( scene_manager_set_scene_state(
app->scene_manager, app->scene_manager,
@@ -229,6 +267,13 @@ bool desktop_settings_scene_start_on_event(void* context, SceneManagerEvent even
SCENE_STATE_SET_DUMMY_APP | DummyAppOk); SCENE_STATE_SET_DUMMY_APP | DummyAppOk);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite); scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
break; break;
case DesktopSettingsDummyOkLong:
scene_manager_set_scene_state(
app->scene_manager,
DesktopSettingsAppSceneFavorite,
SCENE_STATE_SET_DUMMY_APP | DummyAppOkLong);
scene_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
break;
default: default:
break; break;