From 12fad7411de43a6bc52fd7129a3edbd508fab6cc Mon Sep 17 00:00:00 2001 From: Reinhold Gschweicher Date: Mon, 27 Jun 2022 22:32:03 +0200 Subject: Notifications: no inTransition screen, simple blackbox is enough --- src/displayapp/screens/Notifications.cpp | 18 +++++++----------- src/displayapp/screens/Notifications.h | 6 ++---- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'src/displayapp') diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 9c0d28a8..1479cf5d 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -157,8 +157,10 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } currentItem.reset(nullptr); app->SetFullRefresh(DisplayApp::FullRefreshDirections::RightAnim); - // create black "inTransition" screen - currentItem = std::make_unique(alertNotificationService, motorController, true); + // create black transition screen to let the notification dismiss to blackness + 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; return true; } @@ -229,16 +231,14 @@ namespace { } Notifications::NotificationItem::NotificationItem(Pinetime::Controllers::AlertNotificationService& alertNotificationService, - Pinetime::Controllers::MotorController& motorController, - bool isTransition) + Pinetime::Controllers::MotorController& motorController) : NotificationItem("Notification", "No notification to display", 0, Controllers::NotificationManager::Categories::Unknown, 0, alertNotificationService, - motorController, - isTransition) { + motorController) { } Notifications::NotificationItem::NotificationItem(const char* title, @@ -247,12 +247,8 @@ Notifications::NotificationItem::NotificationItem(const char* title, Controllers::NotificationManager::Categories category, uint8_t notifNb, Pinetime::Controllers::AlertNotificationService& alertNotificationService, - Pinetime::Controllers::MotorController& motorController, - bool isTransition) + Pinetime::Controllers::MotorController& motorController) : alertNotificationService {alertNotificationService}, motorController {motorController} { - if (isTransition) { - return; // nothing to do, just a black box - } container = lv_cont_create(lv_scr_act(), nullptr); 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); diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index d3088f80..9d843a9b 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -34,16 +34,14 @@ namespace Pinetime { class NotificationItem { public: NotificationItem(Pinetime::Controllers::AlertNotificationService& alertNotificationService, - Pinetime::Controllers::MotorController& motorController, - bool isTransition = false); + Pinetime::Controllers::MotorController& motorController); NotificationItem(const char* title, const char* msg, uint8_t notifNr, Controllers::NotificationManager::Categories, uint8_t notifNb, Pinetime::Controllers::AlertNotificationService& alertNotificationService, - Pinetime::Controllers::MotorController& motorController, - bool isTransition = false); + Pinetime::Controllers::MotorController& motorController); ~NotificationItem(); bool IsRunning() const { return running; -- cgit v1.2.3