#374,解决,手电筒切换时会有掉帧情况bug
authorluozheng <1732036298@qq.com>
Mon, 23 Sep 2024 03:43:59 +0000 (11:43 +0800)
committerluozheng <1732036298@qq.com>
Mon, 23 Sep 2024 03:43:59 +0000 (11:43 +0800)
code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightModel.cpp
code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/flashlight/src/FlashlightView.cpp

index 6468286..801c6c8 100644 (file)
@@ -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);
+        }
     }
 
     /*
index dfef7f2..1fa3fb3 100644 (file)
@@ -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
index 49ca0a2..1099bf1 100644 (file)
@@ -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();