From: luozheng <1732036298@qq.com> Date: Thu, 1 Aug 2024 02:39:41 +0000 (+0800) Subject: 修改下拉界面电池刷新问题,不用图片设置了 X-Git-Tag: release_V1.2.70_20241020_135402~721^2 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F621%2F4;p=mirrors%2FFD230.git 修改下拉界面电池刷新问题,不用图片设置了 --- 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);