From 4e5400f00baa397982d98dc7e1967411bc4c7aff Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3?= <1732036298@qq.com> Date: Sun, 3 Nov 2024 08:16:14 +0000 Subject: [PATCH] Merge #1327 into sdk602patch0911 from refs/changes/1327/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 罗正 * refs/changes/1327/head: (13 commits squashed) - ScreenTurnOn与ScreenTurnOff配套使用优化 - 解决蓝牙耳机按键退出有概率不取消常亮屏 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 时间同步算法采用海思原本代码 - 喝水提醒,久坐提醒,运动识别弹窗时间保存采用队列方式 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 表盘:增加电量字符串数据类型 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 - 手电筒界面亮度设置优化 - Merge branch 'sdk602patch0911' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0911 Signed-off-by: 罗正 <1732036298@qq.com> Reviewed-by: Caisking <3449750381@qq.com> Reviewed-by: 罗正 <1732036298@qq.com> Reviewed-by: aliyun8003852482 <1224667075@qq.com> Reviewed-by: snickersun@163.com Reviewed-by: aliyun6865282430 <1624952103@qq.com> Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/1327 --- .../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