2020-10-18 11:35:36 -04:00
|
|
|
#pragma once
|
|
|
|
|
2020-11-15 10:49:36 -05:00
|
|
|
#include <lvgl/lvgl.h>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <memory>
|
2020-10-18 11:35:36 -04:00
|
|
|
#include "Screen.h"
|
2020-11-15 10:49:36 -05:00
|
|
|
#include "components/ble/NotificationManager.h"
|
2020-10-18 11:35:36 -04:00
|
|
|
|
|
|
|
namespace Pinetime {
|
2021-01-24 11:27:48 -05:00
|
|
|
namespace Controllers {
|
|
|
|
class AlertNotificationService;
|
|
|
|
}
|
2020-10-18 11:35:36 -04:00
|
|
|
namespace Applications {
|
|
|
|
namespace Screens {
|
2021-01-24 11:27:48 -05:00
|
|
|
|
2020-10-18 11:35:36 -04:00
|
|
|
class Notifications : public Screen {
|
|
|
|
public:
|
2020-10-20 14:57:39 -04:00
|
|
|
enum class Modes {Normal, Preview};
|
2021-01-24 11:27:48 -05:00
|
|
|
explicit Notifications(DisplayApp* app, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::AlertNotificationService& alertNotificationService, Modes mode);
|
2020-10-18 11:35:36 -04:00
|
|
|
~Notifications() override;
|
|
|
|
|
|
|
|
bool Refresh() override;
|
|
|
|
bool OnButtonPushed() override;
|
|
|
|
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
|
|
|
|
|
2021-01-24 11:22:39 -05:00
|
|
|
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 Refresh() {return false;}
|
|
|
|
void OnAcceptIncomingCall(lv_event_t event);
|
2021-01-27 07:45:06 -05:00
|
|
|
void OnMuteIncomingCall(lv_event_t event);
|
2021-01-24 11:22:39 -05:00
|
|
|
void OnRejectIncomingCall(lv_event_t event);
|
|
|
|
|
2020-10-18 11:35:36 -04:00
|
|
|
private:
|
2021-01-24 11:22:39 -05:00
|
|
|
uint8_t notifNr = 0;
|
|
|
|
uint8_t notifNb = 0;
|
|
|
|
char pageText[4];
|
2020-10-19 15:46:41 -04:00
|
|
|
|
2021-01-24 11:22:39 -05:00
|
|
|
lv_obj_t* container1;
|
|
|
|
lv_obj_t* t1;
|
|
|
|
lv_obj_t* l1;
|
|
|
|
lv_obj_t* l2;
|
|
|
|
lv_obj_t* bt_accept;
|
2021-01-27 07:45:06 -05:00
|
|
|
lv_obj_t* bt_mute;
|
2021-01-24 11:22:39 -05:00
|
|
|
lv_obj_t* bt_reject;
|
|
|
|
lv_obj_t* label_accept;
|
2021-01-27 07:45:06 -05:00
|
|
|
lv_obj_t* label_mute;
|
2021-01-24 11:22:39 -05:00
|
|
|
lv_obj_t* label_reject;
|
|
|
|
lv_obj_t* bottomPlaceholder;
|
|
|
|
Modes mode;
|
|
|
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool running = true;
|
2020-10-20 14:57:39 -04:00
|
|
|
|
|
|
|
struct NotificationData {
|
|
|
|
const char* title;
|
|
|
|
const char* text;
|
2020-10-18 11:35:36 -04:00
|
|
|
};
|
2020-10-20 14:57:39 -04:00
|
|
|
Pinetime::Controllers::NotificationManager& notificationManager;
|
2021-01-24 11:27:48 -05:00
|
|
|
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
|
2020-10-20 14:57:39 -04:00
|
|
|
Modes mode = Modes::Normal;
|
|
|
|
std::unique_ptr<NotificationItem> currentItem;
|
|
|
|
Controllers::NotificationManager::Notification::Id currentId;
|
|
|
|
bool validDisplay = false;
|
|
|
|
|
2021-01-28 12:13:28 -05:00
|
|
|
lv_point_t timeoutLinePoints[2] { {0, 1}, {239, 1} };
|
2020-10-20 14:57:39 -04:00
|
|
|
lv_obj_t* timeoutLine;
|
|
|
|
uint32_t timeoutTickCountStart;
|
|
|
|
uint32_t timeoutTickCountEnd;
|
2020-10-18 11:35:36 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|