From ab33f3c6d93c1bf1f3429cb4fe243c191f23f48e Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Fri, 20 Sep 2024 20:51:04 +0800 Subject: [PATCH] =?utf8?q?#782=20AIGC=E8=A1=A8=E7=9B=98=E7=94=B5=E9=87=8F?= =?utf8?q?=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/clock/src/MainClockView.cpp | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp b/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp index b940daefb..af48dce7d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp @@ -13,22 +13,23 @@ #include "MainClockView.h" #include "MainPresenterSample.h" +#include "SetDialModel.h" +#include "battery_hal.h" +#include "common/image_cache_manager.h" #include "components/ui_label.h" -#include "wearable_log.h" +#include "custom_runtime.h" +#include "main/include/PullUpDownView.h" +#include "message/include/MessageControlView.h" #include "ui_resource_image.h" -#include "common/image_cache_manager.h" -#include +#include "wearable_log.h" +#include +#include #include #include -#include #include #include +#include #include -#include "custom_runtime.h" -#include "main/include/PullUpDownView.h" -#include "battery_hal.h" -#include "message/include/MessageControlView.h" -#include "SetDialModel.h" extern uint8_t battery_get_voltage(float *voltage); #define TIMEVIEW_UP 0 @@ -371,26 +372,30 @@ namespace OHOS // 设置位置 batteryicon->SetPosition(186, 52, 100, 100); batteryiamge->SetPosition(173, 52, 100, 100); + batteryprogress->SetPosition(180, 58, 30, 18); batteryprogress->SetViewId("progress"); - batteryprogress->SetStyle(STYLE_BACKGROUND_OPA, 0xff); + batteryprogress->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); + batteryprogress->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0x00); + batterylabel->SetPosition(228, 52, 200, 60); batterylabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); // 设置图标和颜色 - switch (type) - { + switch (type) { case BATTERY_DISPLAY_BLACK: - batteryiamge->SetSrc(BLACK_BATTERY); - batterylabel->SetTextColor(Color::Black()); - batteryprogress->SetBackgroundStyle(STYLE_TEXT_COLOR, 0xff000000); - break; + batteryiamge->SetSrc(BLACK_BATTERY); + batterylabel->SetTextColor(Color::Black()); + batteryprogress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, + 0xff000000); + break; case BATTERY_DISPLAY_WHITE: - default: // 默认不做额外操作,保持白色 - batteryiamge->SetSrc(WHITE_BATTERY); - batterylabel->SetTextColor(Color::White()); - batteryprogress->SetBackgroundStyle(STYLE_TEXT_COLOR, 0xffffffff); - break; + default: + batteryiamge->SetSrc(WHITE_BATTERY); + batterylabel->SetTextColor(Color::White()); + batteryprogress->SetForegroundStyle(STYLE_BACKGROUND_COLOR, + 0xffffffff); + break; } batteryicon->SetSrc(CHAGE_BATTERY); batteryicon->SetVisible(false); // 设置不可见 @@ -521,6 +526,8 @@ namespace OHOS return; power_ = power; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryprogress power_:%d", + power_); if (batteryprogress != nullptr && batterylabel != nullptr) { batteryprogress->SetValue(power_); -- 2.17.1