diff options
| author | Michele Bini <michele.bini@gmail.com> | 2022-04-21 14:06:42 (GMT) |
|---|---|---|
| committer | Michele Bini <michele.bini@gmail.com> | 2022-04-21 14:06:42 (GMT) |
| commit | 3744e655fa94cc2efece15c3196cf8b398354ca2 (patch) | |
| tree | 1040ff59e6f06fb901ba621856e28957c0b36589 /src/displayapp/screens/FlashLight.h | |
| parent | 9f062635af3548425102b976e26ebbdfa998d670 (diff) | |
| parent | 8ea7d77d1b1f476c890bf04b44ad9e2c858a4d1c (diff) | |
Merge branch 'rev22-develop' into edge
Diffstat (limited to 'src/displayapp/screens/FlashLight.h')
| -rw-r--r-- | src/displayapp/screens/FlashLight.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/displayapp/screens/FlashLight.h b/src/displayapp/screens/FlashLight.h index 8021197..827502a 100644 --- a/src/displayapp/screens/FlashLight.h +++ b/src/displayapp/screens/FlashLight.h @@ -11,16 +11,35 @@ namespace Pinetime { namespace Applications { namespace Screens { + namespace FlashLightData { + namespace { + typedef Pinetime::Controllers::BrightnessController::Levels Levels; + } + extern Levels brightnessLevel; + } + class FlashLight : public Screen { public: - FlashLight(DisplayApp* app, System::SystemTask& systemTask, Pinetime::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; - void OnClickEvent(lv_obj_t* obj, lv_event_t event); private: void Update(bool on, Pinetime::Controllers::BrightnessController::Levels level); + inline void OnClickEvent(lv_obj_t* obj, lv_event_t event) { + 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; + } + using namespace FlashLightData; + Update(!isOn, brightnessLevel); + } + } + static void EventHandler(lv_obj_t* obj, lv_event_t event); Pinetime::System::SystemTask& systemTask; Controllers::BrightnessController& brightnessController; @@ -28,6 +47,7 @@ namespace Pinetime { lv_obj_t* flashLight; lv_obj_t* backgroundAction; lv_obj_t* indicators[3]; + lv_color_t color; bool isOn = false; }; } |
