From: luozheng <1732036298@qq.com> Date: Sun, 3 Nov 2024 07:59:09 +0000 (+0800) Subject: 手电筒界面亮度设置优化 X-Git-Tag: fd230_release_V1.3.102~29^2~77 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=7d11486bd5fe86ab85e1835ffe3fcf75e621cbee;p=mirrors%2FFD230.git 手电筒界面亮度设置优化 --- 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();