mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-08 23:08:10 -07:00
Move screen options to own section
This commit is contained in:
@@ -12,4 +12,5 @@ ADD_SCENE(xtreme_app, protocols_frequencies_static, ProtocolsFrequenciesStatic)
|
||||
ADD_SCENE(xtreme_app, protocols_frequencies_hopper, ProtocolsFrequenciesHopper)
|
||||
ADD_SCENE(xtreme_app, protocols_frequencies_add, ProtocolsFrequenciesAdd)
|
||||
ADD_SCENE(xtreme_app, misc, Misc)
|
||||
ADD_SCENE(xtreme_app, misc_screen, MiscScreen)
|
||||
ADD_SCENE(xtreme_app, misc_rename, MiscRename)
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
enum VarItemListIndex {
|
||||
VarItemListIndexSortDirsFirst,
|
||||
VarItemListIndexDarkMode,
|
||||
VarItemListIndexLeftHanded,
|
||||
VarItemListIndexFavoriteTimeout,
|
||||
};
|
||||
|
||||
@@ -20,24 +18,6 @@ static void xtreme_app_scene_interface_common_sort_dirs_first_changed(VariableIt
|
||||
app->save_settings = true;
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_interface_common_dark_mode_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
XTREME_SETTINGS()->dark_mode = value;
|
||||
app->save_settings = true;
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_interface_common_hand_orient_changed(VariableItem* item) {
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
if(value) {
|
||||
furi_hal_rtc_set_flag(FuriHalRtcFlagHandOrient);
|
||||
} else {
|
||||
furi_hal_rtc_reset_flag(FuriHalRtcFlagHandOrient);
|
||||
}
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_interface_common_favorite_timeout_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
uint32_t value = variable_item_get_current_value_index(item);
|
||||
@@ -63,21 +43,6 @@ void xtreme_app_scene_interface_common_on_enter(void* context) {
|
||||
variable_item_set_current_value_index(item, xtreme_settings->sort_dirs_first);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->sort_dirs_first ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list, "Dark Mode", 2, xtreme_app_scene_interface_common_dark_mode_changed, app);
|
||||
variable_item_set_current_value_index(item, xtreme_settings->dark_mode);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->dark_mode ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"Left Handed",
|
||||
2,
|
||||
xtreme_app_scene_interface_common_hand_orient_changed,
|
||||
app);
|
||||
bool value = furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient);
|
||||
variable_item_set_current_value_index(item, value);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"Favorite Timeout",
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
#include "../xtreme_app.h"
|
||||
|
||||
enum VarItemListIndex {
|
||||
VarItemListIndexScreen,
|
||||
VarItemListIndexChangeDeviceName,
|
||||
VarItemListIndexDolphinLevel,
|
||||
VarItemListIndexDolphinAngry,
|
||||
VarItemListIndexButthurtTimer,
|
||||
VarItemListIndexChargeCap,
|
||||
VarItemListIndexRgbBacklight,
|
||||
VarItemListIndexLcdColor,
|
||||
};
|
||||
|
||||
void xtreme_app_scene_misc_var_item_list_callback(void* context, uint32_t index) {
|
||||
@@ -57,15 +56,6 @@ static void xtreme_app_scene_misc_charge_cap_changed(VariableItem* item) {
|
||||
app->save_settings = true;
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_misc_lcd_color_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
uint8_t index = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(index));
|
||||
rgb_backlight_set_color(index);
|
||||
app->save_backlight = true;
|
||||
notification_message(app->notification, &sequence_display_backlight_on);
|
||||
}
|
||||
|
||||
void xtreme_app_scene_misc_on_enter(void* context) {
|
||||
XtremeApp* app = context;
|
||||
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||
@@ -73,6 +63,9 @@ void xtreme_app_scene_misc_on_enter(void* context) {
|
||||
VariableItem* item;
|
||||
uint8_t value_index;
|
||||
|
||||
item = variable_item_list_add(var_item_list, "Screen", 0, NULL, app);
|
||||
variable_item_set_current_value_text(item, ">");
|
||||
|
||||
variable_item_list_add(var_item_list, "Change Device Name", 0, NULL, app);
|
||||
|
||||
char level_str[4];
|
||||
@@ -120,20 +113,6 @@ void xtreme_app_scene_misc_on_enter(void* context) {
|
||||
variable_item_set_current_value_index(item, value_index - 1);
|
||||
variable_item_set_current_value_text(item, cap_str);
|
||||
|
||||
item = variable_item_list_add(var_item_list, "RGB Backlight", 1, NULL, app);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->rgb_backlight ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"LCD Color",
|
||||
rgb_backlight_get_color_count(),
|
||||
xtreme_app_scene_misc_lcd_color_changed,
|
||||
app);
|
||||
value_index = rgb_backlight_get_settings()->display_color_index;
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index));
|
||||
variable_item_set_locked(item, !xtreme_settings->rgb_backlight, "Needs RGB\nBacklight!");
|
||||
|
||||
variable_item_list_set_enter_callback(
|
||||
var_item_list, xtreme_app_scene_misc_var_item_list_callback, app);
|
||||
|
||||
@@ -151,36 +130,12 @@ bool xtreme_app_scene_misc_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneMisc, event.event);
|
||||
consumed = true;
|
||||
switch(event.event) {
|
||||
case VarItemListIndexScreen:
|
||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMiscScreen);
|
||||
break;
|
||||
case VarItemListIndexChangeDeviceName:
|
||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMiscRename);
|
||||
break;
|
||||
case VarItemListIndexRgbBacklight: {
|
||||
bool change = XTREME_SETTINGS()->rgb_backlight;
|
||||
if(!change) {
|
||||
DialogMessage* msg = dialog_message_alloc();
|
||||
dialog_message_set_header(msg, "RGB Backlight", 64, 0, AlignCenter, AlignTop);
|
||||
dialog_message_set_buttons(msg, "No", NULL, "Yes");
|
||||
dialog_message_set_text(
|
||||
msg,
|
||||
"This option requires installing\na hardware modification!\nIs it installed?",
|
||||
64,
|
||||
32,
|
||||
AlignCenter,
|
||||
AlignCenter);
|
||||
if(dialog_message_show(app->dialogs, msg) == DialogMessageButtonRight) {
|
||||
change = true;
|
||||
}
|
||||
dialog_message_free(msg);
|
||||
}
|
||||
if(change) {
|
||||
XTREME_SETTINGS()->rgb_backlight = !XTREME_SETTINGS()->rgb_backlight;
|
||||
app->save_settings = true;
|
||||
notification_message(app->notification, &sequence_display_backlight_on);
|
||||
scene_manager_previous_scene(app->scene_manager);
|
||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMisc);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
#include "../xtreme_app.h"
|
||||
|
||||
enum VarItemListIndex {
|
||||
VarItemListIndexDarkMode,
|
||||
VarItemListIndexLeftHanded,
|
||||
VarItemListIndexRgbBacklight,
|
||||
VarItemListIndexLcdColor,
|
||||
};
|
||||
|
||||
void xtreme_app_scene_misc_screen_var_item_list_callback(void* context, uint32_t index) {
|
||||
XtremeApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_misc_screen_dark_mode_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
XTREME_SETTINGS()->dark_mode = value;
|
||||
app->save_settings = true;
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_misc_screen_hand_orient_changed(VariableItem* item) {
|
||||
bool value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
if(value) {
|
||||
furi_hal_rtc_set_flag(FuriHalRtcFlagHandOrient);
|
||||
} else {
|
||||
furi_hal_rtc_reset_flag(FuriHalRtcFlagHandOrient);
|
||||
}
|
||||
}
|
||||
|
||||
static void xtreme_app_scene_misc_screen_lcd_color_changed(VariableItem* item) {
|
||||
XtremeApp* app = variable_item_get_context(item);
|
||||
uint8_t index = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(index));
|
||||
rgb_backlight_set_color(index);
|
||||
app->save_backlight = true;
|
||||
notification_message(app->notification, &sequence_display_backlight_on);
|
||||
}
|
||||
|
||||
void xtreme_app_scene_misc_screen_on_enter(void* context) {
|
||||
XtremeApp* app = context;
|
||||
XtremeSettings* xtreme_settings = XTREME_SETTINGS();
|
||||
VariableItemList* var_item_list = app->var_item_list;
|
||||
VariableItem* item;
|
||||
uint8_t value_index;
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list, "Dark Mode", 2, xtreme_app_scene_misc_screen_dark_mode_changed, app);
|
||||
variable_item_set_current_value_index(item, xtreme_settings->dark_mode);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->dark_mode ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list, "Left Handed", 2, xtreme_app_scene_misc_screen_hand_orient_changed, app);
|
||||
bool value = furi_hal_rtc_is_flag_set(FuriHalRtcFlagHandOrient);
|
||||
variable_item_set_current_value_index(item, value);
|
||||
variable_item_set_current_value_text(item, value ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(var_item_list, "RGB Backlight", 1, NULL, app);
|
||||
variable_item_set_current_value_text(item, xtreme_settings->rgb_backlight ? "ON" : "OFF");
|
||||
|
||||
item = variable_item_list_add(
|
||||
var_item_list,
|
||||
"LCD Color",
|
||||
rgb_backlight_get_color_count(),
|
||||
xtreme_app_scene_misc_screen_lcd_color_changed,
|
||||
app);
|
||||
value_index = rgb_backlight_get_settings()->display_color_index;
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, rgb_backlight_get_color_text(value_index));
|
||||
variable_item_set_locked(item, !xtreme_settings->rgb_backlight, "Needs RGB\nBacklight!");
|
||||
|
||||
variable_item_list_set_enter_callback(
|
||||
var_item_list, xtreme_app_scene_misc_screen_var_item_list_callback, app);
|
||||
|
||||
variable_item_list_set_selected_item(
|
||||
var_item_list,
|
||||
scene_manager_get_scene_state(app->scene_manager, XtremeAppSceneMiscScreen));
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, XtremeAppViewVarItemList);
|
||||
}
|
||||
|
||||
bool xtreme_app_scene_misc_screen_on_event(void* context, SceneManagerEvent event) {
|
||||
XtremeApp* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
scene_manager_set_scene_state(app->scene_manager, XtremeAppSceneMiscScreen, event.event);
|
||||
consumed = true;
|
||||
switch(event.event) {
|
||||
case VarItemListIndexRgbBacklight: {
|
||||
bool change = XTREME_SETTINGS()->rgb_backlight;
|
||||
if(!change) {
|
||||
DialogMessage* msg = dialog_message_alloc();
|
||||
dialog_message_set_header(msg, "RGB Backlight", 64, 0, AlignCenter, AlignTop);
|
||||
dialog_message_set_buttons(msg, "No", NULL, "Yes");
|
||||
dialog_message_set_text(
|
||||
msg,
|
||||
"This option requires installing\na hardware modification!\nIs it installed?",
|
||||
64,
|
||||
32,
|
||||
AlignCenter,
|
||||
AlignCenter);
|
||||
if(dialog_message_show(app->dialogs, msg) == DialogMessageButtonRight) {
|
||||
change = true;
|
||||
}
|
||||
dialog_message_free(msg);
|
||||
}
|
||||
if(change) {
|
||||
XTREME_SETTINGS()->rgb_backlight = !XTREME_SETTINGS()->rgb_backlight;
|
||||
app->save_settings = true;
|
||||
notification_message(app->notification, &sequence_display_backlight_on);
|
||||
scene_manager_previous_scene(app->scene_manager);
|
||||
scene_manager_next_scene(app->scene_manager, XtremeAppSceneMiscScreen);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void xtreme_app_scene_misc_screen_on_exit(void* context) {
|
||||
XtremeApp* app = context;
|
||||
variable_item_list_reset(app->var_item_list);
|
||||
}
|
||||
Reference in New Issue
Block a user