summaryrefslogtreecommitdiff
path: root/src/displayapp/screens/FlashLight.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens/FlashLight.h')
-rw-r--r--src/displayapp/screens/FlashLight.h24
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;
};
}