From 4113f3fbe70cb82d5bbc97308c4f790e8509dfd3 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Tue, 19 Dec 2023 11:24:01 +0800 Subject: [PATCH] =?utf8?q?=E5=A2=9E=E5=8A=A0=E7=94=B5=E9=87=8F=E7=99=BE?= =?utf8?q?=E5=88=86=E6=AF=94=EF=BC=8C=E6=97=A5=E6=9C=9F=EF=BC=8C=E6=98=9F?= =?utf8?q?=E6=9C=9F=E9=9D=99=E6=80=81=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/clock/src/MainClockView.cpp | 58 +++++++++++++++++-- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp index f4114b045..a02a39ced 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp @@ -69,9 +69,6 @@ static constexpr uint16_t HOUR_POINT_CENTER_Y = 146; - - - MainClockView::MainClockView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainClockView::MainClockView"); @@ -88,6 +85,14 @@ MainClockView::~MainClockView() clockAnimator = nullptr; } mainSweepClock->RemoveAll(); + + delete batteryLabel; + batteryLabel = nullptr; + delete weekLabel; + weekLabel = nullptr; + delete dataLabel; + dataLabel = nullptr; + #if 0 delete curFace; curFace = nullptr; @@ -206,7 +211,7 @@ bool MainClockView::InitLabelView(void) weekLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_TEXT_SIZE); weekLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); #endif -#if 1 +#if 0 printf("lable init\n"); batteryLabel = new UILabel(); if (batteryLabel == nullptr) { @@ -368,7 +373,7 @@ bool MainClockView::InitSweepClock(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "curFace LoadClockImage CLOCK_MAIN_FACE_IMAGE fail"); return false; } - InitLabelView(); + //InitLabelView(); #if 0 if (InitLabelView() == false) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabelView() fail"); @@ -401,6 +406,49 @@ bool MainClockView::InitSweepClock(void) } #endif InitHandView(); + /**************************************************************/ + printf("lable init\n"); + batteryLabel = new UILabel(); + if (batteryLabel == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "batteryLabel new fail"); + return false; + } + batteryLabel->SetPosition(228, 52); // widget's left position and top position + batteryLabel->Resize(66, 33); + batteryLabel->SetText("2%"); + batteryLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + batteryLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28); + batteryLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + //mainSweepClock->Add(batteryLabel); + if (dataLabel == nullptr) { + dataLabel = new UILabel(); + } + dataLabel->SetPosition(177, 358); // widget's left position and top position + dataLabel->Resize(200, 60); // widget's width and height + dataLabel->SetViewId("data");// Set style + dataLabel->SetStyle(STYLE_TEXT_FONT, 30); + dataLabel->SetStyle(STYLE_LINE_HEIGHT, 30); + dataLabel->SetText("12月22号"); + dataLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + dataLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + dataLabel->SetRollSpeed(0); + dataLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + //mainSweepClock->Add(dataLabel); + if (weekLabel == nullptr) { + weekLabel = new UILabel(); + } + weekLabel->SetPosition(194, 395); // widget's left position and top position + //weekLabel->Resize(200, 60); // widget's width and height + weekLabel->SetViewId("weekday");// Set style + weekLabel->SetStyle(STYLE_TEXT_FONT, 30); + weekLabel->SetStyle(STYLE_LINE_HEIGHT, 30); + weekLabel->SetText("星期五"); + weekLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + weekLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + weekLabel->SetRollSpeed(0); + weekLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); + /**************************************************************/ + //InitLabelView(); #if 0 weekDay = new UIImageView(); if (weekDay == nullptr) { -- 2.17.1