diff options
Diffstat (limited to 'src/displayapp/screens/FlashLight.cpp')
| -rw-r--r-- | src/displayapp/screens/FlashLight.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp index 9110562..3047cf8 100644 --- a/src/displayapp/screens/FlashLight.cpp +++ b/src/displayapp/screens/FlashLight.cpp @@ -5,14 +5,14 @@ using namespace Pinetime::Applications::Screens; namespace { - void event_handler(lv_obj_t* obj, lv_event_t event) { - auto* screen = static_cast<FlashLight*>(obj->user_data); - screen->OnClickEvent(obj, event); - } - typedef Pinetime::Controllers::BrightnessController::Levels Levels; } +void FlashLight::EventHandler(lv_obj_t* obj, lv_event_t event) { + auto* screen = static_cast<FlashLight*>(obj->user_data); + screen->OnClickEvent(obj, event); +} + FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app, System::SystemTask& systemTask, Controllers::BrightnessController& brightnessController) @@ -47,7 +47,7 @@ FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app, lv_label_set_text_static(backgroundAction, ""); lv_obj_set_click(backgroundAction, true); backgroundAction->user_data = this; - lv_obj_set_event_cb(backgroundAction, event_handler); + lv_obj_set_event_cb(backgroundAction, EventHandler); systemTask.PushMessage(Pinetime::System::Messages::DisableSleeping); } @@ -99,12 +99,6 @@ void FlashLight::Update(bool on, Controllers::BrightnessController::Levels level } } -void FlashLight::OnClickEvent(lv_obj_t* obj, lv_event_t event) { - if (obj == backgroundAction && event == LV_EVENT_CLICKED) { - Update(!isOn, brightnessLevel); - } -} - bool FlashLight::OnTouchEvent(Pinetime::Applications::TouchEvents event) { using namespace Pinetime::Controllers; |
