From 7d11486bd5fe86ab85e1835ffe3fcf75e621cbee Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sun, 3 Nov 2024 15:59:09 +0800 Subject: [PATCH] =?utf8?q?=E6=89=8B=E7=94=B5=E7=AD=92=E7=95=8C=E9=9D=A2?= =?utf8?q?=E4=BA=AE=E5=BA=A6=E8=AE=BE=E7=BD=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../wearable/fd230app/nativelauncher/include/UiConfig.h | 1 + .../nativeui/flashlight/src/FlashlightPresenter.cpp | 5 ++++- .../fd230app/nativeui/flashlight/src/FlashlightView.cpp | 7 +++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h index 0f7e5b822..b8afb16c1 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h @@ -79,6 +79,7 @@ namespace OHOS #define MIN_BRIGHTNESS 51 /*最低亮度*/ #define MAX_BRIGHTNESS 255 /*最高亮度*/ +#define MAX_BRIGHTNESS_HALF 127 /*最高亮度的一半*/ static constexpr const char *CARD_CONFIG_PATH = "/user/cardconfig.bin"; diff --git a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp index 3b3394d78..956420681 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-10 17:32:38 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-23 18:16:39 + * @LastEditTime: 2024-11-03 15:58:20 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/src/FlashlightPresenter.cpp */ @@ -49,6 +49,7 @@ namespace OHOS { Presenter::OnStart(); + uapi_setScreenBrightness(MAX_BRIGHTNESS); FlashlightModel::GetInstance().FlashlightStartTimer(); ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } @@ -67,6 +68,7 @@ namespace OHOS { Presenter::OnStop(); + uapi_setScreenBrightness(ConfigModel::GetInstance()->GetBrightness());//退出APP将亮度恢复到ConfigModel中设置的亮度值 ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); FlashlightModel::GetInstance().FlashlightStopTimer(); FlashlightModel::GetInstance().SaveSettingInfo(); @@ -196,6 +198,7 @@ namespace OHOS if(0 == view.GetCurrentPage()) { + uapi_setScreenBrightness(MAX_BRIGHTNESS);//恢复最高亮度 FlashlightModel::GetInstance().FlashlightStartTimer(); ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp index 64eb42422..fe82a4831 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-10 17:32:08 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-10-03 19:51:39 + * @LastEditTime: 2024-11-03 15:50:47 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/src/FlashlightView.cpp */ #include "flashlight/include/FlashlightView.h" @@ -147,7 +147,6 @@ namespace OHOS { if(nullptr != GroupMain_) { - uapi_setScreenBrightness(ConfigModel::GetInstance()->GetBrightness()); GroupMain_->RemoveAll(); delete GroupMain_; GroupMain_ = nullptr; @@ -206,12 +205,12 @@ namespace OHOS if(true == flag) { // GroupMain_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); - uapi_setScreenBrightness(127);//50% + uapi_setScreenBrightness(MAX_BRIGHTNESS_HALF);//50% } else { // GroupMain_->SetStyle(STYLE_BACKGROUND_COLOR, presenter_->GetColorValue()); - uapi_setScreenBrightness(0xff);//100% + uapi_setScreenBrightness(MAX_BRIGHTNESS);//100% } Draw(); -- 2.17.1