Skip to content

Commit 88a096d

Browse files
Heiko StuebnerHeiko Stuebner
authored andcommitted
navigation: reorganize distance and narrative
When using the navigation on the road (i.e. on a motorcycle) readability becomes key. When only a short glance is possible, icon + distance are the key information, with the narrative being an additional source for when there is a second more time. So it makes sense to keep both icon and distance together so the users eyes don't need to wander across the display. So move the countdown-distance up near the flag and instead of hard-coding coordinates, align it 2px below the icon. Move the narrative text between the distance and progress bar and by making it the last element in the code, we can profit from the alignment information of the other elements and set the height calculated from the position information of distance and progress-bar. By reducing the slightly excessive spaces between elements, the narrative gets to be 97px height and can even hold a 4th line of text.
1 parent 7b20c3f commit 88a096d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/displayapp/screens/Navigation.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,22 +202,14 @@ Navigation::Navigation(Pinetime::Controllers::NavigationService& nav) : navServi
202202
lv_obj_set_style_local_image_recolor(imgFlag, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN);
203203
lv_obj_align(imgFlag, nullptr, LV_ALIGN_IN_TOP_MID, 0, 2);
204204

205-
txtNarrative = lv_label_create(lv_scr_act(), nullptr);
206-
lv_label_set_long_mode(txtNarrative, LV_LABEL_LONG_DOT);
207-
lv_obj_set_width(txtNarrative, LV_HOR_RES);
208-
lv_obj_set_height(txtNarrative, 80);
209-
lv_label_set_text_static(txtNarrative, "Navigation");
210-
lv_label_set_align(txtNarrative, LV_LABEL_ALIGN_CENTER);
211-
lv_obj_align(txtNarrative, nullptr, LV_ALIGN_CENTER, 0, 30);
212-
213205
txtManDist = lv_label_create(lv_scr_act(), nullptr);
214206
lv_label_set_long_mode(txtManDist, LV_LABEL_LONG_BREAK);
215207
lv_obj_set_style_local_text_color(txtManDist, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW);
216208
lv_obj_set_style_local_text_font(txtManDist, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_42);
217209
lv_obj_set_width(txtManDist, LV_HOR_RES);
218210
lv_label_set_text_static(txtManDist, "--M");
219211
lv_label_set_align(txtManDist, LV_LABEL_ALIGN_CENTER);
220-
lv_obj_align(txtManDist, nullptr, LV_ALIGN_CENTER, 0, 90);
212+
lv_obj_align(txtManDist, imgFlag, LV_ALIGN_OUT_BOTTOM_MID, 0, 2);
221213

222214
// Route Progress
223215
barProgress = lv_bar_create(lv_scr_act(), nullptr);
@@ -229,6 +221,16 @@ Navigation::Navigation(Pinetime::Controllers::NavigationService& nav) : navServi
229221
lv_bar_set_range(barProgress, 0, 100);
230222
lv_bar_set_value(barProgress, 0, LV_ANIM_OFF);
231223

224+
txtNarrative = lv_label_create(lv_scr_act(), nullptr);
225+
lv_label_set_long_mode(txtNarrative, LV_LABEL_LONG_DOT);
226+
lv_obj_set_width(txtNarrative, LV_HOR_RES);
227+
lv_label_set_text(txtNarrative, "Navigation");
228+
lv_label_set_align(txtNarrative, LV_LABEL_ALIGN_CENTER);
229+
lv_obj_align(txtNarrative, txtManDist, LV_ALIGN_OUT_BOTTOM_MID, 0, 2);
230+
231+
// Set Narrative-height dynamically by progress-bar-y with 2px distance added
232+
lv_obj_set_height(txtNarrative, lv_obj_get_y(barProgress) - lv_obj_get_y(txtNarrative) - 2);
233+
232234
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
233235
}
234236

0 commit comments

Comments
 (0)