Skip to content

Commit 8e139ac

Browse files
JustScottBurninTurtles
authored andcommitted
Improved the Terminal Watchfaces UI
+ Reorder code to match the widgets order in the UI. + Use InfintimeTheme Colors instead of hardcoded hex values + Added a new InfinitimeTheme color: gray, using it to turn certain values gray when they contain no data + Implement @vkareh's [variable battery icon](InfiniTimeOrg#1964) color to the battery percentage text. + Replaced the 'You have mail.' notification message with the message '[1]+ Notify' to better fit the terminal lore.
1 parent 6459af1 commit 8e139ac

File tree

2 files changed

+47
-44
lines changed

2 files changed

+47
-44
lines changed

src/displayapp/screens/WatchFaceTerminal.cpp

+45-42
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "components/ble/SimpleWeatherService.h"
1212
#include "displayapp/screens/WeatherSymbols.h"
1313
#include "displayapp/InfiniTimeTheme.h"
14+
#include "displayapp/InfiniTimeTheme.h"
1415

1516
using namespace Pinetime::Applications::Screens;
1617

@@ -38,37 +39,45 @@ WatchFaceTerminal::WatchFaceTerminal(Controllers::DateTime& dateTimeController,
3839
connectState = lv_label_create(lv_scr_act(), nullptr);
3940
lv_label_set_recolor(connectState, true);
4041
lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
42+
motionController {motionController} {
4143

4244
notificationIcon = lv_label_create(lv_scr_act(), nullptr);
43-
lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_LEFT_MID, 0, -100);
44-
45-
label_date = lv_label_create(lv_scr_act(), nullptr);
46-
lv_label_set_recolor(label_date, true);
47-
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -40);
45+
lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_LEFT_MID, 0, -90);
4846

4947
label_prompt_1 = lv_label_create(lv_scr_act(), nullptr);
50-
lv_obj_align(label_prompt_1, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -80);
48+
lv_obj_set_style_local_text_color(label_prompt_1, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray);
49+
lv_obj_align(label_prompt_1, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -70);
5150
lv_label_set_text_static(label_prompt_1, "user@watch:~ $ now");
5251

53-
label_prompt_2 = lv_label_create(lv_scr_act(), nullptr);
54-
lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 80);
55-
lv_label_set_text_static(label_prompt_2, "user@watch:~ $");
56-
5752
label_time = lv_label_create(lv_scr_act(), nullptr);
5853
lv_label_set_recolor(label_time, true);
59-
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -60);
54+
lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -50);
6055

61-
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
62-
lv_label_set_recolor(heartbeatValue, true);
63-
lv_obj_align(heartbeatValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 20);
56+
label_date = lv_label_create(lv_scr_act(), nullptr);
57+
lv_label_set_recolor(label_date, true);
58+
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -30);
59+
60+
batteryValue = lv_label_create(lv_scr_act(), nullptr);
61+
lv_label_set_recolor(batteryValue, true);
62+
lv_obj_align(batteryValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -10);
6463

6564
stepValue = lv_label_create(lv_scr_act(), nullptr);
6665
lv_label_set_recolor(stepValue, true);
67-
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0);
66+
lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::orange);
67+
lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 10);
6868

69-
weather = lv_label_create(lv_scr_act(), nullptr);
70-
lv_label_set_recolor(weather, true);
71-
lv_obj_align(weather, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 40);
69+
heartbeatValue = lv_label_create(lv_scr_act(), nullptr);
70+
lv_label_set_recolor(heartbeatValue, true);
71+
lv_obj_align(heartbeatValue, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 30);
72+
73+
connectState = lv_label_create(lv_scr_act(), nullptr);
74+
lv_label_set_recolor(connectState, true);
75+
lv_obj_align(connectState, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 50);
76+
77+
label_prompt_2 = lv_label_create(lv_scr_act(), nullptr);
78+
lv_obj_set_style_local_text_color(label_prompt_2, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::lightGray);
79+
lv_obj_align(label_prompt_2, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 70);
80+
lv_label_set_text_static(label_prompt_2, "user@watch:~ $");
7281

7382
taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this);
7483
Refresh();
@@ -143,35 +152,29 @@ void WatchFaceTerminal::Refresh() {
143152
heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped;
144153
if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) {
145154
if (heartbeatRunning.Get()) {
146-
lv_label_set_text_fmt(heartbeatValue, "[L_HR]#ee3311 %d bpm#", heartbeat.Get());
155+
156+
lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::deepOrange);
157+
lv_label_set_text_fmt(heartbeatValue, "#ffffff [L_HR]# %d bpm", heartbeat.Get());
147158
} else {
148-
lv_label_set_text_static(heartbeatValue, "[L_HR]#ee3311 ---#");
159+
lv_label_set_text_static(heartbeatValue, "#ffffff [L_HR]# ---");
160+
lv_obj_set_style_local_text_color(heartbeatValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::gray);
149161
}
150162
}
151163

152-
stepCount = motionController.NbSteps();
153-
if (stepCount.IsUpdated()) {
154-
lv_label_set_text_fmt(stepValue, "[STEP]#ee3377 %lu steps#", stepCount.Get());
155-
}
156-
157-
currentWeather = weatherService.Current();
158-
if (currentWeather.IsUpdated()) {
159-
auto optCurrentWeather = currentWeather.Get();
160-
if (optCurrentWeather) {
161-
int16_t temp = optCurrentWeather->temperature.Celsius();
162-
char tempUnit = 'C';
163-
if (settingsController.GetWeatherFormat() == Controllers::Settings::WeatherFormat::Imperial) {
164-
temp = optCurrentWeather->temperature.Fahrenheit();
165-
tempUnit = 'F';
166-
}
167-
lv_label_set_text_fmt(weather,
168-
"[WTHR]#ffdd00 %d°%c %s#",
169-
temp,
170-
tempUnit,
171-
// Change to GetSimpleCondition with pull request #2134 (Add shorter/simpler weather condition options)
172-
Symbols::GetCondition(optCurrentWeather->iconId));
164+
bleState = bleController.IsConnected();
165+
bleRadioEnabled = bleController.IsRadioEnabled();
166+
if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
167+
if (!bleRadioEnabled.Get()) {
168+
lv_label_set_text_static(connectState, "#ffffff [STAT]# Disabled");
169+
lv_obj_set_style_local_text_color(connectState, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::gray);
173170
} else {
174-
lv_label_set_text(weather, "[WTHR]#ffdd00 ---");
171+
if (bleState.Get()) {
172+
lv_label_set_text_static(connectState, "#ffffff [STAT]# Connected");
173+
lv_obj_set_style_local_text_color(connectState, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::blue);
174+
} else {
175+
lv_label_set_text_static(connectState, "#ffffff [STAT]# Disconnected");
176+
lv_obj_set_style_local_text_color(connectState, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, Colors::gray);
177+
}
175178
}
176179
}
177180
}

src/displayapp/screens/WatchFaceTerminal.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ namespace Pinetime {
5050
Utility::DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::days>> currentDate;
5151
Utility::DirtyValue<std::optional<Controllers::SimpleWeatherService::CurrentWeather>> currentWeather {};
5252

53-
lv_obj_t* container;
5453
lv_obj_t* notificationIcon;
5554
lv_obj_t* label_prompt_1;
5655
lv_obj_t* label_time;
5756
lv_obj_t* label_date;
5857
lv_obj_t* batteryValue;
5958
lv_obj_t* stepValue;
59+
lv_obj_t* stepValue;
6060
lv_obj_t* heartbeatValue;
6161
lv_obj_t* connectState;
62-
lv_obj_t* weather;
62+
lv_obj_t* label_prompt_2;
6363

6464
Controllers::DateTime& dateTimeController;
6565
const Controllers::Battery& batteryController;

0 commit comments

Comments
 (0)