aboutsummaryrefslogtreecommitdiffstats
path: root/src/displayapp/screens/PineTimeStyle.cpp
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2022-02-20 15:40:49 +0100
committerJean-François Milants <jf@codingfield.com>2022-02-20 15:40:49 +0100
commitef44b763d94cc6ff1be6f75ff3e638d7d356e99e (patch)
treea10a4068c592f13057edf3d1f2a94137becd95b8 /src/displayapp/screens/PineTimeStyle.cpp
parent40cdb547727d99ff140a029ae30980001e4a68f6 (diff)
Merge branch 'airplane-mode' of https://github.com/evergreen22/InfiniTime into evergreen22-airplane-mode
Apply a few changes that were requested in the PR during the review. # Conflicts: # src/CMakeLists.txt # src/displayapp/Apps.h # src/displayapp/DisplayApp.cpp # src/displayapp/Messages.h # src/displayapp/screens/settings/Settings.cpp
Diffstat (limited to 'src/displayapp/screens/PineTimeStyle.cpp')
-rw-r--r--src/displayapp/screens/PineTimeStyle.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/displayapp/screens/PineTimeStyle.cpp b/src/displayapp/screens/PineTimeStyle.cpp
index f1f7f922..44bf47a4 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() != Pinetime::Controllers::Ble::ConnectStates::Disconnected) {
+ 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() == Pinetime::Controllers::Ble::ConnectStates::Disconnected) {
+ } 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);
@@ -363,9 +372,10 @@ void PineTimeStyle::Refresh() {
}
}
- bleState = bleController.GetConnectState();
- if (bleState.IsUpdated()) {
- lv_label_set_text_static(bleIcon, BleIcon::GetIcon(bleState.Get()));
+ bleState = bleController.IsConnected();
+ bleRadioEnabled = bleController.IsRadioEnabled();
+ if (bleState.IsUpdated() || bleRadioEnabled.IsUpdated()) {
+ lv_label_set_text(bleIcon, BleIcon::GetIcon(bleRadioEnabled.Get(), bleState.Get()));
AlignIcons();
}