Add half gauge/seconds option
This commit is contained in:
commit
593ca2028d
2 changed files with 38 additions and 7 deletions
|
@ -203,6 +203,13 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app,
|
|||
lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_TOP_MID, 0, 0);
|
||||
lv_obj_set_hidden(stepIcon, true);
|
||||
|
||||
// Display seconds
|
||||
timeDD3 = lv_label_create(lv_scr_act(), nullptr);
|
||||
lv_obj_set_style_local_text_color(timeDD3, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
lv_label_set_text_static(timeDD3, ":00");
|
||||
lv_obj_align(timeDD3, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||
lv_obj_set_hidden(timeDD3, true);
|
||||
|
||||
btnNextTime = lv_btn_create(lv_scr_act(), nullptr);
|
||||
btnNextTime->user_data = this;
|
||||
lv_obj_set_size(btnNextTime, 60, 60);
|
||||
|
@ -424,6 +431,7 @@ void WatchFacePineTimeStyle::Refresh() {
|
|||
|
||||
uint8_t hour = time.hours().count();
|
||||
uint8_t minute = time.minutes().count();
|
||||
uint8_t second = time.seconds().count();
|
||||
|
||||
if (displayedHour != hour || displayedMinute != minute) {
|
||||
displayedHour = hour;
|
||||
|
@ -449,6 +457,11 @@ void WatchFacePineTimeStyle::Refresh() {
|
|||
}
|
||||
}
|
||||
|
||||
if (displayedSecond != second) {
|
||||
displayedSecond = second;
|
||||
lv_label_set_text_fmt(timeDD3, ":%02d", second);
|
||||
}
|
||||
|
||||
if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) {
|
||||
lv_label_set_text_static(dateDayOfWeek, dateTimeController.DayOfWeekShortToString());
|
||||
lv_label_set_text_fmt(dateDay, "%d", day);
|
||||
|
@ -590,14 +603,30 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event)
|
|||
CloseMenu();
|
||||
}
|
||||
if (object == btnSteps) {
|
||||
if (!lv_obj_get_hidden(stepGauge)) {
|
||||
lv_obj_set_hidden(stepGauge, true);
|
||||
lv_obj_set_hidden(stepValue, false);
|
||||
lv_obj_set_hidden(stepIcon, false);
|
||||
if (!lv_obj_get_hidden(stepGauge) && (lv_obj_get_hidden(timeDD3))) {
|
||||
// show half gauge & seconds
|
||||
lv_obj_set_hidden(timeDD3, false);
|
||||
lv_obj_set_size(stepGauge, 37, 37);
|
||||
lv_obj_align(stepGauge, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, -10);
|
||||
lv_gauge_set_scale(stepGauge, 180, 5, 0);
|
||||
lv_gauge_set_angle_offset(stepGauge, 0);
|
||||
lv_gauge_set_critical_value(stepGauge, 120);
|
||||
} else if (!lv_obj_get_hidden(timeDD3) && (lv_obj_get_hidden(stepValue))) {
|
||||
// show step count & icon
|
||||
lv_obj_set_hidden(timeDD3, true);
|
||||
lv_obj_set_hidden(stepGauge, true);
|
||||
lv_obj_set_hidden(stepValue, false);
|
||||
lv_obj_set_hidden(stepIcon, false);
|
||||
} else {
|
||||
lv_obj_set_hidden(stepGauge, false);
|
||||
lv_obj_set_hidden(stepValue, true);
|
||||
lv_obj_set_hidden(stepIcon, true);
|
||||
// show full gauge
|
||||
lv_obj_set_hidden(stepGauge, false);
|
||||
lv_obj_set_hidden(stepValue, true);
|
||||
lv_obj_set_hidden(stepIcon, true);
|
||||
lv_obj_set_size(stepGauge, 40, 40);
|
||||
lv_obj_align(stepGauge, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
|
||||
lv_gauge_set_scale(stepGauge, 360, 11, 0);
|
||||
lv_gauge_set_angle_offset(stepGauge, 180);
|
||||
lv_gauge_set_critical_value(stepGauge, 100);
|
||||
}
|
||||
}
|
||||
if (object == btnSetColor) {
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace Pinetime {
|
|||
private:
|
||||
uint8_t displayedHour = -1;
|
||||
uint8_t displayedMinute = -1;
|
||||
uint8_t displayedSecond = -1;
|
||||
|
||||
uint16_t currentYear = 1970;
|
||||
Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown;
|
||||
|
@ -76,6 +77,7 @@ namespace Pinetime {
|
|||
lv_obj_t* sidebar;
|
||||
lv_obj_t* timeDD1;
|
||||
lv_obj_t* timeDD2;
|
||||
lv_obj_t* timeDD3;
|
||||
lv_obj_t* timeAMPM;
|
||||
lv_obj_t* dateDayOfWeek;
|
||||
lv_obj_t* dateDay;
|
||||
|
|
Loading…
Reference in a new issue