修改下拉界面电池刷新问题,不用图片设置了 621/4 621/head 626/target/1
authorluozheng <1732036298@qq.com>
Thu, 1 Aug 2024 02:39:41 +0000 (10:39 +0800)
committerluozheng <1732036298@qq.com>
Thu, 1 Aug 2024 02:39:41 +0000 (10:39 +0800)
code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp

index 2e71201..37d8ae8 100644 (file)
@@ -488,26 +488,27 @@ namespace OHOS
         float voltage = 0.0F;
         uint8_t value = 0;
         value = battery_get_voltage(&voltage);
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "battery_get_voltage = %d",value);
         // 更新电池信息
-        const char *progressImages[3] = {
-            "/user/res/Battery/Battery_Limit.bin", // 低电量图片路径
-            "/user/res/Battery/Battery_Save.bin",  // 中等电量图片路径
-            "/user/res/Battery/Battery_Normal.bin" // 正常电量图片路径
-        };
-        const char *progressImageSrc = nullptr;
-        for (int i = 0; i < 3; i++)
-        {
-            if (value <= (i + 1) * 10)
-            {
-                progressImageSrc = progressImages[i];
-                // PRINT("Update progressImageSrc!\n");
-                break;
-            }
-        }
+        // const char *progressImages[3] = {
+        //     "/user/res/Battery/Battery_Limit.bin", // 低电量图片路径
+        //     "/user/res/Battery/Battery_Save.bin",  // 中等电量图片路径
+        //     "/user/res/Battery/Battery_Normal.bin" // 正常电量图片路径
+        // };
+        // const char *progressImageSrc = nullptr;
+        // for (int i = 0; i < 3; i++)
+        // {
+        //     if (value <= (i + 1) * 10)
+        //     {
+        //         progressImageSrc = progressImages[i];
+        //         // PRINT("Update progressImageSrc!\n");
+        //         break;
+        //     }
+        // }
 
         if (PullUpDownView::GetInstance() != nullptr)
         {
-            PullUpDownView::GetInstance()->GetProgress()->SetImage(progressImageSrc, progressImageSrc);
+            // PullUpDownView::GetInstance()->GetProgress()->SetImage(progressImageSrc, progressImageSrc);
             PullUpDownView::GetInstance()->GetProgress()->SetValue(value);
             PullUpDownView::GetInstance()->GetDateLabel()->SetText(dateStr);
             PullUpDownView::GetInstance()->GetTimeLabel()->SetText(timeStr);
index 8478313..1df4fe4 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-26 18:14:24
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-31 15:30:14
+ * @LastEditTime: 2024-07-31 20:53:09
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp
  */
 
@@ -602,10 +602,10 @@ namespace OHOS
         progress->SetPosition(206, 180, PROGRESS_WIDTH, PROGRESS_HEIGHT);
         progress->SetValidHeight(PROGRESS_HEIGHT);
         progress->SetValidWidth(PROGRESS_WIDTH);
-
-        // progress->SetValue(value);
-        const char *progressImageSrc = "/user/res/Battery/Battery_Normal.bin";
-        progress->SetImage(progressImageSrc, progressImageSrc);
+        progress->SetValue(20);
+        // progress->SetRange(100,0);
+        // const char *progressImageSrc = "/user/res/Battery/Battery_Normal.bin";
+        // progress->SetImage(progressImageSrc, progressImageSrc);
         progress->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0x00);
         progress->SetBackgroundStyle(STYLE_TEXT_COLOR, 0xff000000);
         progress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);