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 {
DummyAppLeft = 0,
DummyAppLeftLong,
DummyAppRight,
DummyAppRightLong,
DummyAppUpLong,
DummyAppDown,
DummyAppDownLong,
DummyAppOk,
DummyAppOkLong,
DummyAppNumber,
} 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, &desktop->settings.dummy_apps[DummyAppOk]);
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:
desktop_view_locked_update(desktop->locked_view);

View File

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

View File

@@ -91,15 +91,19 @@ bool desktop_main_input_callback(InputEvent* event, void* context) {
// Right key short is handled by animation manager
} else if(event->type == InputTypeLong) {
if(event->key == InputKeyOk) {
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
main_view->callback(DesktopAnimationEventNewIdleAnimation, main_view->context);
}
// Not working in DummyMode
// 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) {
main_view->callback(DesktopDummyEventOpenUpLong, main_view->context);
} else if(event->key == InputKeyDown) {
main_view->callback(DesktopDummyEventOpenDownLong, main_view->context);
} else if(event->key == InputKeyLeft) {
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,
DesktopSettingsFavoriteRightLong,
DesktopSettingsDummyLeft,
DesktopSettingsDummyLeftLong,
DesktopSettingsDummyRight,
DesktopSettingsDummyRightLong,
DesktopSettingsDummyUpLong,
DesktopSettingsDummyDown,
DesktopSettingsDummyDownLong,
DesktopSettingsDummyOk,
DesktopSettingsDummyOkLong,
} DesktopSettingsEntry;
#define AUTO_LOCK_DELAY_COUNT 9
@@ -142,10 +147,15 @@ void desktop_settings_scene_start_on_enter(void* context) {
variable_item_list_add(variable_item_list, "Favorite App - Right Short", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "Favorite App - Right Long", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "Dummy Mode App - Left", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "Dummy Mode App - Right", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "Dummy Mode App - Down", 1, NULL, NULL);
variable_item_list_add(variable_item_list, "Dummy Mode App - Ok", 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 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 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 Long", 1, NULL, NULL);
variable_item_list_set_enter_callback(
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_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
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:
scene_manager_set_scene_state(
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_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
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:
scene_manager_set_scene_state(
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_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
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:
scene_manager_set_scene_state(
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_manager_next_scene(app->scene_manager, DesktopSettingsAppSceneFavorite);
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:
break;