summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Clock.cpp
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-10-20 18:57:39 (GMT)
committerJF <jf@codingfield.com>2020-10-20 18:57:39 (GMT)
commitef5670c7e09a1a63fc5df4a066472ed7fe7550ff (patch)
tree3f7999c0dd4c4cfc42a04f7904205ffd914cc225 /src/displayapp/screens/Clock.cpp
parent55427d83b87960903cd6213ac9c73e694ee547bd (diff)
Integrate new notification UI with notifications coming from BLE
Diffstat (limited to 'src/displayapp/screens/Clock.cpp')
-rw-r--r--src/displayapp/screens/Clock.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp
index 243d4c0..eabab21 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,9 +46,11 @@ 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(), NULL);
-
lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60);
label_time = lv_label_create(lv_scr_act(), NULL);
@@ -106,6 +113,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()) {