summaryrefslogtreecommitdiff
path: root/src/displayapp/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/displayapp/screens')
-rw-r--r--src/displayapp/screens/FlashLight.cpp16
-rw-r--r--src/displayapp/screens/FlashLight.h11
-rw-r--r--src/displayapp/screens/settings/QuickSettings.cpp13
3 files changed, 26 insertions, 14 deletions
diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp
index 3047cf8..086b694 100644
--- a/src/displayapp/screens/FlashLight.cpp
+++ b/src/displayapp/screens/FlashLight.cpp
@@ -15,10 +15,12 @@ void FlashLight::EventHandler(lv_obj_t* obj, lv_event_t event) {
FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app,
System::SystemTask& systemTask,
- Controllers::BrightnessController& brightnessController)
+ Controllers::BrightnessController& brightnessController,
+ lv_color_t color)
: Screen(app),
systemTask {systemTask},
- brightnessController {brightnessController}
+ brightnessController {brightnessController},
+ color {color}
{
brightnessLevel = brightnessController.Level();
@@ -75,21 +77,21 @@ void FlashLight::Update(bool on, Controllers::BrightnessController::Levels level
isOn = on;
if (isOn) {
brightnessController.Backup();
- lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
for (auto & i : indicators) {
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
- lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, color);
lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY);
}
} else {
brightnessController.Restore();
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
- lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, color);
for (auto & i : indicators) {
- lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
lv_obj_set_style_local_bg_color(i, LV_OBJ_PART_MAIN, LV_STATE_DISABLED, LV_COLOR_BLACK);
- lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE);
+ lv_obj_set_style_local_border_color(i, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, color);
}
}
}
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;
};
}
diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp
index 97faaa7..f43f8c8 100644
--- a/src/displayapp/screens/settings/QuickSettings.cpp
+++ b/src/displayapp/screens/settings/QuickSettings.cpp
@@ -128,11 +128,14 @@ void QuickSettings::UpdateScreen() {
}
void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) {
- if (object == btn2 && event == LV_EVENT_CLICKED) {
-
- running = false;
- app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::Up);
-
+ if (object == btn2) {
+ if (event == LV_EVENT_CLICKED) {
+ running = false;
+ app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::Up);
+ } else if (event == LV_EVENT_LONG_PRESSED) {
+ running = false;
+ app->StartApp(Apps::FlashLightRed, DisplayApp::FullRefreshDirections::Up);
+ }
} else if (object == btn1 && event == LV_EVENT_CLICKED) {
brightness.Step();