forked from InfiniTimeOrg/InfiniTime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNotifications.h
79 lines (70 loc) · 2.62 KB
/
Notifications.h
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#include <lvgl/lvgl.h>
#include <cstdint>
#include <memory>
#include "displayapp/screens/Screen.h"
#include "components/ble/NotificationManager.h"
#include "components/motor/MotorController.h"
namespace Pinetime {
namespace Controllers {
class AlertNotificationService;
}
namespace Applications {
namespace Screens {
class Notifications : public Screen {
public:
enum class Modes { Normal, Preview };
explicit Notifications(DisplayApp* app,
Pinetime::Controllers::NotificationManager& notificationManager,
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
Pinetime::Controllers::MotorController& motorController,
Modes mode);
~Notifications() override;
void Refresh() override;
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
class NotificationItem {
public:
NotificationItem(const char* title,
const char* msg,
uint8_t notifNr,
Controllers::NotificationManager::Categories,
uint8_t notifNb,
Modes mode,
Pinetime::Controllers::AlertNotificationService& alertNotificationService);
~NotificationItem();
bool IsRunning() const {
return running;
}
void OnCallButtonEvent(lv_obj_t*, lv_event_t event);
private:
lv_obj_t* container1;
lv_obj_t* bt_accept;
lv_obj_t* bt_mute;
lv_obj_t* bt_reject;
lv_obj_t* label_accept;
lv_obj_t* label_mute;
lv_obj_t* label_reject;
Modes mode;
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
bool running = true;
};
private:
struct NotificationData {
const char* title;
const char* text;
};
Pinetime::Controllers::NotificationManager& notificationManager;
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
Modes mode = Modes::Normal;
std::unique_ptr<NotificationItem> currentItem;
Controllers::NotificationManager::Notification::Id currentId;
bool validDisplay = false;
lv_point_t timeoutLinePoints[2] {{0, 1}, {239, 1}};
lv_obj_t* timeoutLine = nullptr;
uint32_t timeoutTickCountStart;
uint32_t timeoutTickCountEnd;
lv_task_t* taskRefresh;
};
}
}
}