Skip to content

Commit 27ca402

Browse files
committed
fw/apps/settings_themes: make preview better
Signed-off-by: Elad Dvash <e.d.dvash@gmail.com>
1 parent c2f6f0f commit 27ca402

2 files changed

Lines changed: 40 additions & 34 deletions

File tree

src/fw/apps/system_apps/settings/settings_themes.c

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ static void prv_apps_color_menu_select(OptionMenu *option_menu, int selection, v
133133
if (selection == 0){
134134
/* Default option selected -> restore default color. */
135135
shell_prefs_set_apps_menu_highlight_color(DEFAULT_APPS_HIGHLIGHT_COLOR);
136-
app_window_stack_remove(&option_menu->window, true /* animated */);
137-
return;
138136
}
139-
shell_prefs_set_apps_menu_highlight_color(s_color_definitions[selection].value);
137+
else{
138+
shell_prefs_set_apps_menu_highlight_color(s_color_definitions[selection].value);
139+
}
140140
app_window_stack_remove(&option_menu->window, true /* animated */);
141141
}
142142

@@ -149,10 +149,10 @@ static void prv_option_apps_menu_selection_will_change(OptionMenu *option_menu,
149149
}
150150
GColor color = s_color_definitions[new_row].value;
151151
if (color.argb != GColorClear.argb) {
152-
option_menu_set_highlight_colors(option_menu, color, GColorWhite);
152+
option_menu_set_highlight_colors(option_menu, color, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
153153
}
154154
else {
155-
option_menu_set_highlight_colors(option_menu, DEFAULT_APPS_HIGHLIGHT_COLOR, GColorWhite);
155+
option_menu_set_highlight_colors(option_menu, DEFAULT_APPS_HIGHLIGHT_COLOR, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
156156
}
157157
}
158158

@@ -174,10 +174,10 @@ static void prv_push_apps_color_menu(SettingsThemesData *data) {
174174
if (option_menu) {
175175
const bool animated = true;
176176
if (selected == 0) {
177-
option_menu_set_highlight_colors(option_menu, DEFAULT_APPS_HIGHLIGHT_COLOR, GColorWhite);
177+
option_menu_set_highlight_colors(option_menu, DEFAULT_APPS_HIGHLIGHT_COLOR, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
178178
}
179179
else {
180-
option_menu_set_highlight_colors(option_menu, s_color_definitions[selected].value, GColorWhite);
180+
option_menu_set_highlight_colors(option_menu, s_color_definitions[selected].value, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
181181
}
182182
app_window_stack_push(&option_menu->window, animated);
183183
}
@@ -192,16 +192,16 @@ static void prv_apps_color_menu_select_short(OptionMenu *option_menu, int select
192192
if (selection == 0){
193193
/* Default option selected -> restore default color. */
194194
shell_prefs_set_apps_menu_highlight_color(DEFAULT_APPS_HIGHLIGHT_COLOR);
195-
app_window_stack_remove(&option_menu->window, true /* animated */);
196-
return;
197195
}
198196
else if (selection == ARRAY_LENGTH(s_color_definitions_short) - 1) {
199197
/* "Show All..." -> open full color menu. */
200198
prv_push_apps_color_menu((SettingsThemesData *)context);
201199
return;
202200
}
203-
/* Map through to the full handler for regular short-list entries. */
204-
prv_apps_color_menu_select(option_menu, selection, context);
201+
else{
202+
shell_prefs_set_apps_menu_highlight_color(s_color_definitions[selection].value);
203+
}
204+
app_window_stack_remove(&option_menu->window, true /* animated */);
205205
}
206206

207207
static void prv_option_apps_menu_selection_will_change_short(OptionMenu *option_menu,
@@ -212,15 +212,15 @@ static void prv_option_apps_menu_selection_will_change_short(OptionMenu *option_
212212
return;
213213
}
214214
GColor color = s_color_definitions_short[new_row].value;
215-
if (color.argb != GColorClear.argb) {
216-
option_menu_set_highlight_colors(option_menu, color, GColorWhite);
217-
}
218-
else if (new_row == ARRAY_LENGTH(s_color_definitions_short) - 1) {
215+
if (new_row >= ARRAY_LENGTH(s_color_definitions_short) - 1) {
219216
/* "Show All..." selected -> preview current saved color. */
220-
option_menu_set_highlight_colors(option_menu, shell_prefs_get_apps_menu_highlight_color(), GColorWhite);
217+
option_menu_set_highlight_colors(option_menu, shell_prefs_get_apps_menu_highlight_color(), PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
218+
}
219+
else if (color.argb != GColorClear.argb) {
220+
option_menu_set_highlight_colors(option_menu, color, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
221221
}
222222
else {
223-
option_menu_set_highlight_colors(option_menu, DEFAULT_APPS_HIGHLIGHT_COLOR, GColorWhite);
223+
option_menu_set_highlight_colors(option_menu, DEFAULT_APPS_HIGHLIGHT_COLOR, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
224224
}
225225
}
226226

@@ -243,14 +243,14 @@ static void prv_push_apps_color_menu_short(SettingsThemesData *data) {
243243
if (option_menu) {
244244
const bool animated = true;
245245
if (selected == 0) {
246-
option_menu_set_highlight_colors(option_menu, DEFAULT_APPS_HIGHLIGHT_COLOR, GColorWhite);
246+
option_menu_set_highlight_colors(option_menu, DEFAULT_APPS_HIGHLIGHT_COLOR, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
247247
}
248248
else if (selected == ARRAY_LENGTH(s_color_definitions_short) - 1) {
249249
// "Show All..." option selected
250-
option_menu_set_highlight_colors(option_menu, shell_prefs_get_apps_menu_highlight_color(), GColorWhite);
250+
option_menu_set_highlight_colors(option_menu, shell_prefs_get_apps_menu_highlight_color(), PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
251251
}
252252
else {
253-
option_menu_set_highlight_colors(option_menu, s_color_definitions_short[selected].value, GColorWhite);
253+
option_menu_set_highlight_colors(option_menu, s_color_definitions_short[selected].value, PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite));
254254
}
255255
app_window_stack_push(&option_menu->window, animated);
256256
}
@@ -264,10 +264,10 @@ static void prv_settings_color_menu_select(OptionMenu *option_menu, int selectio
264264
if (selection == 0){
265265
/* Default option selected -> restore default color. */
266266
shell_prefs_set_settings_menu_highlight_color(DEFAULT_SETTINGS_HIGHLIGHT_COLOR);
267-
app_window_stack_remove(&option_menu->window, true /* animated */);
268-
return;
269267
}
270-
shell_prefs_set_settings_menu_highlight_color(s_color_definitions[selection].value);
268+
else{
269+
shell_prefs_set_settings_menu_highlight_color(s_color_definitions[selection].value);
270+
}
271271
app_window_stack_remove(&option_menu->window, true /* animated */);
272272
}
273273

@@ -304,6 +304,9 @@ static void prv_push_settings_color_menu(SettingsThemesData *data) {
304304

305305
if (option_menu) {
306306
const bool animated = true;
307+
option_menu_set_normal_colors(option_menu,
308+
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite),
309+
PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack));
307310
if (selected == 0) {
308311
option_menu_set_highlight_colors(option_menu, DEFAULT_SETTINGS_HIGHLIGHT_COLOR, GColorWhite);
309312
}
@@ -322,14 +325,14 @@ static void prv_settings_color_menu_select_short(OptionMenu *option_menu, int se
322325
if (selection == 0){
323326
/* Default option selected -> restore default color. */
324327
shell_prefs_set_settings_menu_highlight_color(DEFAULT_SETTINGS_HIGHLIGHT_COLOR);
325-
app_window_stack_remove(&option_menu->window, true /* animated */);
326-
return;
327328
}
328329
else if (selection == ARRAY_LENGTH(s_color_definitions_short) - 1) {
329330
prv_push_settings_color_menu((SettingsThemesData *)context);
330331
return;
331332
}
332-
prv_settings_color_menu_select(option_menu, selection, context);
333+
else{
334+
shell_prefs_set_settings_menu_highlight_color(s_color_definitions[selection].value);
335+
}
333336
}
334337

335338
static void prv_option_settings_menu_selection_will_change_short(OptionMenu *option_menu,
@@ -340,13 +343,13 @@ static void prv_option_settings_menu_selection_will_change_short(OptionMenu *opt
340343
return;
341344
}
342345
GColor color = s_color_definitions[new_row].value;
343-
if (color.argb != GColorClear.argb) {
344-
option_menu_set_highlight_colors(option_menu, color, GColorWhite);
345-
}
346-
else if (new_row == ARRAY_LENGTH(s_color_definitions_short) - 1) {
346+
if (new_row >= ARRAY_LENGTH(s_color_definitions_short) - 1) {
347347
/* "Show All..." selected -> preview saved color. */
348348
option_menu_set_highlight_colors(option_menu, shell_prefs_get_settings_menu_highlight_color(), GColorWhite);
349349
}
350+
else if (color.argb != GColorClear.argb) {
351+
option_menu_set_highlight_colors(option_menu, color, GColorWhite);
352+
}
350353
else {
351354
option_menu_set_highlight_colors(option_menu, DEFAULT_SETTINGS_HIGHLIGHT_COLOR, GColorWhite);
352355
}
@@ -370,6 +373,9 @@ static void prv_push_settings_color_menu_short(SettingsThemesData *data) {
370373

371374
if (option_menu) {
372375
const bool animated = true;
376+
option_menu_set_normal_colors(option_menu,
377+
PBL_IF_COLOR_ELSE(GColorBlack, GColorWhite),
378+
PBL_IF_COLOR_ELSE(GColorWhite, GColorBlack));
373379
if (selected == 0) {
374380
option_menu_set_highlight_colors(option_menu, DEFAULT_SETTINGS_HIGHLIGHT_COLOR, GColorWhite);
375381
}

src/fw/apps/system_apps/settings/settings_themes.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ typedef struct ColorDefinition {
3232
static const ColorDefinition s_color_definitions[65] = {
3333
// Pebble colors taken from gcolor_definitions.h
3434
{"Default", GColorClear},
35-
{"Black", GColorBlack},
3635
{"Blue", GColorBlue},
3736
{"Green", GColorGreen},
3837
{"Cyan", GColorCyan},
@@ -42,6 +41,7 @@ static const ColorDefinition s_color_definitions[65] = {
4241
{"Orange", GColorOrange},
4342
{"Yellow", GColorYellow},
4443
{"Gray", GColorDarkGray},
44+
{"Shocking Pink", GColorShockingPink},
4545

4646
{"Oxford Blue", GColorOxfordBlue},
4747
{"Duke Blue", GColorDukeBlue},
@@ -85,23 +85,22 @@ static const ColorDefinition s_color_definitions[65] = {
8585
{"Inchworm", GColorInchworm},
8686
{"Mint Green", GColorMintGreen},
8787
{"Celeste", GColorCeleste},
88-
{"Folly", GColorFolly},
8988
{"Fashion Magenta", GColorFashionMagenta},
9089
{"Sunset Orange", GColorSunsetOrange},
9190
{"Brilliant Rose", GColorBrilliantRose},
92-
{"Shocking Pink", GColorShockingPink},
9391
{"Chrome Yellow", GColorChromeYellow},
92+
{"Folly", GColorFolly},
9493
{"Rajah", GColorRajah},
9594
{"Melon", GColorMelon},
9695
{"Rich Brilliant Lavender", GColorRichBrilliantLavender},
9796
{"Icterine", GColorIcterine},
9897
{"Pastel Yellow", GColorPastelYellow},
9998
{"White", GColorWhite},
99+
{"Black", GColorBlack},
100100
};
101101

102102
static const ColorDefinition s_color_definitions_short[12] = {
103103
{"Default", GColorClear},
104-
{"Black", GColorBlack},
105104
{"Blue", GColorBlue},
106105
{"Green", GColorGreen},
107106
{"Cyan", GColorCyan},
@@ -111,6 +110,7 @@ static const ColorDefinition s_color_definitions_short[12] = {
111110
{"Orange", GColorOrange},
112111
{"Yellow", GColorYellow},
113112
{"Gray", GColorDarkGray},
113+
{"Shocking Pink", GColorShockingPink},
114114
{"Show All...", GColorClear}, // Placeholder color for "Show All" option
115115
};
116116

0 commit comments

Comments
 (0)