diff options
| author | Jean-François Milants <jf@codingfield.com> | 2022-02-20 14:41:06 (GMT) |
|---|---|---|
| committer | Jean-François Milants <jf@codingfield.com> | 2022-02-20 14:41:06 (GMT) |
| commit | 0e2b27d7926035f63790851db5c00af431b2eb07 (patch) | |
| tree | a10a4068c592f13057edf3d1f2a94137becd95b8 /src/displayapp/screens/PineTimeStyle.cpp | |
| parent | 69e4ab6be101e7993035b56db75f5c32eda713ac (diff) | |
| parent | ef44b763d94cc6ff1be6f75ff3e638d7d356e99e (diff) | |
Merge branch 'evergreen22-airplane-mode' into develop
Diffstat (limited to 'src/displayapp/screens/PineTimeStyle.cpp')
| -rw-r--r-- | src/displayapp/screens/PineTimeStyle.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp index 7ce0bc0..44bf47a 100644 --- a/src/displayapp/screens/PineTimeStyle.cpp +++ b/src/displayapp/screens/PineTimeStyle.cpp @@ -42,6 +42,13 @@ namespace { auto* screen = static_cast<PineTimeStyle*>(obj->user_data); screen->UpdateSelected(obj, event); } + + bool IsBleIconVisible(bool isRadioEnabled, bool isConnected) { + if(!isRadioEnabled) { + return true; + } + return isConnected; + } } PineTimeStyle::PineTimeStyle(DisplayApp* app, @@ -336,11 +343,13 @@ void PineTimeStyle::SetBatteryIcon() { lv_label_set_text_static(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); } + void PineTimeStyle::AlignIcons() { - if (notificationState.Get() && bleState.Get()) { + bool isBleIconVisible = IsBleIconVisible(bleRadioEnabled.Get(), bleState.Get()); + if (notificationState.Get() && isBleIconVisible) { lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 8, 25); lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, -8, 25); - } else if (notificationState.Get() && !bleState.Get()) { + } else if (notificationState.Get() && !isBleIconVisible) { lv_obj_align(notificationIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); } else { lv_obj_align(bleIcon, sidebar, LV_ALIGN_IN_TOP_MID, 0, 25); @@ -364,8 +373,9 @@ void PineTimeStyle::Refresh() { } bleState = bleController.IsConnected(); - if (bleState.IsUpdated()) { - lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get())); + bleRadioEnabled = bleController.IsRadioEnabled(); + if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) { + lv_label_set_text(bleIcon, BleIcon::GetIcon(bleRadioEnabled.Get(), bleState.Get())); AlignIcons(); } |
