From: Caisking <3449750381@qq.com> Date: Fri, 20 Sep 2024 12:51:04 +0000 (+0800) Subject: #782 AIGC表盘电量图标 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=c497a0d7d5e7cad15d69cdfe4473d9dad289a93c;p=mirrors%2FFD230.git #782 AIGC表盘电量图标 --- 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_);