mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 15:11:51 +02:00
Restore brightness level when closing the Flashlight application
The brightness level is stored when entering the app, and restored when closing it. Based on another fixed suggested by serosi. Co-authored-by: serosi <68392668+serosi@users.noreply.github.com>
This commit is contained in:
parent
7dbb8f54c6
commit
3b3701c1b5
|
@ -15,7 +15,7 @@ namespace {
|
|||
}
|
||||
|
||||
FlashLight::FlashLight(System::SystemTask& systemTask, Controllers::BrightnessController& brightnessController)
|
||||
: systemTask {systemTask}, brightnessController {brightnessController} {
|
||||
: systemTask {systemTask}, brightnessController {brightnessController}, backupBrightnessLevel {brightnessController.Level()} {
|
||||
|
||||
brightnessController.Set(Controllers::BrightnessController::Levels::Low);
|
||||
|
||||
|
@ -52,6 +52,7 @@ FlashLight::FlashLight(System::SystemTask& systemTask, Controllers::BrightnessCo
|
|||
FlashLight::~FlashLight() {
|
||||
lv_obj_clean(lv_scr_act());
|
||||
lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
brightnessController.Set(backupBrightnessLevel);
|
||||
systemTask.PushMessage(Pinetime::System::Messages::EnableSleeping);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Pinetime {
|
|||
Controllers::BrightnessController& brightnessController;
|
||||
|
||||
Controllers::BrightnessController::Levels brightnessLevel = Controllers::BrightnessController::Levels::High;
|
||||
|
||||
Controllers::BrightnessController::Levels backupBrightnessLevel;
|
||||
lv_obj_t* flashLight;
|
||||
lv_obj_t* backgroundAction;
|
||||
lv_obj_t* indicators[3];
|
||||
|
|
Loading…
Reference in a new issue