From: luozheng <1732036298@qq.com> Date: Mon, 23 Sep 2024 03:43:59 +0000 (+0800) Subject: #374,解决,手电筒切换时会有掉帧情况bug X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=85a7a7502507ee61a0f82af9227b416373b785e4;p=mirrors%2FFD230.git #374,解决,手电筒切换时会有掉帧情况bug --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightModel.cpp index 6468286ab..801c6c885 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightModel.cpp @@ -69,7 +69,10 @@ namespace OHOS static void FlashlightTimerCallbackProc(int data) { switch_flag = !(switch_flag); - FlashlightPresenter::GetInstance()->UpdateViewMainScreenFlashing(switch_flag); + if(FlashlightPresenter::GetInstance()) + { + FlashlightPresenter::GetInstance()->UpdateViewMainScreenFlashing(switch_flag); + } } /* 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 dfef7f285..1fa3fb3fa 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-06-07 17:56:29 + * @LastEditTime: 2024-09-23 11:13:30 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/src/FlashlightPresenter.cpp */ @@ -223,6 +223,9 @@ namespace OHOS void FlashlightPresenter::UpdateViewMainScreenFlashing(bool flag) { - view_->UpdateViewMainScreenFlashing(flag); + if(view_) + { + view_->UpdateViewMainScreenFlashing(flag); + } } } \ No newline at end of file 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 49ca0a24b..1099bf1b3 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-09-13 18:59:42 + * @LastEditTime: 2024-09-23 11:15:33 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/flashligh/src/FlashlightView.cpp */ #include "flashlight/include/FlashlightView.h" @@ -11,7 +11,8 @@ #include "UiConfig.h" #include "custom_utils.h" #include "common/image_cache_manager.h" - +#include "ConfigModel.h" +#include "flashlight/include/FlashlightModel.h" namespace OHOS { @@ -145,6 +146,7 @@ namespace OHOS { if(nullptr != GroupMain_) { + uapi_setScreenBrightness(ConfigModel::GetInstance()->GetBrightness()); GroupMain_->RemoveAll(); delete GroupMain_; GroupMain_ = nullptr; @@ -202,11 +204,13 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[@CHENG][%d]:%d", __LINE__, flag); if(true == flag) { - GroupMain_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + // GroupMain_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); + uapi_setScreenBrightness(127);//50% } else { - GroupMain_->SetStyle(STYLE_BACKGROUND_COLOR, presenter_->GetColorValue()); + // GroupMain_->SetStyle(STYLE_BACKGROUND_COLOR, presenter_->GetColorValue()); + uapi_setScreenBrightness(0xff);//100% } Draw();