Skip to content

Commit 29bb359

Browse files
committed
Fix notification icon alignment
1 parent 50406ad commit 29bb359

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

src/displayapp/screens/PineTimeStyle.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ PineTimeStyle::PineTimeStyle(DisplayApp* app,
108108

109109
bleIcon = lv_label_create(lv_scr_act(), nullptr);
110110
lv_obj_set_style_local_text_color(bleIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
111-
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
111+
lv_label_set_text(bleIcon, "");
112112

113113
notificationIcon = lv_label_create(lv_scr_act(), nullptr);
114114
lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
115-
lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 40);
115+
lv_label_set_text(notificationIcon, "");
116116

117117
// Calendar icon
118118
calendarOuter = lv_obj_create(lv_scr_act(), nullptr);
@@ -305,12 +305,12 @@ PineTimeStyle::~PineTimeStyle() {
305305
}
306306

307307
bool PineTimeStyle::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
308-
if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnRandom)) {
308+
if ((event == Pinetime::Applications::TouchEvents::LongTap) && lv_obj_get_hidden(btnClose)) {
309309
lv_obj_set_hidden(btnSet, false);
310310
savedTick = lv_tick_get();
311311
return true;
312312
}
313-
if ((event == Pinetime::Applications::TouchEvents::DoubleTap) && (lv_obj_get_hidden(btnRandom) == false)) {
313+
if ((event == Pinetime::Applications::TouchEvents::DoubleTap) && !lv_obj_get_hidden(btnClose)) {
314314
return true;
315315
}
316316
return false;
@@ -359,15 +359,20 @@ void PineTimeStyle::Refresh() {
359359
}
360360

361361
bleState = bleController.IsConnected();
362-
if (bleState.IsUpdated()) {
362+
if (bleState.Get()) {
363363
lv_label_set_text(bleIcon, BleIcon::GetIcon(bleState.Get()));
364-
lv_obj_realign(bleIcon);
364+
} else {
365+
lv_label_set_text(bleIcon, "");
365366
}
366367

367368
notificationState = notificatioManager.AreNewNotificationsAvailable();
368-
if (notificationState.IsUpdated()) {
369+
if (notificationState.Get()) {
369370
lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(notificationState.Get()));
370-
lv_obj_realign(notificationIcon);
371+
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25);
372+
lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25);
373+
} else {
374+
lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25);
375+
lv_label_set_text(notificationIcon, "");
371376
}
372377

373378
currentDateTime = dateTimeController.CurrentDateTime();

0 commit comments

Comments
 (0)