From ef5670c7e09a1a63fc5df4a066472ed7fe7550ff Mon Sep 17 00:00:00 2001 From: JF Date: Tue, 20 Oct 2020 20:57:39 +0200 Subject: Integrate new notification UI with notifications coming from BLE --- src/displayapp/screens/Notifications.h | 36 ++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'src/displayapp/screens/Notifications.h') diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index e6f20877..0f797ea6 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -12,7 +12,8 @@ namespace Pinetime { namespace Screens { class Notifications : public Screen { public: - explicit Notifications(DisplayApp* app); + enum class Modes {Normal, Preview}; + explicit Notifications(DisplayApp* app, Pinetime::Controllers::NotificationManager& notificationManager, Modes mode); ~Notifications() override; bool Refresh() override; @@ -20,24 +21,39 @@ namespace Pinetime { bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; private: - ScreenList<3> screens; bool running = true; - std::unique_ptr CreateScreen1(); - std::unique_ptr CreateScreen2(); - std::unique_ptr CreateScreen3(); - class NotificationItem : public Screen { + class NotificationItem { public: - NotificationItem(DisplayApp* app, const char* title, const char* msg, uint8_t notifNr, uint8_t notifNb); - NotificationItem(DisplayApp* app, const char* title1, const char* msg1, const char* title2, const char* msg2, uint8_t notifNr, uint8_t notifNb); - ~NotificationItem() override; - bool Refresh() override {return false;} + NotificationItem(const char* title, const char* msg, uint8_t notifNr, uint8_t notifNb, Modes mode); + ~NotificationItem(); + bool Refresh() {return false;} private: uint8_t notifNr = 0; uint8_t notifNb = 0; char pageText[4]; + + lv_obj_t* container1; + lv_obj_t* t1; + lv_obj_t* l1; + Modes mode; + }; + + struct NotificationData { + const char* title; + const char* text; }; + Pinetime::Controllers::NotificationManager& notificationManager; + Modes mode = Modes::Normal; + std::unique_ptr currentItem; + Controllers::NotificationManager::Notification::Id currentId; + bool validDisplay = false; + + lv_point_t timeoutLinePoints[2] { {0, 237}, {239, 237} }; + lv_obj_t* timeoutLine; + uint32_t timeoutTickCountStart; + uint32_t timeoutTickCountEnd; }; } } -- cgit v1.2.3-70-g09d2