2020-10-18 17:35:36 +02:00
|
|
|
#pragma once
|
|
|
|
|
2020-11-15 16:49:36 +01:00
|
|
|
#include <lvgl/lvgl.h>
|
|
|
|
#include <cstdint>
|
|
|
|
#include <memory>
|
2020-10-18 17:35:36 +02:00
|
|
|
#include "Screen.h"
|
2020-11-15 16:49:36 +01:00
|
|
|
#include "components/ble/NotificationManager.h"
|
2020-10-18 17:35:36 +02:00
|
|
|
|
|
|
|
namespace Pinetime {
|
|
|
|
namespace Applications {
|
|
|
|
namespace Screens {
|
|
|
|
class Notifications : public Screen {
|
|
|
|
public:
|
2020-10-20 20:57:39 +02:00
|
|
|
enum class Modes {Normal, Preview};
|
|
|
|
explicit Notifications(DisplayApp* app, Pinetime::Controllers::NotificationManager& notificationManager, Modes mode);
|
2020-10-18 17:35:36 +02:00
|
|
|
~Notifications() override;
|
|
|
|
|
|
|
|
bool Refresh() override;
|
|
|
|
bool OnButtonPushed() override;
|
|
|
|
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
|
|
|
|
|
|
|
|
private:
|
2020-10-19 21:46:41 +02:00
|
|
|
bool running = true;
|
|
|
|
|
2020-10-20 20:57:39 +02:00
|
|
|
class NotificationItem {
|
2020-10-18 17:35:36 +02:00
|
|
|
public:
|
2020-10-20 20:57:39 +02:00
|
|
|
NotificationItem(const char* title, const char* msg, uint8_t notifNr, uint8_t notifNb, Modes mode);
|
|
|
|
~NotificationItem();
|
|
|
|
bool Refresh() {return false;}
|
2020-10-19 21:46:41 +02:00
|
|
|
|
2020-10-18 17:35:36 +02:00
|
|
|
private:
|
2020-10-19 21:46:41 +02:00
|
|
|
uint8_t notifNr = 0;
|
|
|
|
uint8_t notifNb = 0;
|
|
|
|
char pageText[4];
|
2020-10-20 20:57:39 +02:00
|
|
|
|
|
|
|
lv_obj_t* container1;
|
|
|
|
lv_obj_t* t1;
|
|
|
|
lv_obj_t* l1;
|
2020-10-22 15:39:20 +02:00
|
|
|
lv_obj_t* bottomPlaceholder;
|
2020-10-20 20:57:39 +02:00
|
|
|
Modes mode;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct NotificationData {
|
|
|
|
const char* title;
|
|
|
|
const char* text;
|
2020-10-18 17:35:36 +02:00
|
|
|
};
|
2020-10-20 20:57:39 +02:00
|
|
|
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;
|
2020-10-18 17:35:36 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|