diff options
Diffstat (limited to 'src/DisplayApp/Screens')
-rw-r--r-- | src/DisplayApp/Screens/BatteryIcon.cpp | 69 | ||||
-rw-r--r-- | src/DisplayApp/Screens/BatteryIcon.h | 5 | ||||
-rw-r--r-- | src/DisplayApp/Screens/BleIcon.cpp | 12 | ||||
-rw-r--r-- | src/DisplayApp/Screens/BleIcon.h | 4 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Clock.cpp | 86 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Clock.h | 19 | ||||
-rw-r--r-- | src/DisplayApp/Screens/FirmwareUpdate.h | 5 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Gauge.h | 7 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Message.cpp | 7 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Message.h | 7 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Meter.h | 6 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Modal.h | 6 | ||||
-rw-r--r-- | src/DisplayApp/Screens/ScreenList.cpp | 1 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Symbols.h | 24 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Tab.h | 5 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Tile.cpp | 79 | ||||
-rw-r--r-- | src/DisplayApp/Screens/Tile.h | 5 |
17 files changed, 122 insertions, 225 deletions
diff --git a/src/DisplayApp/Screens/BatteryIcon.cpp b/src/DisplayApp/Screens/BatteryIcon.cpp index e20167d8..26939d18 100644 --- a/src/DisplayApp/Screens/BatteryIcon.cpp +++ b/src/DisplayApp/Screens/BatteryIcon.cpp @@ -1,62 +1,21 @@ #include "BatteryIcon.h" - +#include "Symbols.h" using namespace Pinetime::Applications::Screens; +const char* BatteryIcon::GetBatteryIcon(float batteryPercent) { + if(batteryPercent > 90.0f) return Symbols::batteryFull; + if(batteryPercent > 75.0f) return Symbols::batteryThreeQuarter; + if(batteryPercent > 50.0f) return Symbols::batteryHalf; + if(batteryPercent > 25.0f) return Symbols::batteryOneQuarter; + return Symbols::batteryEmpty; +} -extern lv_img_dsc_t ck_os_battery_error; -extern lv_img_dsc_t ck_os_batterycharging_100; -extern lv_img_dsc_t ck_os_batterycharging_090; -extern lv_img_dsc_t ck_os_batterycharging_080; -extern lv_img_dsc_t ck_os_batterycharging_070; -extern lv_img_dsc_t ck_os_batterycharging_060; -extern lv_img_dsc_t ck_os_batterycharging_050; -extern lv_img_dsc_t ck_os_batterycharging_040; -extern lv_img_dsc_t ck_os_batterycharging_030; -extern lv_img_dsc_t ck_os_batterycharging_020; -extern lv_img_dsc_t ck_os_batterycharging_010; -extern lv_img_dsc_t ck_os_batterycharging_005; - -extern lv_img_dsc_t ck_os_battery_100; -extern lv_img_dsc_t ck_os_battery_090; -extern lv_img_dsc_t ck_os_battery_080; -extern lv_img_dsc_t ck_os_battery_070; -extern lv_img_dsc_t ck_os_battery_060; -extern lv_img_dsc_t ck_os_battery_050; -extern lv_img_dsc_t ck_os_battery_040; -extern lv_img_dsc_t ck_os_battery_030; -extern lv_img_dsc_t ck_os_battery_020; -extern lv_img_dsc_t ck_os_battery_010; -extern lv_img_dsc_t ck_os_battery_005; - - -lv_img_dsc_t *BatteryIcon::GetIcon(bool isCharging, float batteryPercent) { - if(isCharging) { - if(batteryPercent > 90.0f) return &ck_os_batterycharging_100; - else if(batteryPercent > 80.0f) return &ck_os_batterycharging_090; - else if(batteryPercent > 70.0f) return &ck_os_batterycharging_080; - else if(batteryPercent > 60.0f) return &ck_os_batterycharging_070; - else if(batteryPercent > 50.0f) return &ck_os_batterycharging_060; - else if(batteryPercent > 40.0f) return &ck_os_batterycharging_050; - else if(batteryPercent > 30.0f) return &ck_os_batterycharging_040; - else if(batteryPercent > 20.0f) return &ck_os_batterycharging_030; - else if(batteryPercent > 10.0f) return &ck_os_batterycharging_020; - else if(batteryPercent > 5.0f) return &ck_os_batterycharging_010; - else return &ck_os_batterycharging_005; - } else { - if(batteryPercent > 90.0f) return &ck_os_battery_100; - else if(batteryPercent > 80.0f) return &ck_os_battery_090; - else if(batteryPercent > 70.0f) return &ck_os_battery_080; - else if(batteryPercent > 60.0f) return &ck_os_battery_070; - else if(batteryPercent > 50.0f) return &ck_os_battery_060; - else if(batteryPercent > 40.0f) return &ck_os_battery_050; - else if(batteryPercent > 30.0f) return &ck_os_battery_040; - else if(batteryPercent > 20.0f) return &ck_os_battery_030; - else if(batteryPercent > 10.0f) return &ck_os_battery_020; - else if(batteryPercent > 5.0f) return &ck_os_battery_010; - else return &ck_os_battery_005; - } +const char* BatteryIcon::GetUnknownIcon() { + return Symbols::batteryEmpty; } -lv_img_dsc_t *BatteryIcon::GetUnknownIcon() { - return &ck_os_battery_error; +const char *BatteryIcon::GetPlugIcon(bool isCharging) { + if(isCharging) + return Symbols::plug; + else return ""; } diff --git a/src/DisplayApp/Screens/BatteryIcon.h b/src/DisplayApp/Screens/BatteryIcon.h index 4e2a3a03..58f04a87 100644 --- a/src/DisplayApp/Screens/BatteryIcon.h +++ b/src/DisplayApp/Screens/BatteryIcon.h @@ -7,8 +7,9 @@ namespace Pinetime { namespace Screens { class BatteryIcon { public: - static lv_img_dsc_t* GetUnknownIcon(); - static lv_img_dsc_t* GetIcon(bool isCharging, float batteryPercent); + static const char* GetUnknownIcon(); + static const char* GetBatteryIcon(float batteryPercent); + static const char* GetPlugIcon(bool isCharging); }; } } diff --git a/src/DisplayApp/Screens/BleIcon.cpp b/src/DisplayApp/Screens/BleIcon.cpp index 28a7727c..1bbbd053 100644 --- a/src/DisplayApp/Screens/BleIcon.cpp +++ b/src/DisplayApp/Screens/BleIcon.cpp @@ -1,12 +1,8 @@ #include "BleIcon.h" - +#include "Symbols.h" using namespace Pinetime::Applications::Screens; - -extern lv_img_dsc_t ck_os_bt_connected; -extern lv_img_dsc_t ck_os_bt_disconnected; - -lv_img_dsc_t *BleIcon::GetIcon(bool isConnected) { - if(isConnected) return &ck_os_bt_connected; - else return &ck_os_bt_disconnected; +const char* BleIcon::GetIcon(bool isConnected) { + if(isConnected) return Symbols::bluetooth; + else return ""; }
\ No newline at end of file diff --git a/src/DisplayApp/Screens/BleIcon.h b/src/DisplayApp/Screens/BleIcon.h index ee090f96..c1398d2a 100644 --- a/src/DisplayApp/Screens/BleIcon.h +++ b/src/DisplayApp/Screens/BleIcon.h @@ -1,13 +1,11 @@ #pragma once -#include <libs/lvgl/src/lv_draw/lv_img_decoder.h> - namespace Pinetime { namespace Applications { namespace Screens { class BleIcon { public: - static lv_img_dsc_t* GetIcon(bool isConnected); + static const char* GetIcon(bool isConnected); }; } } diff --git a/src/DisplayApp/Screens/Clock.cpp b/src/DisplayApp/Screens/Clock.cpp index 07db83ee..fc6441e8 100644 --- a/src/DisplayApp/Screens/Clock.cpp +++ b/src/DisplayApp/Screens/Clock.cpp @@ -1,17 +1,16 @@ #include <cstdio> #include <libs/date/includes/date/date.h> #include <Components/DateTime/DateTimeController.h> -#include <Version.h> #include <libs/lvgl/lvgl.h> #include "Clock.h" #include "../DisplayApp.h" #include "BatteryIcon.h" #include "BleIcon.h" - +#include "Symbols.h" using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; extern lv_font_t jetbrains_mono_bold_20; - +extern lv_style_t* LabelBigStyle; static void event_handler(lv_obj_t * obj, lv_event_t event) { Clock* screen = static_cast<Clock *>(obj->user_data); @@ -21,7 +20,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) { Clock::Clock(DisplayApp* app, Controllers::DateTime& dateTimeController, Controllers::Battery& batteryController, - Controllers::Ble& bleController) : Screen(app), currentDateTime{{}}, version {{}}, + Controllers::Ble& bleController) : Screen(app), currentDateTime{{}}, dateTimeController{dateTimeController}, batteryController{batteryController}, bleController{bleController} { displayedChar[0] = 0; displayedChar[1] = 0; @@ -29,39 +28,56 @@ Clock::Clock(DisplayApp* app, displayedChar[3] = 0; displayedChar[4] = 0; - batteryIcon = lv_img_create(lv_scr_act(), NULL); - lv_img_set_src(batteryIcon, BatteryIcon::GetUnknownIcon()); - lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, 0, 0); + batteryIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(batteryIcon, Symbols::batteryFull); + lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 2); - bleIcon = lv_img_create(lv_scr_act(), NULL); - lv_img_set_src(bleIcon, BleIcon::GetIcon(false)); - lv_obj_align(bleIcon, batteryIcon, LV_ALIGN_OUT_LEFT_MID, 0, 0); + batteryPlug = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(batteryPlug, Symbols::plug); + lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); - label_date = lv_label_create(lv_scr_act(), NULL); - - lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); + bleIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(bleIcon, Symbols::bluetooth); + lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); - labelStyle = const_cast<lv_style_t *>(lv_label_get_style(label_date, LV_LABEL_STYLE_MAIN)); - labelStyle->text.font = &jetbrains_mono_bold_20; - lv_style_copy(&labelBigStyle, labelStyle); - labelBigStyle.text.font = &jetbrains_mono_extrabold_compressed; + label_date = lv_label_create(lv_scr_act(), NULL); - lv_label_set_style(label_date, LV_LABEL_STYLE_MAIN, labelStyle); + lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); label_time = lv_label_create(lv_scr_act(), NULL); - lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, &labelBigStyle); + lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, LabelBigStyle); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); backgroundLabel = lv_label_create(lv_scr_act(), NULL); backgroundLabel->user_data = this; - lv_label_set_style(backgroundLabel, LV_LABEL_STYLE_MAIN, labelStyle); lv_obj_set_click(backgroundLabel, true); lv_obj_set_event_cb(backgroundLabel, event_handler); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text(backgroundLabel, ""); + + + heartbeatIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(heartbeatIcon, Symbols::heartBeat); + lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2); + + heartbeatValue = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(heartbeatValue, "0"); + lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); + + heartbeatBpm = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(heartbeatBpm, "BPM"); + lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0); + + stepValue = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(stepValue, "0"); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2); + + stepIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(stepIcon, Symbols::shoe); + lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); } Clock::~Clock() { @@ -72,17 +88,22 @@ bool Clock::Refresh() { batteryPercentRemaining = batteryController.PercentRemaining(); if (batteryPercentRemaining.IsUpdated()) { auto batteryPercent = batteryPercentRemaining.Get(); - lv_img_set_src(batteryIcon, BatteryIcon::GetIcon(batteryController.IsCharging() || batteryController.IsPowerPresent(), batteryPercent)); + lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); + auto isCharging = batteryController.IsCharging() || batteryController.IsPowerPresent(); + lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging)); } bleState = bleController.IsConnected(); if (bleState.IsUpdated()) { if(bleState.Get() == true) { - lv_img_set_src(bleIcon, BleIcon::GetIcon(true)); + lv_label_set_text(bleIcon, BleIcon::GetIcon(true)); } else { - lv_img_set_src(bleIcon, BleIcon::GetIcon(false)); + lv_label_set_text(bleIcon, BleIcon::GetIcon(false)); } } + lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 5); + lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); + lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); currentDateTime = dateTimeController.CurrentDateTime(); @@ -133,6 +154,25 @@ bool Clock::Refresh() { } } + // TODO heartbeat = heartBeatController.GetValue(); + if(heartbeat.IsUpdated()) { + char heartbeatBuffer[4]; + sprintf(heartbeatBuffer, "%d", heartbeat.Get()); + lv_label_set_text(heartbeatValue, heartbeatBuffer); + lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2); + lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); + lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0); + } + + // TODO stepCount = stepController.GetValue(); + if(stepCount.IsUpdated()) { + char stepBuffer[5]; + sprintf(stepBuffer, "%lu", stepCount.Get()); + lv_label_set_text(stepValue, stepBuffer); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2); + lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); + } + return running; } diff --git a/src/DisplayApp/Screens/Clock.h b/src/DisplayApp/Screens/Clock.h index 7c4a09df..e1e10bdf 100644 --- a/src/DisplayApp/Screens/Clock.h +++ b/src/DisplayApp/Screens/Clock.h @@ -2,16 +2,12 @@ #include <cstdint> #include <chrono> -#include <Components/Gfx/Gfx.h> #include "Screen.h" #include <bits/unique_ptr.h> #include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_obj.h> #include <Components/Battery/BatteryController.h> #include <Components/Ble/BleController.h> -#include "../Fonts/lcdfont14.h" -#include "../Fonts/lcdfont70.h" -#include "../../Version.h" namespace Pinetime { namespace Applications { @@ -64,20 +60,21 @@ namespace Pinetime { DirtyValue<uint8_t> batteryPercentRemaining {0}; DirtyValue<bool> bleState {false}; DirtyValue<std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds>> currentDateTime; - DirtyValue<Pinetime::Version> version; + DirtyValue<uint32_t> stepCount {0}; + DirtyValue<uint8_t> heartbeat {0}; - lv_style_t* labelStyle; - lv_style_t labelBigStyle; - lv_obj_t * label_battery; - lv_obj_t * label_ble; lv_obj_t* label_time; lv_obj_t* label_date; - lv_obj_t* label_version; lv_obj_t* backgroundLabel; - lv_obj_t * batteryIcon; lv_obj_t * bleIcon; + lv_obj_t* batteryPlug; + lv_obj_t* heartbeatIcon; + lv_obj_t* heartbeatValue; + lv_obj_t* heartbeatBpm; + lv_obj_t* stepIcon; + lv_obj_t* stepValue; Controllers::DateTime& dateTimeController; Controllers::Battery& batteryController; diff --git a/src/DisplayApp/Screens/FirmwareUpdate.h b/src/DisplayApp/Screens/FirmwareUpdate.h index a571d667..faaf3953 100644 --- a/src/DisplayApp/Screens/FirmwareUpdate.h +++ b/src/DisplayApp/Screens/FirmwareUpdate.h @@ -2,16 +2,11 @@ #include <cstdint> #include <chrono> -#include <Components/Gfx/Gfx.h> #include "Screen.h" #include <bits/unique_ptr.h> #include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_obj.h> -#include <Components/Battery/BatteryController.h> #include <Components/Ble/BleController.h> -#include "../Fonts/lcdfont14.h" -#include "../Fonts/lcdfont70.h" -#include "../../Version.h" namespace Pinetime { namespace Applications { diff --git a/src/DisplayApp/Screens/Gauge.h b/src/DisplayApp/Screens/Gauge.h index 463654ee..03c06bed 100644 --- a/src/DisplayApp/Screens/Gauge.h +++ b/src/DisplayApp/Screens/Gauge.h @@ -1,17 +1,10 @@ #pragma once #include <cstdint> -#include <chrono> -#include <Components/Gfx/Gfx.h> #include "Screen.h" #include <bits/unique_ptr.h> #include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_obj.h> -#include <Components/Battery/BatteryController.h> -#include <Components/Ble/BleController.h> -#include "../Fonts/lcdfont14.h" -#include "../Fonts/lcdfont70.h" -#include "../../Version.h" namespace Pinetime { namespace Applications { diff --git a/src/DisplayApp/Screens/Message.cpp b/src/DisplayApp/Screens/Message.cpp index c8a4ea1f..b83cb751 100644 --- a/src/DisplayApp/Screens/Message.cpp +++ b/src/DisplayApp/Screens/Message.cpp @@ -24,17 +24,12 @@ Message::Message(DisplayApp* app) : Screen(app) { backgroundLabel = lv_label_create(lv_scr_act(), NULL); backgroundLabel->user_data = this; - labelStyle = const_cast<lv_style_t *>(lv_label_get_style(backgroundLabel, LV_LABEL_STYLE_MAIN)); - labelStyle->text.font = &jetbrains_mono_bold_20; - - lv_label_set_style(backgroundLabel, LV_LABEL_STYLE_MAIN, labelStyle); lv_obj_set_click(backgroundLabel, true); lv_obj_set_event_cb(backgroundLabel, event_handler); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text(backgroundLabel, ""); -// lv_obj_align(backgroundLabel, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0); button = lv_btn_create(lv_scr_act(), NULL); lv_obj_set_event_cb(button, event_handler); @@ -42,11 +37,9 @@ Message::Message(DisplayApp* app) : Screen(app) { button->user_data = this; label = lv_label_create(button, NULL); - lv_label_set_style(label, LV_LABEL_STYLE_MAIN, labelStyle); lv_label_set_text(label, "Hello!"); labelClick = lv_label_create(lv_scr_act(), NULL); - lv_label_set_style(labelClick, LV_LABEL_STYLE_MAIN, labelStyle); lv_obj_align(labelClick, button, LV_ALIGN_OUT_BOTTOM_MID, 0, 30); lv_label_set_text(labelClick, "0"); } diff --git a/src/DisplayApp/Screens/Message.h b/src/DisplayApp/Screens/Message.h index 4e87bba4..3ace66fe 100644 --- a/src/DisplayApp/Screens/Message.h +++ b/src/DisplayApp/Screens/Message.h @@ -1,13 +1,8 @@ #pragma once #include <cstdint> -#include <chrono> -#include <Components/Gfx/Gfx.h> #include "Screen.h" #include <bits/unique_ptr.h> -#include "../Fonts/lcdfont14.h" -#include "../Fonts/lcdfont70.h" -#include "../../Version.h" #include <lvgl/src/lv_core/lv_style.h> namespace Pinetime { @@ -22,8 +17,6 @@ namespace Pinetime { void OnObjectEvent(lv_obj_t* obj, lv_event_t event); private: - - lv_style_t* labelStyle; lv_obj_t * label; lv_obj_t* backgroundLabel; lv_obj_t * button; diff --git a/src/DisplayApp/Screens/Meter.h b/src/DisplayApp/Screens/Meter.h index 1a08b46c..ddf8be8d 100644 --- a/src/DisplayApp/Screens/Meter.h +++ b/src/DisplayApp/Screens/Meter.h @@ -2,16 +2,10 @@ #include <cstdint> #include <chrono> -#include <Components/Gfx/Gfx.h> #include "Screen.h" #include <bits/unique_ptr.h> #include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_obj.h> -#include <Components/Battery/BatteryController.h> -#include <Components/Ble/BleController.h> -#include "../Fonts/lcdfont14.h" -#include "../Fonts/lcdfont70.h" -#include "../../Version.h" namespace Pinetime { namespace Applications { diff --git a/src/DisplayApp/Screens/Modal.h b/src/DisplayApp/Screens/Modal.h index b5425906..c616c294 100644 --- a/src/DisplayApp/Screens/Modal.h +++ b/src/DisplayApp/Screens/Modal.h @@ -2,16 +2,10 @@ #include <cstdint> #include <chrono> -#include <Components/Gfx/Gfx.h> #include "Screen.h" #include <bits/unique_ptr.h> #include <libs/lvgl/src/lv_core/lv_style.h> #include <libs/lvgl/src/lv_core/lv_obj.h> -#include <Components/Battery/BatteryController.h> -#include <Components/Ble/BleController.h> -#include "../Fonts/lcdfont14.h" -#include "../Fonts/lcdfont70.h" -#include "../../Version.h" namespace Pinetime { namespace Applications { diff --git a/src/DisplayApp/Screens/ScreenList.cpp b/src/DisplayApp/Screens/ScreenList.cpp index 48f71649..754d5f7e 100644 --- a/src/DisplayApp/Screens/ScreenList.cpp +++ b/src/DisplayApp/Screens/ScreenList.cpp @@ -1,6 +1,7 @@ #include <libs/lvgl/lvgl.h> #include <DisplayApp/DisplayApp.h> #include "ScreenList.h" +#include "../../Version.h" using namespace Pinetime::Applications::Screens; diff --git a/src/DisplayApp/Screens/Symbols.h b/src/DisplayApp/Screens/Symbols.h new file mode 100644 index 00000000..3104db87 --- /dev/null +++ b/src/DisplayApp/Screens/Symbols.h @@ -0,0 +1,24 @@ +#pragma once + +namespace Pinetime { + namespace Applications { + namespace Screens { + namespace Symbols { + static constexpr char* batteryFull = "\xEF\x89\x80"; + static constexpr char* batteryEmpty = "\xEF\x89\x84"; + static constexpr char* batteryThreeQuarter = "\xEF\x89\x81"; + static constexpr char* batteryHalf = "\xEF\x89\x82"; + static constexpr char* batteryOneQuarter = "\xEF\x89\x83"; + static constexpr char* heartBeat = "\xEF\x88\x9E"; + static constexpr char* bluetoothFull = "\xEF\x8A\x93"; + static constexpr char* bluetooth = "\xEF\x8A\x94"; + static constexpr char* plug = "\xEF\x87\xA6"; + static constexpr char* shoe = "\xEF\x95\x8B"; + static constexpr char* clock = "\xEF\x80\x97"; + static constexpr char* info = "\xEF\x84\xA9"; + static constexpr char* list = "\xEF\x80\xBA"; + static constexpr char* sun = "\xEF\x86\x85"; + } + } + } +}
\ No newline at end of file diff --git a/src/DisplayApp/Screens/Tab.h b/src/DisplayApp/Screens/Tab.h index 1af956f4..e16dbb96 100644 --- a/src/DisplayApp/Screens/Tab.h +++ b/src/DisplayApp/Screens/Tab.h @@ -1,13 +1,8 @@ #pragma once #include <cstdint> -#include <chrono> -#include <Components/Gfx/Gfx.h> #include "Screen.h" #include <bits/unique_ptr.h> -#include "../Fonts/lcdfont14.h" -#include "../Fonts/lcdfont70.h" -#include "../../Version.h" #include <lvgl/src/lv_core/lv_style.h> namespace Pinetime { diff --git a/src/DisplayApp/Screens/Tile.cpp b/src/DisplayApp/Screens/Tile.cpp index 6c225c9d..61e3c01d 100644 --- a/src/DisplayApp/Screens/Tile.cpp +++ b/src/DisplayApp/Screens/Tile.cpp @@ -3,7 +3,8 @@ #include <libs/lvgl/lvgl.h> #include "Tile.h" #include <DisplayApp/DisplayApp.h> - +#include "Symbols.h" +#include "../../Version.h" using namespace Pinetime::Applications::Screens; @@ -16,89 +17,17 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) { screen->OnObjectEvent(obj, event, eventData); } -static const char * btnm_map1[] = {"Meter", "Gauge", "Clock", "\n", "Soft\nversion", "App2", "Brightness", ""}; +static const char * btnm_map1[] = {Symbols::heartBeat, Symbols::shoe, Symbols::clock, "\n", Symbols::info, Symbols::list, Symbols::sun, ""}; Tile::Tile(DisplayApp* app) : Screen(app) { modal.reset(new Modal(app)); -/* - static lv_point_t valid_pos[] = {{0,0}, {LV_COORD_MIN, LV_COORD_MIN}}; - tileview = lv_tileview_create(lv_scr_act(), NULL); - lv_tileview_set_valid_positions(tileview, valid_pos, 1); - lv_tileview_set_edge_flash(tileview, false); - - tile1 = lv_obj_create(tileview, NULL); - lv_obj_set_pos(tile1, 0, 0); - lv_obj_set_size(tile1, LV_HOR_RES, LV_VER_RES); - lv_tileview_add_element(tileview, tile1); -*/ + btnm1 = lv_btnm_create(lv_scr_act(), NULL); lv_btnm_set_map(btnm1, btnm_map1); lv_obj_set_size(btnm1, LV_HOR_RES, LV_VER_RES); -// labelRelStyle = const_cast<lv_style_t *>(lv_label_get_style(btnm1, LV_BTNM_STYLE_BTN_REL)); -// labelRelStyle->text.font = &jetbrains_mono_bold_20; -// labelRelStyle->body.grad_color = labelRelStyle->body.main_color; -// lv_btnm_set_style(btnm1, LV_BTNM_STYLE_BTN_REL, labelRelStyle); -// -// labelPrStyle = const_cast<lv_style_t *>(lv_label_get_style(btnm1, LV_BTNM_STYLE_BTN_PR)); -// labelPrStyle->text.font = &jetbrains_mono_bold_20; -// labelPrStyle->body.grad_color = labelPrStyle->body.shadow.color; - - - -// lv_btnm_set_style(btnm1, LV_BTNM_STYLE_BTN_PR, labelPrStyle); -//TODO better style handling -// lv_obj_align(btnm1, tile1, LV_ALIGN_CENTER, 0, 0); btnm1->user_data = this; lv_obj_set_event_cb(btnm1, event_handler); - -/* - tile2 = lv_obj_create(tileview, NULL); - lv_obj_set_pos(tile2, 0, LV_VER_RES); - lv_obj_set_size(tile2, LV_HOR_RES, LV_VER_RES); - lv_tileview_add_element(tileview, tile2); - - btnm2 = lv_btnm_create(tileview, NULL); - lv_btnm_set_map(btnm2, btnm_map2); - lv_obj_align(btnm2, tile2, LV_ALIGN_CENTER, 0, 0); -*/ -/* - tile1 = lv_obj_create(tileview, NULL); - lv_obj_set_pos(tile1, 0, 0); - lv_obj_set_size(tile1, LV_HOR_RES, LV_VER_RES); - lv_tileview_add_element(tileview, tile1); - - btn1 = lv_btn_create(tile1, NULL); - lv_obj_align(btn1, tile1, LV_ALIGN_CENTER, 0, 0); - - label1 = lv_label_create(btn1, NULL); - lv_label_set_text(label1, "Button1"); -*/ -/* - tile2 = lv_obj_create(tileview, NULL); - lv_obj_set_pos(tile2, 0, LV_VER_RES); - lv_obj_set_size(tile2, LV_HOR_RES, LV_VER_RES); - lv_tileview_add_element(tileview, tile2); - - btn2 = lv_btn_create(tile2, NULL); - lv_obj_align(btn2, tile2, LV_ALIGN_CENTER, 0, 0); - - - label2 = lv_label_create(btn2, NULL); - lv_label_set_text(label2, "Button2"); - - tile3 = lv_obj_create(tileview, NULL); - lv_obj_set_pos(tile3, 0, LV_VER_RES*2); - lv_obj_set_size(tile3, LV_HOR_RES, LV_VER_RES); - lv_tileview_add_element(tileview, tile3); - - btn3 = lv_btn_create(tile3, NULL); - lv_obj_align(btn3, tile3, LV_ALIGN_CENTER, 0, 0); - - - label3 = lv_label_create(btn3, NULL); - lv_label_set_text(label3, "Button3"); -*/ } Tile::~Tile() { diff --git a/src/DisplayApp/Screens/Tile.h b/src/DisplayApp/Screens/Tile.h index fa2d6db0..a04b58a8 100644 --- a/src/DisplayApp/Screens/Tile.h +++ b/src/DisplayApp/Screens/Tile.h @@ -1,13 +1,8 @@ #pragma once #include <cstdint> -#include <chrono> -#include <Components/Gfx/Gfx.h> #include "Screen.h" #include <bits/unique_ptr.h> -#include "../Fonts/lcdfont14.h" -#include "../Fonts/lcdfont70.h" -#include "../../Version.h" #include "Modal.h" #include <lvgl/src/lv_core/lv_style.h> |