From 8987dd0fd4dd6b2a4206167d75f8e931cfdc222a Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Thu, 1 Aug 2024 10:39:41 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E6=94=B9=E4=B8=8B=E6=8B=89=E7=95=8C?= =?utf8?q?=E9=9D=A2=E7=94=B5=E6=B1=A0=E5=88=B7=E6=96=B0=E9=97=AE=E9=A2=98?= =?utf8?q?=EF=BC=8C=E4=B8=8D=E7=94=A8=E5=9B=BE=E7=89=87=E8=AE=BE=E7=BD=AE?= =?utf8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/main/src/MainPresenterSample.cpp | 33 ++++++++++--------- .../nativeui/main/src/PullUpDownView.cpp | 10 +++--- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp index 2e7120152..37d8ae878 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp @@ -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); diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp index 8478313c2..1df4fe495 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/PullUpDownView.cpp @@ -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); -- 2.17.1