summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/FlashLight.cpp
diff options
context:
space:
mode:
authorMichele Bini <michele.bini@gmail.com>2022-04-21 10:41:24 (GMT)
committerMichele Bini <michele.bini@gmail.com>2022-04-21 11:29:21 (GMT)
commit8ea7d77d1b1f476c890bf04b44ad9e2c858a4d1c (patch)
treee4a2a8ffd9f71a7180dcc59d62414c9ba1356053 /src/displayapp/screens/FlashLight.cpp
parent513b2f2cbd83eb20602f0d6f0158a0969f981b0a (diff)
Long-press to start red flashlight, long press again to alternate with red.
Diffstat (limited to 'src/displayapp/screens/FlashLight.cpp')
-rw-r--r--src/displayapp/screens/FlashLight.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp
index 3047cf8..086b694 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -15,10 +15,12 @@ void FlashLight::EventHandler(lv_obj_t* obj, lv_event_t event) {
FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app,
System::SystemTask& systemTask,
- Controllers::BrightnessController& brightnessController)
+ Controllers::BrightnessController& brightnessController,
+ lv_color_t color)
: Screen(app),
systemTask {systemTask},
- brightnessController {brightnessController}
+ brightnessController {brightnessController},
+ color {color}
{
brightnessLevel = brightnessController.Level();
@@ -75,21 +77,21 @@ void FlashLight::Update(bool on, Controllers::BrightnessController::Levels level
isOn = on;
if (isOn) {
brightnessController.Backup();
- lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
for (auto & i : indicators) {
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, color);
lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
}
} else {
brightnessController.Restore();
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
- lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color);
for (auto & i : indicators) {
- lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_BLACK);
- lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
}
}
}