blob: 827502a73742a88916e2e9b53aaee7ae209ea5af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#pragma once
#include "displayapp/screens/Screen.h"
#include "components/brightness/BrightnessController.h"
#include "systemtask/SystemTask.h"
#include <cstdint>
#include <lvgl/lvgl.h>
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, Controllers::BrightnessController& brightness, lv_color_t color = LV_COLOR_WHITE);
~FlashLight() override;
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
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;
lv_obj_t* flashLight;
lv_obj_t* backgroundAction;
lv_obj_t* indicators[3];
lv_color_t color;
bool isOn = false;
};
}
}
}
|