From a0ba80882c55e5bd6e1636916fdbadd1c7c4a069 Mon Sep 17 00:00:00 2001 From: Kieran Cawthray Date: Fri, 5 Aug 2022 00:33:24 +0200 Subject: [PATCH] Initial mockup --- src/displayapp/fonts/fonts.json | 2 +- src/displayapp/screens/Symbols.h | 1 + .../screens/WatchFacePineTimeStyle.cpp | 89 +++++++++++++++---- .../screens/WatchFacePineTimeStyle.h | 9 +- 4 files changed, 81 insertions(+), 20 deletions(-) diff --git a/src/displayapp/fonts/fonts.json b/src/displayapp/fonts/fonts.json index 9f228fb6..c0ea7439 100644 --- a/src/displayapp/fonts/fonts.json +++ b/src/displayapp/fonts/fonts.json @@ -58,7 +58,7 @@ "sources": [ { "file": "material-design-icons/MaterialIcons-Regular.ttf", - "range": "0xf00b, 0xe3aa-0xe3ac, 0xe7f6-0xe7f7, 0xe8b8" + "range": "0xf00b, 0xe3aa-0xe3ac, 0xe7f6-0xe7f7, 0xe8b8, 0xe40a" } ], "bpp": 1, diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h index c6e76e36..b21e9366 100644 --- a/src/displayapp/screens/Symbols.h +++ b/src/displayapp/screens/Symbols.h @@ -49,6 +49,7 @@ namespace Pinetime { static constexpr const char* notificationsOn = "\xEE\x9F\xB7"; static constexpr const char* flashlight = "\xEF\x80\x8B"; + static constexpr const char* paintbrushLg = "\xEE\x90\x8A"; } } } diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.cpp b/src/displayapp/screens/WatchFacePineTimeStyle.cpp index 8689a98c..9658c1d6 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.cpp +++ b/src/displayapp/screens/WatchFacePineTimeStyle.cpp @@ -191,6 +191,18 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, lv_obj_set_style_local_line_width(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_pad_inner(stepGauge, LV_GAUGE_PART_NEEDLE, LV_STATE_DEFAULT, 4); + stepValue = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(stepValue, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_label_set_text_static(stepValue, "0"); + lv_obj_align(stepValue, sidebar, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + lv_obj_set_hidden(stepValue, true); + + stepIcon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_color(stepIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_label_set_text_static(stepIcon, Symbols::shoe); + lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_TOP_MID, 0, 0); + lv_obj_set_hidden(stepIcon, true); + btnNextTime = lv_btn_create(lv_scr_act(), nullptr); btnNextTime->user_data = this; lv_obj_set_size(btnNextTime, 60, 60); @@ -272,18 +284,38 @@ WatchFacePineTimeStyle::WatchFacePineTimeStyle(DisplayApp* app, lv_obj_set_event_cb(btnClose, event_handler); lv_obj_set_hidden(btnClose, true); - btnSet = lv_btn_create(lv_scr_act(), nullptr); - btnSet->user_data = this; - lv_obj_set_height(btnSet, 150); - lv_obj_set_width(btnSet, 150); - lv_obj_align(btnSet, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); - lv_obj_set_style_local_radius(btnSet, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 30); - lv_obj_set_style_local_bg_opa(btnSet, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); - lv_obj_set_event_cb(btnSet, event_handler); - lbl_btnSet = lv_label_create(btnSet, nullptr); - lv_obj_set_style_local_text_font(lbl_btnSet, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); - lv_label_set_text_static(lbl_btnSet, Symbols::settings); - lv_obj_set_hidden(btnSet, true); + btnSteps = lv_btn_create(lv_scr_act(), nullptr); + btnSteps->user_data = this; + lv_obj_set_size(btnSteps, 120, 60); + lv_obj_align(btnSteps, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); + lv_obj_set_style_local_bg_opa(btnSteps, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_style_local_value_str(btnSteps, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, "Toggle"); + lv_obj_set_event_cb(btnSteps, event_handler); + lv_obj_set_hidden(btnSteps, true); + + btnSetColor = lv_btn_create(lv_scr_act(), nullptr); + btnSetColor->user_data = this; + lv_obj_set_size(btnSetColor, 150, 60); + lv_obj_align(btnSetColor, lv_scr_act(), LV_ALIGN_CENTER, 0, -40); + lv_obj_set_style_local_radius(btnSetColor, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20); + lv_obj_set_style_local_bg_opa(btnSetColor, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_event_cb(btnSetColor, event_handler); + lbl_btnSetColor = lv_label_create(btnSetColor, nullptr); + lv_obj_set_style_local_text_font(lbl_btnSetColor, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_label_set_text_static(lbl_btnSetColor, Symbols::paintbrushLg); + lv_obj_set_hidden(btnSetColor, true); + + btnSetOpts = lv_btn_create(lv_scr_act(), nullptr); + btnSetOpts->user_data = this; + lv_obj_set_size(btnSetOpts, 150, 60); + lv_obj_align(btnSetOpts, lv_scr_act(), LV_ALIGN_CENTER, 0, 40); + lv_obj_set_style_local_radius(btnSetOpts, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20); + lv_obj_set_style_local_bg_opa(btnSetOpts, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_50); + lv_obj_set_event_cb(btnSetOpts, event_handler); + lbl_btnSetOpts = lv_label_create(btnSetOpts, nullptr); + lv_obj_set_style_local_text_font(lbl_btnSetOpts, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_label_set_text_static(lbl_btnSetOpts, Symbols::settings); + lv_obj_set_hidden(btnSetOpts, true); taskRefresh = lv_task_create(RefreshTaskCallback, LV_DISP_DEF_REFR_PERIOD, LV_TASK_PRIO_MID, this); Refresh(); @@ -296,7 +328,8 @@ WatchFacePineTimeStyle::~WatchFacePineTimeStyle() { bool WatchFacePineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) { if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnRandom)) { - lv_obj_set_hidden(btnSet, false); + lv_obj_set_hidden(btnSetColor, false); + lv_obj_set_hidden(btnSetOpts, false); savedTick = lv_tick_get(); return true; } @@ -317,6 +350,7 @@ void WatchFacePineTimeStyle::CloseMenu() { lv_obj_set_hidden(btnReset, true); lv_obj_set_hidden(btnRandom, true); lv_obj_set_hidden(btnClose, true); + lv_obj_set_hidden(btnSteps, true); } bool WatchFacePineTimeStyle::OnButtonPushed() { @@ -433,14 +467,17 @@ void WatchFacePineTimeStyle::Refresh() { if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { lv_gauge_set_value(stepGauge, 0, (stepCount.Get() / (settingsController.GetStepsGoal() / 100)) % 100); lv_obj_realign(stepGauge); + lv_label_set_text_fmt(stepValue, "%luK", (stepCount.Get() / 1000)); + lv_obj_realign(stepValue); if (stepCount.Get() > settingsController.GetStepsGoal()) { lv_obj_set_style_local_line_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); lv_obj_set_style_local_scale_grad_color(stepGauge, LV_GAUGE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); } } - if (!lv_obj_get_hidden(btnSet)) { + if (!lv_obj_get_hidden(btnSetColor)) { if ((savedTick > 0) && (lv_tick_get() - savedTick > 3000)) { - lv_obj_set_hidden(btnSet, true); + lv_obj_set_hidden(btnSetColor, true); + lv_obj_set_hidden(btnSetOpts, true); savedTick = 0; } } @@ -552,8 +589,20 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) if (object == btnClose) { CloseMenu(); } - if (object == btnSet) { - lv_obj_set_hidden(btnSet, true); + 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); + } else { + lv_obj_set_hidden(stepGauge, false); + lv_obj_set_hidden(stepValue, true); + lv_obj_set_hidden(stepIcon, true); + } + } + if (object == btnSetColor) { + lv_obj_set_hidden(btnSetColor, true); + lv_obj_set_hidden(btnSetOpts, true); lv_obj_set_hidden(btnNextTime, false); lv_obj_set_hidden(btnPrevTime, false); lv_obj_set_hidden(btnNextBar, false); @@ -564,6 +613,12 @@ void WatchFacePineTimeStyle::UpdateSelected(lv_obj_t* object, lv_event_t event) lv_obj_set_hidden(btnRandom, false); lv_obj_set_hidden(btnClose, false); } + if (object == btnSetOpts) { + lv_obj_set_hidden(btnSetColor, true); + lv_obj_set_hidden(btnSetOpts, true); + lv_obj_set_hidden(btnSteps, false); + lv_obj_set_hidden(btnClose, false); + } } } diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.h b/src/displayapp/screens/WatchFacePineTimeStyle.h index 6f44f943..e769bfff 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.h +++ b/src/displayapp/screens/WatchFacePineTimeStyle.h @@ -71,6 +71,7 @@ namespace Pinetime { lv_obj_t* btnReset; lv_obj_t* btnRandom; lv_obj_t* btnClose; + lv_obj_t* btnSteps; lv_obj_t* timebar; lv_obj_t* sidebar; lv_obj_t* timeDD1; @@ -89,8 +90,12 @@ namespace Pinetime { lv_obj_t* calendarCrossBar2; lv_obj_t* notificationIcon; lv_obj_t* stepGauge; - lv_obj_t* btnSet; - lv_obj_t* lbl_btnSet; + lv_obj_t* btnSetColor; + lv_obj_t* btnSetOpts; + lv_obj_t* lbl_btnSetColor; + lv_obj_t* lbl_btnSetOpts; + lv_obj_t* stepIcon; + lv_obj_t* stepValue; lv_color_t needle_colors[1]; BatteryIcon batteryIcon;