diff options
| author | JF002 <JF002@users.noreply.github.com> | 2020-10-27 21:57:48 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-27 21:57:48 +0100 |
| commit | cb9e8815d8bc6ce71fd8e97f3e3dae402658ce1f (patch) | |
| tree | 1750edfed02f547102e468eca485caab3b08e98d /src/displayapp/screens/Clock.cpp | |
| parent | c5bf09d21b2ed8e2435ec625e351594f58713924 (diff) | |
| parent | 7de43a16608e599369867cb3cfa7d5776a5b6380 (diff) | |
Merge pull request #108 from JF002/notification-ui
Improved notification UI
Diffstat (limited to 'src/displayapp/screens/Clock.cpp')
| -rw-r--r-- | src/displayapp/screens/Clock.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index bb14d520..977321c1 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -8,6 +8,9 @@ #include "BatteryIcon.h" #include "BleIcon.h" #include "Symbols.h" +#include "components/ble/NotificationManager.h" +#include "NotificationIcon.h" + using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; extern lv_font_t jetbrains_mono_bold_20; @@ -21,8 +24,10 @@ 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{{}}, - dateTimeController{dateTimeController}, batteryController{batteryController}, bleController{bleController} { + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager) : Screen(app), currentDateTime{{}}, + dateTimeController{dateTimeController}, batteryController{batteryController}, + bleController{bleController}, notificatioManager{notificatioManager} { displayedChar[0] = 0; displayedChar[1] = 0; displayedChar[2] = 0; @@ -41,6 +46,9 @@ Clock::Clock(DisplayApp* app, lv_label_set_text(bleIcon, Symbols::bluetooth); lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); + notificationIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); + lv_obj_align(notificationIcon, nullptr, LV_ALIGN_IN_TOP_LEFT, 10, 0); label_date = lv_label_create(lv_scr_act(), nullptr); @@ -106,6 +114,14 @@ bool Clock::Refresh() { lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); + notificationState = notificatioManager.AreNewNotificationsAvailable(); + if(notificationState.IsUpdated()) { + if(notificationState.Get() == true) + lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); + else + lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); + } + currentDateTime = dateTimeController.CurrentDateTime(); if(currentDateTime.IsUpdated()) { |
