summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/FlashLight.h
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.h
parent513b2f2cbd83eb20602f0d6f0158a0969f981b0a (diff)
Long-press to start red flashlight, long press again to alternate with red.
Diffstat (limited to 'src/displayapp/screens/FlashLight.h')
-rw-r--r--src/displayapp/screens/FlashLight.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/displayapp/screens/FlashLight.h b/src/displayapp/screens/FlashLight.h
index 3433634..f227599 100644
--- a/src/displayapp/screens/FlashLight.h
+++ b/src/displayapp/screens/FlashLight.h
@@ -13,14 +13,20 @@ namespace Pinetime {
class FlashLight : public Screen {
public:
- FlashLight(DisplayApp* app, System::SystemTask& systemTask, Controllers::BrightnessController& brightness);
+ FlashLight(DisplayApp* app, System::SystemTask& systemTask, Controllers::BrightnessController& brightness, lv_color_t color = LV_COLOR_WHITE);
~FlashLight() override;
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
private:
inline void OnClickEvent(lv_obj_t* obj, lv_event_t event) {
- if (obj == backgroundAction && event == LV_EVENT_CLICKED) {
+ if (obj == backgroundAction) {
+ if (event == LV_EVENT_CLICKED) {
+ } else if (event == LV_EVENT_LONG_PRESSED) {
+ color = (color.full == LV_COLOR_WHITE.full) ? LV_COLOR_RED : LV_COLOR_WHITE;
+ } else {
+ return;
+ }
Update(!isOn, brightnessLevel);
}
}
@@ -35,6 +41,7 @@ namespace Pinetime {
lv_obj_t* flashLight;
lv_obj_t* backgroundAction;
lv_obj_t* indicators[3];
+ lv_color_t color;
bool isOn = false;
};
}