Skip to content

Commit abe1dc3

Browse files
gmarullclaude
andcommitted
fw/apps: honor preferred content size in remaining system menus
The notifications app list, its empty state, the alarms "limit reached" cell and the Bluetooth pairing hint still drew with the platform default fonts and cell heights, so they stayed the same size when the user changed Text Size while every other menu around them followed it. Switch them to the preferred content size. The notifications list picks its cell height from the same per-size table it already had, so ExtraLarge gets the basic menu cell height like Large does. On round displays the focused notification cell grows from 84 to 100 px at ExtraLarge, since the icon, title and subtitle stack no longer fits the fixed tall cell with the larger fonts; the unfocused rows shrink accordingly so two still fit on each side. The Bluetooth pairing hint is drawn below the first cell outside its bounds with a fixed 83 px box, which no longer fits the larger fonts; size the box to the remaining display height instead and let the trailing ellipsis handle overflow. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
1 parent 9c2f4e3 commit abe1dc3

3 files changed

Lines changed: 18 additions & 17 deletions

File tree

src/fw/apps/system/alarms/alarms.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static void prv_alarm_list_draw_row_callback(GContext *ctx, const Layer *cell_la
222222
if (menu_cell_layer_is_highlighted(cell_layer)) {
223223
if (data->show_limit_reached_text) {
224224
// Trying to add a new alarm when list is already full
225-
const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellSubtitle);
225+
const GFont font = system_theme_get_font(TextStyleFont_MenuCellSubtitle);
226226

227227
box = GRect(0, 0, cell_layer->bounds.size.w, fonts_get_font_height(font));
228228

src/fw/apps/system/notifications.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ static void prv_draw_notification_cell_rect(GContext *ctx, const Layer *cell_lay
351351
mutable_cell_layer->bounds =
352352
grect_inset(cell_layer_bounds, GEdgeInsets(0, 5, 0, text_left_margin));
353353

354-
const GFont title_font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle);
355-
const GFont subtitle_font = system_theme_get_font_for_default_size(TextStyleFont_Caption);
354+
const GFont title_font = system_theme_get_font(TextStyleFont_MenuCellTitle);
355+
const GFont subtitle_font = system_theme_get_font(TextStyleFont_Caption);
356356
menu_cell_basic_draw_custom(ctx, cell_layer, title_font, title, NULL /* value_font */,
357357
NULL /* value */, subtitle_font, subtitle, NULL /* icon */,
358358
false /* icon_on_right */, GTextOverflowModeTrailingEllipsis);
@@ -426,9 +426,8 @@ static void prv_draw_notification_cell_round_selected(GContext *ctx, const Layer
426426
frame.origin.y += inset;
427427
frame.size.h -= inset * 2;
428428
frame.size.w -= inset * 2;
429-
const GFont title_font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle);
430-
const GFont subtitle_font =
431-
system_theme_get_font_for_default_size(TextStyleFont_MenuCellSubtitle);
429+
const GFont title_font = system_theme_get_font(TextStyleFont_MenuCellTitle);
430+
const GFont subtitle_font = system_theme_get_font(TextStyleFont_MenuCellSubtitle);
432431
prv_draw_notification_cell_round(ctx, cell_layer, &frame, title_font, title, subtitle_font,
433432
subtitle, icon);
434433
}
@@ -448,7 +447,7 @@ static void prv_draw_notification_cell_round_unselected(GContext *ctx, const Lay
448447
// Using TextStyleFont_Header here is a little bit of a hack to achieve Gothic 18 Bold on
449448
// Spalding's default content size (medium) while still being a little robust for any future round
450449
// watches that have a default content size larger than medium
451-
const GFont font = system_theme_get_font_for_default_size(TextStyleFont_Header);
450+
const GFont font = system_theme_get_font(TextStyleFont_Header);
452451
prv_draw_notification_cell_round(ctx, cell_layer, &frame, font, title, NULL, NULL, NULL);
453452
}
454453
#endif
@@ -499,25 +498,26 @@ static int16_t prv_get_cell_height(struct MenuLayer *menu_layer, MenuIndex *cell
499498
#if PBL_ROUND
500499
MenuIndex selected_index = menu_layer_get_selected_index(menu_layer);
501500
bool is_selected = menu_index_compare(cell_index, &selected_index) == 0;
501+
const int16_t focused_cell_height =
502+
(system_theme_get_content_size() == PreferredContentSizeExtraLarge)
503+
? 100
504+
: MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT;
502505
if (is_selected) {
503-
return MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT;
506+
return focused_cell_height;
504507
}
505508
#if PBL_DISPLAY_HEIGHT >= 200
506509
// Larger round displays fit two unfocused rows on each side of the focused row
507-
return ((DISP_ROWS - STATUS_BAR_LAYER_HEIGHT * 2) - MENU_CELL_ROUND_FOCUSED_TALL_CELL_HEIGHT) / 4;
510+
return ((DISP_ROWS - STATUS_BAR_LAYER_HEIGHT * 2) - focused_cell_height) / 4;
508511
#endif
509512
#endif
510-
const PreferredContentSize runtime_platform_content_size =
511-
system_theme_get_default_content_size_for_runtime_platform();
512513
return ((int16_t[NumPreferredContentSizes]){
513514
//! @note this is the same as Medium until Small is designed
514515
[PreferredContentSizeSmall] = PBL_IF_RECT_ELSE(46, MENU_CELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT),
515516
[PreferredContentSizeMedium] =
516517
PBL_IF_RECT_ELSE(46, MENU_CELL_ROUND_UNFOCUSED_SHORT_CELL_HEIGHT),
517518
[PreferredContentSizeLarge] = menu_cell_basic_cell_height(),
518-
//! @note this is the same as Large until ExtraLarge is designed
519519
[PreferredContentSizeExtraLarge] = menu_cell_basic_cell_height(),
520-
})[runtime_platform_content_size];
520+
})[system_theme_get_content_size()];
521521
}
522522

523523
static void prv_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index,
@@ -540,7 +540,7 @@ static void prv_draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIn
540540
#if PBL_ROUND
541541
draw_cell(ctx, cell_layer, i18n_get("Clear All", data), NULL, NULL);
542542
#else
543-
const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle);
543+
const GFont font = system_theme_get_font(TextStyleFont_MenuCellTitle);
544544
GRect box = cell_layer->bounds;
545545
box.origin.y +=
546546
(box.size.h - fonts_get_font_height(font)) / 2 - fonts_get_font_cap_offset(font);
@@ -717,7 +717,7 @@ static void prv_window_load(Window *window) {
717717

718718
TextLayer *text_layer = &data->text_layer;
719719
const int16_t horizontal_margin = 5;
720-
const GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle);
720+
const GFont font = system_theme_get_font(TextStyleFont_MenuCellTitle);
721721
// configure text layer to be vertically aligned (15 is hacking around our poor fonts)
722722
text_layer_init_with_parameters(
723723
text_layer,

src/fw/apps/system/settings/bluetooth.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,13 +423,13 @@ static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx, const Lay
423423
ctx->draw_state.clip_box = ctx->dest_bitmap.bounds;
424424

425425
graphics_context_set_text_color(ctx, GColorBlack);
426-
GFont font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellSubtitle);
426+
GFont font = system_theme_get_font(TextStyleFont_MenuCellSubtitle);
427427
const int16_t horizontal_inset = menu_cell_basic_horizontal_inset() * 3;
428428
GRect box = cell_layer->bounds;
429429
box.origin.x = horizontal_inset;
430430
box.origin.y = menu_cell_basic_cell_height() + (int16_t)9;
431431
box.size.w -= horizontal_inset * 2;
432-
box.size.h = 83;
432+
box.size.h = DISP_ROWS - STATUS_BAR_LAYER_HEIGHT - box.origin.y;
433433

434434
if (!data->remote_list_head) {
435435
if (bt_ctl_is_airplane_mode_on()) {
@@ -445,6 +445,7 @@ static void prv_draw_row_cb(SettingsCallbacks *context, GContext *ctx, const Lay
445445
// Position the message lower to appear below the paired phone row
446446
GRect msg_box = box;
447447
msg_box.origin.y += menu_cell_basic_cell_height() - 10;
448+
msg_box.size.h -= menu_cell_basic_cell_height() - 10;
448449
graphics_draw_text(ctx, i18n_get("Forget this device to pair a new device.", data), font,
449450
msg_box, GTextOverflowModeTrailingEllipsis, GTextAlignmentCenter, NULL);
450451
}

0 commit comments

Comments
 (0)