summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Notifications.h
blob: fb4e1ef2f078c8bbda1c89abc819391e54edc4a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once

#include <functional>
#include <vector>

#include "Screen.h"
#include "ScreenList.h"


namespace Pinetime {
  namespace Applications {
    namespace Screens {
      class Notifications : public Screen {
        public:
          enum class Modes {Normal, Preview};
          explicit Notifications(DisplayApp* app, Pinetime::Controllers::NotificationManager& notificationManager, Modes mode);
          ~Notifications() override;

          bool Refresh() override;
          bool OnButtonPushed() override;
          bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;

        private:
          bool running = true;

          class NotificationItem {
            public:
              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;
              lv_obj_t* bottomPlaceholder;
              Modes mode;
          };

          struct NotificationData {
            const char* title;
            const char* text;
          };
          Pinetime::Controllers::NotificationManager& notificationManager;
          Modes mode = Modes::Normal;
          std::unique_ptr<NotificationItem> 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;
      };
    }
  }
}