Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/fw/applib/applib_malloc.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@
"_comment": ["Cache to speed up frequent health service API calls (only 3.9+)"]
}, {
"name": "OptionMenu",
"size_2x": 680,
"size_2x": 684,
"size_3x_padding": 12,
"size_3x": 876,
"size_3x": 880,
"dependencies": ["Window", "StatusBarLayer", "MenuLayer", "GBitmap", "GBitmap"],
"_comment": "Not exported yet (only 3.x)"
}, {
Expand Down
10 changes: 10 additions & 0 deletions src/fw/applib/ui/option_menu_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,23 @@ static void prv_select_callback(MenuLayer *menu_layer, MenuIndex *cell_index, vo
}
}

static void prv_selection_will_change_callback(MenuLayer *menu_layer, MenuIndex *new_index,
MenuIndex old_index, void *context) {
OptionMenu *option_menu = context;
if (option_menu->callbacks.selection_will_change) {
option_menu->callbacks.selection_will_change(
option_menu, new_index->row, old_index.row, option_menu->context);
}
}

static void prv_window_load(Window *window) {
OptionMenu *option_menu = window_get_user_data(window);

menu_layer_set_callbacks(&option_menu->menu_layer, option_menu, &(MenuLayerCallbacks) {
.get_cell_height = prv_get_cell_height_callback,
.get_num_rows = prv_get_num_rows_callback,
.draw_row = prv_draw_row_callback,
.selection_will_change = prv_selection_will_change_callback,
.select_click = prv_select_callback
});
menu_layer_set_click_config_onto_window(&option_menu->menu_layer, window);
Expand Down
10 changes: 10 additions & 0 deletions src/fw/applib/ui/option_menu_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,18 @@ typedef void (*OptionMenuUnloadCallback)(OptionMenu *option_menu, void *context)
typedef uint16_t (*OptionMenuGetCellHeightCallback)(OptionMenu *option_menu, uint16_t row,
bool selected, void *context);

typedef uint16_t (*OptionMenuSelectionChangedCallback)(OptionMenu *option_menu, uint16_t row,
bool selected, void *context);

typedef void (*OptionMenuSelectionWillChangeCallback)(OptionMenu *option_menu,
uint16_t new_row,
uint16_t old_row,
void *context);


typedef struct OptionMenuCallbacks {
OptionMenuSelectCallback select;
OptionMenuSelectionWillChangeCallback selection_will_change;
OptionMenuGetNumRowsCallback get_num_rows;
OptionMenuDrawRowCallback draw_row;
OptionMenuUnloadCallback unload;
Expand Down
3 changes: 2 additions & 1 deletion src/fw/apps/system_apps/launcher/default/launcher_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "kernel/pbl_malloc.h"
#include "shell/normal/app_idle_timeout.h"
#include "system/passert.h"
#include "shell/prefs.h"
#include "process_state/app_state/app_state.h"
#include "util/attributes.h"

Expand Down Expand Up @@ -130,7 +131,7 @@ static void prv_window_unload(Window *window) {
.valid = true,
.leave_time = rtc_get_ticks(),
.draw_state.selection_vertical_range = launcher_selection_vertical_range,
.draw_state.selection_background_color = LAUNCHER_MENU_LAYER_SELECTION_BACKGROUND_COLOR,
.draw_state.selection_background_color = shell_prefs_get_apps_menu_highlight_color(),
};
launcher_menu_layer_get_selection_state(&data->launcher_menu_layer,
&s_launcher_app_persisted_data.selection_state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "resource/resource_ids.auto.h"
#include "services/normal/timeline/timeline_resources.h"
#include "system/passert.h"
#include "shell/prefs.h"
#include "util/attributes.h"
#include "util/struct.h"

Expand Down Expand Up @@ -204,7 +205,7 @@ void launcher_menu_layer_init(LauncherMenuLayer *launcher_menu_layer,
MenuLayer *menu_layer = &launcher_menu_layer->menu_layer;
menu_layer_init(menu_layer, &menu_layer_frame);
menu_layer_set_highlight_colors(menu_layer,
LAUNCHER_MENU_LAYER_SELECTION_BACKGROUND_COLOR,
shell_prefs_get_apps_menu_highlight_color(),
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
menu_layer_pad_bottom_enable(menu_layer, false);
menu_layer_set_callbacks(menu_layer, launcher_menu_layer, &(MenuLayerCallbacks) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#define LAUNCHER_MENU_LAYER_SUBTITLE_FONT (FONT_KEY_GOTHIC_14)
#endif

#define LAUNCHER_MENU_LAYER_SELECTION_BACKGROUND_COLOR (PBL_IF_COLOR_ELSE(GColorVividCerulean, \
GColorBlack))

typedef struct LauncherMenuLayer {
Layer container_layer;
Expand Down
6 changes: 5 additions & 1 deletion src/fw/apps/system_apps/settings/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "resource/resource_ids.auto.h"
#include "services/common/i18n/i18n.h"
#include "system/passert.h"
#include "shell/prefs.h"

#define SETTINGS_CATEGORY_MENU_CELL_UNFOCUSED_ROUND_VERTICAL_PADDING 14

Expand All @@ -46,6 +47,9 @@ static void prv_draw_row_callback(GContext *ctx, const Layer *cell_layer,

const char *category_title = settings_menu_get_submodule_info(cell_index->row)->name;
const char *title = i18n_get(category_title, data);
menu_layer_set_highlight_colors(&(data->menu_layer),
shell_prefs_get_settings_menu_highlight_color(),
GColorWhite);
menu_cell_basic_draw(ctx, cell_layer, title, NULL, NULL);
}

Expand Down Expand Up @@ -98,7 +102,7 @@ static void prv_window_load(Window *window) {
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite),
PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack));
menu_layer_set_highlight_colors(menu_layer,
PBL_IF_COLOR_ELSE(SETTINGS_MENU_HIGHLIGHT_COLOR, GColorBlack),
shell_prefs_get_settings_menu_highlight_color(),
GColorWhite);
menu_layer_set_click_config_onto_window(menu_layer, &data->window);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ static Window *prv_init(void) {
// Not using option_menu_configure because prv_reload_menu_data already sets
// icons_enabled and chosen row index
option_menu_set_status_colors(&data->option_menu, GColorWhite, GColorBlack);
option_menu_set_highlight_colors(&data->option_menu, SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite);
option_menu_set_highlight_colors(&data->option_menu, shell_prefs_get_settings_menu_highlight_color(), GColorWhite);
option_menu_set_title(&data->option_menu, i18n_get("Background App", data));
option_menu_set_content_type(&data->option_menu, OptionMenuContentType_SingleLine);
option_menu_set_callbacks(&data->option_menu, &option_menu_callbacks, data);
Expand Down
5 changes: 5 additions & 0 deletions src/fw/apps/system_apps/settings/settings_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "settings_system.h"
#include "settings_time.h"
#include "settings_timeline.h"
#include "settings_themes.h"

#if CAPABILITY_HAS_VIBE_SCORES
#include "settings_vibe_patterns.h"
Expand All @@ -33,6 +34,7 @@
#include "applib/ui/app_window_stack.h"
#include "services/common/i18n/i18n.h"
#include "system/passert.h"
#include "shell/prefs.h"

static const SettingsModuleGetMetadata s_submodule_registry[] = {
[SettingsMenuItemBluetooth] = settings_bluetooth_get_info,
Expand All @@ -54,6 +56,9 @@ static const SettingsModuleGetMetadata s_submodule_registry[] = {
[SettingsMenuItemDateTime] = settings_system_get_info,
#endif
[SettingsMenuItemDisplay] = settings_display_get_info,
#if PBL_COLOR
[SettingsMenuItemThemes] = settings_themes_get_info,
#endif
[SettingsMenuItemSystem] = settings_system_get_info,
};

Expand Down
6 changes: 4 additions & 2 deletions src/fw/apps/system_apps/settings/settings_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@
#include "applib/graphics/gtypes.h"
#include "applib/ui/layer.h"
#include "applib/ui/window.h"
#include "shell/prefs.h"

#include <stdint.h>

#define SETTINGS_MENU_HIGHLIGHT_COLOR PBL_IF_COLOR_ELSE(GColorCobaltBlue, GColorBlack)
#define SETTINGS_MENU_TITLE_NORMAL_COLOR PBL_IF_COLOR_ELSE(GColorDarkGray, GColorBlack)

typedef enum {
SettingsMenuItemBluetooth = 0,
Expand All @@ -38,6 +37,9 @@ typedef enum {
SettingsMenuItemQuickLaunch,
SettingsMenuItemDateTime,
SettingsMenuItemDisplay,
#if PBL_COLOR
SettingsMenuItemThemes,
#endif
SettingsMenuItemActivity,
SettingsMenuItemSystem,
SettingsMenuItem_Count,
Expand Down
2 changes: 1 addition & 1 deletion src/fw/apps/system_apps/settings/settings_option_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ OptionMenu *settings_option_menu_create(
.content_type = content_type,
.choice = choice,
.status_colors = { GColorWhite, GColorBlack },
.highlight_colors = { SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite },
.highlight_colors = { shell_prefs_get_settings_menu_highlight_color(), GColorWhite },
.icons_enabled = icons_enabled,
};
option_menu_configure(option_menu, &config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "process_management/app_install_manager.h"
#include "process_management/app_menu_data_source.h"
#include "resource/resource_ids.auto.h"
#include "shell/prefs.h"

typedef struct {
AppMenuDataSource data_source;
Expand Down Expand Up @@ -126,7 +127,7 @@ void quick_launch_app_menu_window_push(ButtonId button) {
.title = i18n_get(i18n_noop("Quick Launch"), data),
.choice = (install_id == INSTALL_ID_INVALID) ? 0 : (app_index + NUM_CUSTOM_CELLS),
.status_colors = { GColorWhite, GColorBlack, },
.highlight_colors = { SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite },
.highlight_colors = { shell_prefs_get_settings_menu_highlight_color(), GColorWhite },
.icons_enabled = true,
};
option_menu_configure(option_menu, &config);
Expand Down
3 changes: 2 additions & 1 deletion src/fw/apps/system_apps/settings/settings_quiet_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "system/passert.h"
#include "util/size.h"
#include "util/string.h"
#include "shell/prefs.h"

#include <stdio.h>

Expand Down Expand Up @@ -177,7 +178,7 @@ static void prv_scheduled_dnd_menu_push(DoNotDisturbScheduleType type,
SettingsQuietTimeData *data) {
data->action_menu = (ActionMenuConfig) {
.context = data,
.colors.background = SETTINGS_MENU_HIGHLIGHT_COLOR,
.colors.background = shell_prefs_get_settings_menu_highlight_color(),
.did_close = prv_scheduled_dnd_menu_cleanup,
};

Expand Down
2 changes: 1 addition & 1 deletion src/fw/apps/system_apps/settings/settings_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void settings_remote_menu_push(struct SettingsBluetoothData *bt_data, StoredRemo

data->action_menu = (ActionMenuConfig) {
.context = data,
.colors.background = SETTINGS_MENU_HIGHLIGHT_COLOR,
.colors.background = shell_prefs_get_settings_menu_highlight_color(),
.did_close = prv_remote_menu_cleanup,
};

Expand Down
6 changes: 3 additions & 3 deletions src/fw/apps/system_apps/settings/settings_system.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static void prv_information_window_load(Window *window) {
.draw_row = prv_information_draw_row_callback,
.select_click = prv_information_select_callback,
});
menu_layer_set_highlight_colors(menu_layer, SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite);
menu_layer_set_highlight_colors(menu_layer, shell_prefs_get_settings_menu_highlight_color(), GColorWhite);
menu_layer_set_click_config_onto_window(menu_layer, &data->window);

layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer));
Expand Down Expand Up @@ -445,7 +445,7 @@ static void prv_debugging_window_load(Window *window) {
.draw_row = prv_debugging_draw_row_callback,
.select_click = prv_debugging_select_callback,
});
menu_layer_set_highlight_colors(menu_layer, SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite);
menu_layer_set_highlight_colors(menu_layer, shell_prefs_get_settings_menu_highlight_color(), GColorWhite);
menu_layer_set_click_config_onto_window(menu_layer, &data->window);

layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer));
Expand Down Expand Up @@ -891,7 +891,7 @@ static void prv_certification_window_load(Window *window) {
.draw_row = prv_certification_draw_row_callback,
.select_click = prv_certification_select_callback,
});
menu_layer_set_highlight_colors(menu_layer, SETTINGS_MENU_HIGHLIGHT_COLOR, GColorWhite);
menu_layer_set_highlight_colors(menu_layer, shell_prefs_get_settings_menu_highlight_color(), GColorWhite);
menu_layer_set_click_config_onto_window(menu_layer, &data->window);

layer_add_child(&data->window.layer, menu_layer_get_layer(menu_layer));
Expand Down
Loading
Loading