diff options
author | Tomas Groth <second@tgc.dk> | 2022-09-21 07:33:20 +0200 |
---|---|---|
committer | JF <JF002@users.noreply.github.com> | 2022-12-26 22:18:50 +0100 |
commit | 861ed3584ce911d03d21960b55d98b624a8e0831 (patch) | |
tree | 7655a44494cb5821541c9af452273a1264791df2 /src/displayapp/screens/Notifications.cpp | |
parent | bef65bcd55a4238c6e93a33c097f6dc37b52cf1d (diff) |
Put common code into DismissToBlack helper function
Diffstat (limited to 'src/displayapp/screens/Notifications.cpp')
-rw-r--r-- | src/displayapp/screens/Notifications.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 9d126a16..9fa07993 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -129,20 +129,24 @@ void Notifications::OnPreviewInteraction() { } } -void Notifications::OnPreviewDismiss() { - notificationManager.Dismiss(currentId); - if (timeoutLine != nullptr) { - lv_obj_del(timeoutLine); - timeoutLine = nullptr; - } +void Notifications::DismissToBlack() +{ currentItem.reset(nullptr); - dismissingNotification = true; - afterDismissNextMessageFromAbove = true; // show next message coming from below app->SetFullRefresh(DisplayApp::FullRefreshDirections::RightAnim); // 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; +} + +void Notifications::OnPreviewDismiss() { + notificationManager.Dismiss(currentId); + if (timeoutLine != nullptr) { + lv_obj_del(timeoutLine); + timeoutLine = nullptr; + } + DismissToBlack(); } bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { @@ -172,13 +176,7 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } else { // don't update id, won't be found be refresh and try to load latest message or no message box } - currentItem.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::RightAnim); - // 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; + DismissToBlack(); return true; } return false; |