Increased the notification text area size so that more text can be shown, rearranged the notification header (source of the notification, contact and time)

This commit is contained in:
anschrammh 2024-01-16 13:02:44 +01:00
parent dd1d1dfd79
commit c4c6ace3cb

View File

@ -25,7 +25,7 @@ static void notification_scrolled_event_cb(lv_event_t *e)
//If we didn't scroll down enough, make the notif pop again
if(lv_obj_get_scroll_y(e->target) >= 83)
{
lv_obj_scroll_to_y(e->target, 166, LV_ANIM_ON);
lv_obj_scroll_to_y(e->target, 186, LV_ANIM_ON);
}
//Else we know that the user wants to close the notification, so we do it with an animation to reach 0
else if(lv_obj_get_scroll_y(e->target) != 0)
@ -287,12 +287,12 @@ void _display_message_notification(NotificationScreen_t * const notificationScre
lv_obj_add_event_cb(notification_display, &(notification_scrolled_event_cb), LV_EVENT_SCROLL_END, notificationScreen);
lv_obj_t *main_notification = lv_obj_create(notification_display);
lv_obj_set_size(main_notification, 202, 166);
lv_obj_set_size(main_notification, 222, 186);
lv_obj_set_style_pad_all(main_notification, 0, LV_PART_MAIN);
lv_obj_set_style_pad_top(main_notification, 10, LV_PART_MAIN);
lv_obj_set_style_border_width(main_notification, 0, LV_PART_MAIN);
lv_obj_set_style_radius(main_notification, 30, LV_PART_MAIN);
lv_obj_align(main_notification, LV_ALIGN_BOTTOM_MID,0,166);
lv_obj_align(main_notification, LV_ALIGN_BOTTOM_MID,0,186);
lv_obj_set_style_bg_color(main_notification, lv_color_make(52, 93, 106), LV_PART_MAIN);
//lv_obj_set_style_opa(main_notification, 240, LV_PART_MAIN); //Opacity is too heavy on ram :-(
@ -305,10 +305,10 @@ void _display_message_notification(NotificationScreen_t * const notificationScre
}
notificationScreen->type_label = lv_label_create(main_notification);
lv_obj_set_style_text_color(notificationScreen->type_label, lv_color_white(), LV_PART_MAIN);
lv_obj_set_style_pad_left(notificationScreen->type_label, 10, LV_PART_MAIN);
lv_obj_set_style_pad_left(notificationScreen->type_label, 8, LV_PART_MAIN);
lv_label_set_long_mode(notificationScreen->type_label, LV_LABEL_LONG_SCROLL_CIRCULAR);
lv_obj_set_style_anim_speed(notificationScreen->type_label, 10, LV_PART_MAIN);
lv_obj_set_width(notificationScreen->type_label, lv_pct(27));
lv_obj_set_width(notificationScreen->type_label, lv_pct(31));
lv_label_set_text_static(notificationScreen->type_label, _notification_type_to_char(notification->type));
if(notificationScreen->title_label)
@ -322,7 +322,7 @@ void _display_message_notification(NotificationScreen_t * const notificationScre
lv_obj_align(notificationScreen->title_label, LV_ALIGN_TOP_MID, 0, 0);
lv_obj_set_style_anim_speed(notificationScreen->title_label, 10, LV_PART_MAIN);
lv_label_set_long_mode(notificationScreen->title_label, LV_LABEL_LONG_SCROLL_CIRCULAR);
lv_obj_set_width(notificationScreen->title_label, lv_pct(40));
lv_obj_set_width(notificationScreen->title_label, lv_pct(35));
lv_label_set_text_static(notificationScreen->title_label, notification->title);
if(notificationScreen->date_label)
@ -335,6 +335,8 @@ void _display_message_notification(NotificationScreen_t * const notificationScre
lv_obj_set_style_pad_right(notificationScreen->date_label, 10, LV_PART_MAIN);
lv_obj_set_style_text_color(notificationScreen->date_label, lv_color_white(), LV_PART_MAIN);
lv_obj_align(notificationScreen->date_label, LV_ALIGN_TOP_RIGHT, 0, 0);
lv_obj_set_width(notificationScreen->date_label, lv_pct(31));
lv_obj_set_style_text_align(notificationScreen->date_label, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
lv_label_set_text_static(notificationScreen->date_label, _notification_timestamp_to_date(notification->dateOfArrival, notificationScreen->notification_hour_24H_format));
//Create the sub-area in the notification
@ -342,8 +344,8 @@ void _display_message_notification(NotificationScreen_t * const notificationScre
lv_obj_set_style_pad_all(sub_area, 10, LV_PART_MAIN);
lv_obj_set_style_border_width(sub_area, 0, LV_PART_MAIN);
lv_obj_set_style_radius(sub_area, 0, LV_PART_MAIN);
lv_obj_set_width(sub_area, 202);
lv_obj_set_height(sub_area, 136);
lv_obj_set_width(sub_area, 222);
lv_obj_set_height(sub_area, 156);
lv_obj_align(sub_area, LV_ALIGN_BOTTOM_MID, 0, 0);
lv_obj_set_style_bg_color(sub_area, lv_color_make(22, 52, 62), LV_PART_MAIN);
//Create the main text
@ -357,12 +359,12 @@ void _display_message_notification(NotificationScreen_t * const notificationScre
lv_obj_set_width(notificationScreen->body_label, 182);
lv_obj_set_style_text_color(notificationScreen->body_label, lv_color_white(), LV_PART_MAIN);
lv_obj_set_style_pad_all(notificationScreen->body_label, 0, LV_PART_MAIN);
lv_obj_set_style_pad_bottom(notificationScreen->body_label, 40, LV_PART_MAIN);
lv_obj_set_style_pad_bottom(notificationScreen->body_label, 60, LV_PART_MAIN);
lv_label_set_long_mode(notificationScreen->body_label, LV_LABEL_LONG_WRAP);
lv_label_set_text_static(notificationScreen->body_label, notification->body);
lv_obj_scroll_to_y(notification_display, 166, LV_ANIM_ON);
lv_obj_scroll_to_y(notification_display, 186, LV_ANIM_ON);
}
else
{