Notifications: no inTransition screen, simple blackbox is enough

This commit is contained in:
Reinhold Gschweicher 2022-06-27 22:32:03 +02:00 committed by JF
parent 2c75e7aad8
commit 12fad7411d
2 changed files with 9 additions and 15 deletions

View File

@ -157,8 +157,10 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
} }
currentItem.reset(nullptr); currentItem.reset(nullptr);
app->SetFullRefresh(DisplayApp::FullRefreshDirections::RightAnim); app->SetFullRefresh(DisplayApp::FullRefreshDirections::RightAnim);
// create black "inTransition" screen // create black transition screen to let the notification dismiss to blackness
currentItem = std::make_unique<NotificationItem>(alertNotificationService, motorController, true); lv_obj_t* blackBox = lv_obj_create(lv_scr_act(), nullptr);
lv_obj_set_size(blackBox, LV_HOR_RES, LV_VER_RES);
lv_obj_set_style_local_bg_color(blackBox, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
dismissingNotification = true; dismissingNotification = true;
return true; return true;
} }
@ -229,16 +231,14 @@ namespace {
} }
Notifications::NotificationItem::NotificationItem(Pinetime::Controllers::AlertNotificationService& alertNotificationService, Notifications::NotificationItem::NotificationItem(Pinetime::Controllers::AlertNotificationService& alertNotificationService,
Pinetime::Controllers::MotorController& motorController, Pinetime::Controllers::MotorController& motorController)
bool isTransition)
: NotificationItem("Notification", : NotificationItem("Notification",
"No notification to display", "No notification to display",
0, 0,
Controllers::NotificationManager::Categories::Unknown, Controllers::NotificationManager::Categories::Unknown,
0, 0,
alertNotificationService, alertNotificationService,
motorController, motorController) {
isTransition) {
} }
Notifications::NotificationItem::NotificationItem(const char* title, Notifications::NotificationItem::NotificationItem(const char* title,
@ -247,12 +247,8 @@ Notifications::NotificationItem::NotificationItem(const char* title,
Controllers::NotificationManager::Categories category, Controllers::NotificationManager::Categories category,
uint8_t notifNb, uint8_t notifNb,
Pinetime::Controllers::AlertNotificationService& alertNotificationService, Pinetime::Controllers::AlertNotificationService& alertNotificationService,
Pinetime::Controllers::MotorController& motorController, Pinetime::Controllers::MotorController& motorController)
bool isTransition)
: alertNotificationService {alertNotificationService}, motorController {motorController} { : alertNotificationService {alertNotificationService}, motorController {motorController} {
if (isTransition) {
return; // nothing to do, just a black box
}
container = lv_cont_create(lv_scr_act(), nullptr); container = lv_cont_create(lv_scr_act(), nullptr);
lv_obj_set_size(container, LV_HOR_RES, LV_VER_RES); lv_obj_set_size(container, LV_HOR_RES, LV_VER_RES);
lv_obj_set_style_local_bg_color(container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); lv_obj_set_style_local_bg_color(container, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);

View File

@ -34,16 +34,14 @@ namespace Pinetime {
class NotificationItem { class NotificationItem {
public: public:
NotificationItem(Pinetime::Controllers::AlertNotificationService& alertNotificationService, NotificationItem(Pinetime::Controllers::AlertNotificationService& alertNotificationService,
Pinetime::Controllers::MotorController& motorController, Pinetime::Controllers::MotorController& motorController);
bool isTransition = false);
NotificationItem(const char* title, NotificationItem(const char* title,
const char* msg, const char* msg,
uint8_t notifNr, uint8_t notifNr,
Controllers::NotificationManager::Categories, Controllers::NotificationManager::Categories,
uint8_t notifNb, uint8_t notifNb,
Pinetime::Controllers::AlertNotificationService& alertNotificationService, Pinetime::Controllers::AlertNotificationService& alertNotificationService,
Pinetime::Controllers::MotorController& motorController, Pinetime::Controllers::MotorController& motorController);
bool isTransition = false);
~NotificationItem(); ~NotificationItem();
bool IsRunning() const { bool IsRunning() const {
return running; return running;