Skip to content

Commit 75733b1

Browse files
Apurv Pataniclaude
authored andcommitted
fw/timeline: fix the all-day pin's vertical offset on Pebble Time 2
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Apurv Patani <pataniapurv@gmail.com>
1 parent 36492c9 commit 75733b1

9 files changed

Lines changed: 39 additions & 2 deletions

src/fw/services/timeline/timeline_layout.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,15 @@ static GTextNode *prv_create_all_day_text_node(const TimelineLayout *layout) {
387387
.text.style_font = TextStyleFont_Title,
388388
.text.fixed_lines = 1,
389389
.text.alignment = PBL_IF_RECT_ELSE(LayoutTextAlignment_Left, LayoutTextAlignment_Right),
390-
.text.extent.offset.y = -13,
390+
// The font leaves blank space above the text; this pulls the header back up. Large rect
391+
// displays need less of a pull than the others.
392+
.text.extent.offset.y = PREFERRED_CONTENT_SIZE_SWITCH(PreferredContentSizeDefault,
393+
/* This is the same as Medium until Small is designed */
394+
/* small */ -13,
395+
/* medium */ -13,
396+
/* large */ PBL_IF_RECT_ELSE(-8, -13),
397+
/* This is the same as Large until ExtraLarge is designed */
398+
/* extralarge */ PBL_IF_RECT_ELSE(-8, -13)),
391399
.text.extent.margin.h = -7,
392400
};
393401
GTextNodeText *text_node =

tests/fw/apps/system_apps/timeline/test_timeline_list_view.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ typedef struct TimelineItemConfig {
3737
const char *title;
3838
const char *subtitle;
3939
TimelineResourceId icon;
40+
bool all_day;
4041
} TimelineItemConfig;
4142

4243
typedef struct ListViewConfig {
@@ -63,6 +64,7 @@ static void prv_add_timeline_item(const TimelineItemConfig *config, bool past) {
6364
&list, NULL);
6465
attribute_list_destroy_list(&list);
6566
PBL_ASSERTN(item);
67+
item->header.all_day = config->all_day;
6668
}
6769
if (item) {
6870
pin_db_insert_item(item);
@@ -252,3 +254,30 @@ void test_timeline_list_view__pin_and_fin_past(void) {
252254
FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE();
253255
}
254256

257+
258+
void prv_create_and_render_all_day(bool past) {
259+
prv_create_list_view_and_render(&(ListViewConfig) {
260+
.pins = {
261+
&(TimelineItemConfig) {
262+
// Must sit further back than the duration, or the past view correctly excludes it
263+
// for still being in progress.
264+
.relative_timestamp = 2 * SECONDS_PER_DAY,
265+
.title = "Independence Day",
266+
.duration = MINUTES_PER_DAY,
267+
.icon = TIMELINE_RESOURCE_TIMELINE_CALENDAR,
268+
.all_day = true,
269+
}
270+
},
271+
.past = past,
272+
});
273+
}
274+
275+
void test_timeline_list_view__all_day_future(void) {
276+
prv_create_and_render_all_day(false /* past */);
277+
FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE();
278+
}
279+
280+
void test_timeline_list_view__all_day_past(void) {
281+
prv_create_and_render_all_day(true /* past */);
282+
FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE();
283+
}

tests/fw/apps/system_apps/timeline/wscript_build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ clar(ctx,
131131
defines=ctx.env.test_image_defines + ["USE_DISPLAY_PERIMETER_ON_FONT_LAYOUT=1"],
132132
runtime_deps=ctx.env.test_pngs + ctx.env.test_pbis + ctx.env.test_pfos,
133133
override_includes=['dummy_board'],
134-
platforms=['obelix', 'gabbro'])
134+
platforms=['obelix', 'gabbro', 'asterix'])
135135

136136
clar(ctx,
137137
sources_ant_glob=(
709 Bytes
Loading
2.84 KB
Loading
1.8 KB
Loading
709 Bytes
Loading
2.88 KB
Loading
1.8 KB
Loading

0 commit comments

Comments
 (0)