summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/displayapp/screens/Notifications.cpp35
-rw-r--r--src/displayapp/screens/Notifications.h8
-rw-r--r--src/systemtask/SystemTask.cpp2
3 files changed, 31 insertions, 14 deletions
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp
index 482247e6..60349a64 100644
--- a/src/displayapp/screens/Notifications.cpp
+++ b/src/displayapp/screens/Notifications.cpp
@@ -29,7 +29,8 @@ Notifications::Notifications(DisplayApp* app,
notificationManager.NbNotifications(),
mode,
alertNotificationService,
- motorController);
+ motorController,
+ &timeoutTickCountEnd);
validDisplay = true;
} else {
currentItem = std::make_unique<NotificationItem>("Notification",
@@ -39,7 +40,8 @@ Notifications::Notifications(DisplayApp* app,
notificationManager.NbNotifications(),
Modes::Preview,
alertNotificationService,
- motorController);
+ motorController,
+ &timeoutTickCountEnd);
}
if (mode == Modes::Preview) {
@@ -63,7 +65,7 @@ Notifications::~Notifications() {
}
bool Notifications::Refresh() {
- if (mode == Modes::Preview) {
+ if (mode == Modes::Preview && !currentItem->timeoutOnHold) {
auto tick = xTaskGetTickCount();
int32_t pos = 240 - ((tick - timeoutTickCountStart) / ((timeoutTickCountEnd - timeoutTickCountStart) / 240));
if (pos < 0)
@@ -105,7 +107,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
notificationManager.NbNotifications(),
mode,
alertNotificationService,
- motorController);
+ motorController,
+ &timeoutTickCountEnd);
}
return true;
case Pinetime::Applications::TouchEvents::SwipeUp: {
@@ -131,7 +134,8 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
notificationManager.NbNotifications(),
mode,
alertNotificationService,
- motorController);
+ motorController,
+ &timeoutTickCountEnd);
}
return true;
case Pinetime::Applications::TouchEvents::LongTap: {
@@ -167,8 +171,10 @@ Notifications::NotificationItem::NotificationItem(const char* title,
uint8_t notifNb,
Modes mode,
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
- Controllers::MotorController& motorController)
- : notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService}, motorController{motorController} {
+ Controllers::MotorController& motorController,
+ uint32_t* timeoutEnd)
+ : notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService},
+ motorController{motorController}, timeoutEnd{timeoutEnd} {
lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL);
@@ -251,7 +257,7 @@ Notifications::NotificationItem::NotificationItem(const char* title,
label_mute = lv_label_create(bt_mute, nullptr);
lv_label_set_text(label_mute, Symbols::volumMute);
lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
-
+ timeoutOnHold = true;
} break;
}
@@ -266,24 +272,31 @@ Notifications::NotificationItem::NotificationItem(const char* title,
void Notifications::NotificationItem::OnAcceptIncomingCall(lv_event_t event) {
if (event != LV_EVENT_CLICKED)
return;
- motorController.stopRunning();
+ callPreviewInteraction();
alertNotificationService.AcceptIncomingCall();
}
void Notifications::NotificationItem::OnMuteIncomingCall(lv_event_t event) {
if (event != LV_EVENT_CLICKED)
return;
- motorController.stopRunning();
+ callPreviewInteraction();
alertNotificationService.MuteIncomingCall();
}
void Notifications::NotificationItem::OnRejectIncomingCall(lv_event_t event) {
if (event != LV_EVENT_CLICKED)
return;
- motorController.stopRunning();
+ callPreviewInteraction();
alertNotificationService.RejectIncomingCall();
}
+inline void Notifications::NotificationItem::callPreviewInteraction() {
+ *timeoutEnd = xTaskGetTickCount() + (5 * 1024);
+ timeoutOnHold = false;
+ motorController.stopRunning();
+}
+
+
Notifications::NotificationItem::~NotificationItem() {
lv_obj_clean(lv_scr_act());
}
diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h
index ae83e8ee..89b676ec 100644
--- a/src/displayapp/screens/Notifications.h
+++ b/src/displayapp/screens/Notifications.h
@@ -36,7 +36,8 @@ namespace Pinetime {
uint8_t notifNb,
Modes mode,
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
- Controllers::MotorController& motorController);
+ Controllers::MotorController& motorController,
+ uint32_t* timeoutEnd);
~NotificationItem();
bool Refresh() {
return false;
@@ -44,8 +45,10 @@ namespace Pinetime {
void OnAcceptIncomingCall(lv_event_t event);
void OnMuteIncomingCall(lv_event_t event);
void OnRejectIncomingCall(lv_event_t event);
-
+ bool timeoutOnHold = false;
private:
+ void callPreviewInteraction();
+
uint8_t notifNr = 0;
uint8_t notifNb = 0;
char pageText[4];
@@ -61,6 +64,7 @@ namespace Pinetime {
lv_obj_t* label_mute;
lv_obj_t* label_reject;
lv_obj_t* bottomPlaceholder;
+ uint32_t* timeoutEnd;
Modes mode;
Pinetime::Controllers::AlertNotificationService& alertNotificationService;
Controllers::MotorController& motorController;
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp
index 0d43b2f3..2b5e7bbb 100644
--- a/src/systemtask/SystemTask.cpp
+++ b/src/systemtask/SystemTask.cpp
@@ -226,7 +226,7 @@ void SystemTask::Work() {
if (isSleeping && !isWakingUp)
GoToRunning();
if (notificationManager.GetLastNotification().category == Controllers::NotificationManager::Categories::IncomingCall) {
- motorController.startRunning(50);
+ motorController.startRunning(500);
} else {
motorController.RunForDuration(35);
}