From 261f500f41a714dfd80d0e5428df0dd3755e3358 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E7=BD=97=E6=AD=A3yun?= <1732036298@qq.com> Date: Fri, 19 Jan 2024 18:06:22 +0800 Subject: [PATCH] =?utf8?q?=E5=88=87=E6=8D=A2=E7=95=8C=E9=9D=A2=E6=8C=89?= =?utf8?q?=E9=92=AE=E8=AE=BE=E7=BD=AE=E9=80=8F=E6=98=8E=E5=BA=A6=E4=B8=BA0?= =?utf8?q?=EF=BC=8C=E7=9B=AE=E7=9A=84=E6=98=AF=E8=A7=A3=E5=86=B3=E9=95=BF?= =?utf8?q?=E6=8C=89=E5=88=87=E6=8D=A2=E8=A1=A8=E7=9B=98=E6=97=B6=E4=B8=BB?= =?utf8?q?=E7=95=8C=E9=9D=A2=E5=8F=AF=E8=A7=81=EF=BC=8C=E5=8E=9F=E5=85=88?= =?utf8?q?=E6=98=AF=E5=88=87=E6=8D=A2=E6=98=AF=E8=A1=A8=E7=9B=98=E4=BC=9A?= =?utf8?q?=E9=BB=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/dial/src/Digital_clockView.cpp | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp index dd110ea84..eaf01b49e 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp @@ -366,7 +366,7 @@ namespace OHOS timeLable->SetViewId("label1"); // Set style timeLable->SetStyle(STYLE_TEXT_FONT, digitsize); - // Set additional property + timeLable->SetText(stringtime.c_str()); timeLable->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); timeLable->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); @@ -425,7 +425,7 @@ namespace OHOS sweepClock1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); sweepClock1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00); - // Set additional property + sweepClock1_->SetWorkMode(UISweepClock::WorkMode::NORMAL); Image *sweepClock1HourImage = new Image(); std::string HourImagePath = std::string(handspath) + "hour.bin"; @@ -552,7 +552,7 @@ namespace OHOS weekLable->SetViewId("label2"); // Set style weekLable->SetStyle(STYLE_TEXT_FONT, fontsize); - // Set additional property + cJSON *weekformat = cJSON_GetObjectItem(displayformat, "weekformat"); std ::string weekStr; if (weekformat != nullptr && cJSON_IsArray(weekformat)) @@ -634,7 +634,7 @@ namespace OHOS batteryLable->SetViewId("label3"); // Set style batteryLable->SetStyle(STYLE_TEXT_FONT, fontsize); - // Set additional property + batteryLable->SetText((std::to_string(value) + "%").c_str()); batteryLable->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); batteryLable->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); @@ -662,17 +662,16 @@ namespace OHOS { changebutton = new UIButton(); } - changebutton->SetPosition(0, 0); // widget's left position and top position - changebutton->Resize(466, 466); // widget's width and height - changebutton->SetViewId(CHANGEBUTTON); // Set style + changebutton->SetPosition(0, 0); + changebutton->Resize(466, 466); + changebutton->SetViewId(CHANGEBUTTON); changebutton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); changebutton->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + changebutton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED); + changebutton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED); + changebutton->SetStyleForState(STYLE_BORDER_COLOR, 0xffffffff, UIButton::PRESSED); + changebutton->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED); - // Set additional property - changebutton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED); - changebutton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - - // Add the CallBack about events UIView::OnLongPressListener *buttonLongPress = static_cast(MainPresenterSample::GetInstance()); changebutton->SetOnLongPressListener(buttonLongPress); // Add to rootView -- 2.17.1