summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/Notifications.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens/Notifications.cpp')
-rw-r--r--src/displayapp/screens/Notifications.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp
index 3a39dacf..f9afd8c7 100644
--- a/src/displayapp/screens/Notifications.cpp
+++ b/src/displayapp/screens/Notifications.cpp
@@ -198,15 +198,18 @@ Notifications::NotificationItem::NotificationItem(const char* title,
lv_obj_t* alert_type = lv_label_create(lv_scr_act(), nullptr);
lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x888888));
- if (title == nullptr)
- title = "Notification";
- char* pchar;
- pchar = strchr(title, '\n');
- while (pchar != nullptr) {
- *pchar = ' ';
- pchar = strchr(pchar + 1, '\n');
+ if(title == nullptr) {
+ lv_label_set_text_static(alert_type, "Notification");
+ } else {
+ // copy title to label and replace newlines with spaces
+ lv_label_set_text(alert_type, title);
+ char *pchar = strchr(lv_label_get_text(alert_type), '\n');
+ while (pchar != nullptr) {
+ *pchar = ' ';
+ pchar = strchr(pchar + 1, '\n');
+ }
+ lv_label_refr_text(alert_type);
}
- lv_label_set_text(alert_type, title);
lv_label_set_long_mode(alert_type, LV_LABEL_LONG_SROLL_CIRC);
lv_obj_set_width(alert_type, 180);
lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16);