NotificationItem now also redefines the start of the timeout

This commit is contained in:
Florian Kraupa 2021-05-13 01:51:43 +02:00
parent 56af4a0b83
commit 9e8dd9a1e6
2 changed files with 16 additions and 8 deletions

View File

@ -30,7 +30,8 @@ Notifications::Notifications(DisplayApp* app,
mode,
alertNotificationService,
motorController,
&timeoutTickCountEnd);
&timeoutTickCountEnd,
&timeoutTickCountStart);
validDisplay = true;
} else {
currentItem = std::make_unique<NotificationItem>("Notification",
@ -41,7 +42,8 @@ Notifications::Notifications(DisplayApp* app,
Modes::Preview,
alertNotificationService,
motorController,
&timeoutTickCountEnd);
&timeoutTickCountEnd,
&timeoutTickCountStart);
}
if (mode == Modes::Preview) {
@ -105,7 +107,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
mode,
alertNotificationService,
motorController,
&timeoutTickCountEnd);
&timeoutTickCountEnd,
&timeoutTickCountStart);
}
return true;
case Pinetime::Applications::TouchEvents::SwipeUp: {
@ -132,7 +135,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
mode,
alertNotificationService,
motorController,
&timeoutTickCountEnd);
&timeoutTickCountEnd,
&timeoutTickCountStart);
}
return true;
case Pinetime::Applications::TouchEvents::LongTap: {
@ -169,9 +173,10 @@ Notifications::NotificationItem::NotificationItem(const char* title,
Modes mode,
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
Controllers::MotorController& motorController,
uint32_t* timeoutEnd)
uint32_t* timeoutEnd,
uint32_t* timeoutStart)
: notifNr{notifNr}, notifNb{notifNb}, mode{mode}, alertNotificationService{alertNotificationService},
motorController{motorController}, timeoutEnd{timeoutEnd} {
motorController{motorController}, timeoutEnd{timeoutEnd}, timeoutStart{timeoutStart} {
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL);
lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222));
@ -286,7 +291,8 @@ void Notifications::NotificationItem::OnRejectIncomingCall(lv_event_t event) {
}
inline void Notifications::NotificationItem::callPreviewInteraction() {
*timeoutEnd = xTaskGetTickCount() + (5 * 1024);
*timeoutStart = xTaskGetTickCount();
*timeoutEnd = *timeoutStart + (5 * 1024);
timeoutOnHold = false;
motorController.stopRunning();
}

View File

@ -37,7 +37,8 @@ namespace Pinetime {
Modes mode,
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
Controllers::MotorController& motorController,
uint32_t* timeoutEnd);
uint32_t* timeoutEnd,
uint32_t* timeoutStart);
~NotificationItem();
bool Refresh() {
return false;
@ -66,6 +67,7 @@ namespace Pinetime {
lv_obj_t* label_reject;
lv_obj_t* bottomPlaceholder;
uint32_t* timeoutEnd;
uint32_t* timeoutStart;
Modes mode;
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
Controllers::MotorController& motorController;