From d815e5cdb6bd63a3f59a7a63a590090a0ed21091 Mon Sep 17 00:00:00 2001 From: Caisking Date: Wed, 9 Jul 2025 17:47:41 +0800 Subject: [PATCH] =?utf8?q?=E5=8F=96=E6=B6=88w9=E5=92=8Cn9=E7=9A=84?= =?utf8?q?=E9=BB=98=E8=AE=A4=E8=A1=A8=E7=9B=98=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../fd230app/nativeui/clock/src/MainClockView.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 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 183b33d65..9a67851ce 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/clock/src/MainClockView.cpp @@ -401,14 +401,12 @@ namespace OHOS */ bool MainClockView::InitBatteryView(BatteryDisplayType type) { - #if !(defined(BOARD_W9) || defined(BOARD_N9))// N9和W9需要显示电池 // 不显示电池 icon if (type == BATTERY_DISPLAY_NONE) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "no show battery"); return false; } - #endif // 创建电池框图像 batteryiamge = new UIImageView(); @@ -584,13 +582,11 @@ namespace OHOS struct tm local_time = {0}; time_t seconds = time(nullptr); - // Get local time if (localtime_r(&seconds, &local_time) == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "get localtime error!"); return; } - // Extract hour and minute uint8_t hour = local_time.tm_hour % HOURS_IN_DAY; uint8_t minute = local_time.tm_min % MINUTES_IN_HOUR; char timebuf[64] = {0}; @@ -610,11 +606,10 @@ namespace OHOS sprintf_s(timebuf, sizeof(timebuf), "%02d:%02d", hour, minute); #endif - // Update display labels if (timerlabel != nullptr) timerlabel->SetText(timebuf); - // Update date and week day + std::string weekStr = Cnweekdays[local_time.tm_wday]; std::string dateStr = std::to_string(local_time.tm_mon + 1) + "月" + std::to_string(local_time.tm_mday) + "号 " + weekStr; @@ -622,11 +617,11 @@ namespace OHOS if (datelabel != nullptr) datelabel->SetText(dateStr.c_str()); - // Update battery status - #if !(defined(BOARD_W9) || defined(BOARD_N9))// N9和W9需要显示电池 + + //电量显示配置 if (batterySetting == BATTERY_DISPLAY_NONE) return; - #endif + UpdateBatteryColor(); -- 2.17.1