From fe899e5ecbb590d2a4fdb40c5c9636772011078c Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Fri, 22 Nov 2024 16:53:41 +0800 Subject: [PATCH] =?utf8?q?=E7=B3=BB=E7=BB=9F=EF=BC=9A=E4=BC=98=E5=8C=96?= =?utf8?q?=E9=83=A8=E5=88=86UI=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/assistant/src/AssistantAnswerView.cpp | 6 ++++-- .../nativeui/assistant/src/AssistantView.cpp | 2 +- .../nativeui/heart_blood/BloodCardView.cpp | 4 ++-- .../nativeui/heart_blood/CheckAbnormalView.cpp | 3 ++- .../nativeui/heart_blood/CheckInvalidView.cpp | 4 ++-- .../nativeui/heartrate/src/HeartNoteView.cpp | 2 +- .../nativeui/message/src/MessageLackView.cpp | 2 +- .../fd230app/nativeui/message/src/MessageView.cpp | 4 ++-- .../fd230app/nativeui/saveele/src/SaveBatView.cpp | 13 ++++++++++--- .../nativeui/sleepmode/src/SleepModeView.cpp | 14 +++++++++----- .../training_card/src/TrainingDetailView.cpp | 6 +++--- 11 files changed, 37 insertions(+), 23 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantAnswerView.cpp b/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantAnswerView.cpp index 4c1006955..64844077c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantAnswerView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantAnswerView.cpp @@ -286,9 +286,11 @@ void AssistantAnswerView::InitNoteLabel() { notelabel->Resize(380, 60); notelabel->SetViewId("notelabel"); notelabel->SetStyle(STYLE_TEXT_FONT, 30); - //TODO:多国语言 + // TODO:多国语言 notelabel->SetTextId(STR_CALLSOMEONE); - notelabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); + // notelabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); + notelabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + notelabel->SetRollSpeed(70); notelabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); notelabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantView.cpp b/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantView.cpp index 0eb1685a7..36798423d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/assistant/src/AssistantView.cpp @@ -87,7 +87,7 @@ void AssistantView::InitView() { AssistantScrollView[ASSISTANT_MAIN_VIEW]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); //初始化label TODO::多国语言 - InitLabelExt(noteLabel, 53, 339, 360, 35, "label",STR_WAKE_VOIVE, DEFAULT_VECTOR_FONT_FILENAME_EN, 30); + InitRollLabel(noteLabel, 53, 339, 360, 35, "label",STR_WAKE_VOIVE, DEFAULT_VECTOR_FONT_FILENAME_EN, 30); //初始化button InitButton(wakeButton, 128, 91, 210, 210, WAKE_ASSISTANT); wakeButton->SetImageSrc(WAKE_IMAGE, WAKE_IMAGE); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/BloodCardView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/BloodCardView.cpp index d10167b33..9b26a2dbb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/BloodCardView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/BloodCardView.cpp @@ -101,11 +101,11 @@ namespace OHOS bool BloodCardView::InitLable() { /*初始化title*/ - InitLabelExt(titleLabel, 83, 50, 300, 35, "title", STR_BLOOD, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitRollLabel(titleLabel, 83, 50, 300, 35, "title", STR_BLOOD, DEFAULT_VECTOR_FONT_FILENAME, 30); /*初始化血氧值label*/ InitUILabel(bloodLabel, 83, 22, 300, 300, "bloodtext", "--", DEFAULT_VECTOR_FONT_FILENAME, 120); /*初始化检测时间*/ - InitLabelExt(timeLabel, 53, 260, 360, 35, "time", STR_CHECKNO, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitRollLabel(timeLabel, 53, 260, 360, 35, "time", STR_CHECKNO, DEFAULT_VECTOR_FONT_FILENAME, 30); // 设置来回滚动属性 timeLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); timeLabel->SetRollSpeed(70); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalView.cpp index 9375af66b..8f4204037 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalView.cpp @@ -74,7 +74,8 @@ namespace OHOS bool CheckAbnormalView::InitLable() { /*初始化title*/ - InitLabelExt(titleLabel, 83, 50, 300, 35, "title", STR_CHECKERROR, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitRollLabel(titleLabel, 83, 50, 300, 35, "title", STR_CHECKERROR, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(noteLabel, 53, 230, 360, 70, "time", STR_PWUWC, DEFAULT_VECTOR_FONT_FILENAME, 30); // 设置来回滚动属性 noteLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.cpp index 51a1030d2..ff547f832 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.cpp @@ -122,8 +122,8 @@ namespace OHOS bool CheckInvalidView::InitLable() { /*初始化title*/ - InitLabelExt(titleLabel, 83, 50, 300, 35, "title", STR_CHECKEWARN, DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabelExt(remindLabel, 53, 270, 360, 70, "remindLabel", STR_HEARTNOTE, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitRollLabel(titleLabel, 83, 50, 300, 35, "title", STR_CHECKEWARN, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitRollLabel(remindLabel, 53, 270, 360, 70, "remindLabel", STR_HEARTNOTE, DEFAULT_VECTOR_FONT_FILENAME, 30); // 设置来回滚动属性 InitLabelExt(noteLabel, 53, 230, 360, 70, "time", STR_HEARTNOTE, DEFAULT_VECTOR_FONT_FILENAME, 30); noteLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartNoteView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartNoteView.cpp index d832a5e02..37ae1a863 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartNoteView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartNoteView.cpp @@ -79,7 +79,7 @@ UIScrollView *HeartNoteView::CreateHeartNoteView(void) { InitImageView(noteimage, 193, 120, 80, 80, "image", ICON_PATH_NOTE); /*初始化title*/ - InitLabelExt(titleLabel, 83, 50, 300, 35, "title", STR_CHECKERROR, + InitRollLabel(titleLabel, 83, 50, 300, 35, "title", STR_CHECKERROR, DEFAULT_VECTOR_FONT_FILENAME, 30); InitLabelExt(noteLabel, 53, 230, 360, 70, "time", STR_PWUWC, DEFAULT_VECTOR_FONT_FILENAME, 30); diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageLackView.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageLackView.cpp index 7edac4bd2..fe01bf486 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageLackView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageLackView.cpp @@ -64,7 +64,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MessageLackView::CreateUIViewGroup"); /*初始化label*/ - InitLabelExt(labelmeage, 53, 276, 360, 40, "labelMessage", STR_MESSAGENO, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitRollLabel(labelmeage, 53, 276, 360, 40, "labelMessage", STR_MESSAGENO, DEFAULT_VECTOR_FONT_FILENAME, 30); labelmeage->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); /*初始化image*/ InitImageView(imageline, 193, 30, 365, 35, "image", lineimagePath); diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp index b03fa2f2e..f3d37b23f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/message/src/MessageView.cpp @@ -115,9 +115,9 @@ void MessageView::ShowLackView() { lackView->SetViewId("lackView"); /*初始化label*/ - InitLabelExt(labeltitle, 83, 50, 300, 35, "labletitle", + InitRollLabel(labeltitle, 83, 50, 300, 35, "labletitle", STR_MESSAGE_NOTIFICATION, DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabelExt(labelmeage, 53, 276, 360, 40, "labelMessage", STR_MESSAGENO, + InitRollLabel(labelmeage, 53, 276, 360, 40, "labelMessage", STR_MESSAGENO, DEFAULT_VECTOR_FONT_FILENAME, 30); labelmeage->SetTextColor(Color::GetColorFromRGBA(0x66, 0x66, 0x66, 0xff)); /*初始化image*/ diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp index dc3e4b5e2..c6e9a2821 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp @@ -17,6 +17,8 @@ #include "wearable_log.h" #include "custom_runtime.h" +#include "ConfigModel.h" +#include "languagecode/LanguageInit.h" #define ANIMATION_TEST 0 extern "C" @@ -25,7 +27,8 @@ extern "C" void uapi_enter_power_saving_mode(void); } -std::string Cnweekday[] = {"周天", "周一", "周二", "周三", "周四", "周五", "周六"}; +std::string Cnweekday[] = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"}; +std::string Enweekday[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; static constexpr const char *WHITE_BATTERY = "/user/res/Battery/Battery_White.bin"; static constexpr const char *SAVE_BUTTON = "/user/res/Save_Ele/finger.bin"; @@ -437,8 +440,12 @@ namespace OHOS int minute = pTM.tm_min; int day = pTM.tm_mday; int month = pTM.tm_mon + 1; // 月份范围 [1, 12] - std::string weekStr = Cnweekday[pTM.tm_wday]; - + std::string weekStr; + if (ConfigModel::GetInstance()->GetLanguage() == ZH_CN) + weekStr = Cnweekday[pTM.tm_wday]; + else + weekStr = Enweekday[pTM.tm_wday]; + // 构建日期和时间字符串 std::string dateStr = (month < 10 ? "0" : "") + std::to_string(month) + "-" + diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeView.cpp index 987c5f215..d05e9daa8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeView.cpp @@ -40,7 +40,9 @@ namespace OHOS // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]", __LINE__); return; } - container_->SetPosition(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + + container_->SetWidth(Screen::GetInstance().GetWidth()); + container_->SetHeight(Screen::GetInstance().GetHeight()); container_->SetTouchable(true); container_->SetDraggable(true); @@ -123,8 +125,10 @@ namespace OHOS { ScrollView_ = new UIScrollView(); if (nullptr == ScrollView_) - return nullptr; - + return nullptr; + + ScrollView_->SetScrollBlankSize(35); + ScrollView_->SetReboundSize(50); ScrollView_->SetPosition(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); // ScrollView_->SetViewId(); ScrollView_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); @@ -189,7 +193,7 @@ namespace OHOS if (nullptr == CancelButton_) return nullptr; - CancelButton_->SetPosition(111, 320, 100, 100); + CancelButton_->SetPosition(111, PromptLabelExt_->GetY() + PromptLabelExt_->GetHeight() + 20, 100, 100); // CancelButton_->SetViewId(SCHEDULE_ViewId_DeleteCancelButton_); CancelButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); CancelButton_->SetStyle(STYLE_BACKGROUND_OPA, 25); // 10% @@ -207,7 +211,7 @@ namespace OHOS if (nullptr == OKButton_) return nullptr; - OKButton_->SetPosition(256, 320, 100, 100); + OKButton_->SetPosition(256, PromptLabelExt_->GetY() + PromptLabelExt_->GetHeight() + 20,100, 100); OKButton_->SetViewId(SLEEPMODE_ViewId_OKButton_); OKButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff); OKButton_->SetStyle(STYLE_BACKGROUND_OPA, 25); // 10% diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp index 528eca306..82f4bd1cb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingDetailView.cpp @@ -52,11 +52,11 @@ bool TrainingDetailView ::InitPage() { Add(lineimage2_); // 初始化Lable - InitLabelExt(u_milelabel, 16, 234, 220, 35, "label2", STR_RANGE_SETTING, + InitRollLabel(u_milelabel, 16, 234, 220, 35, "label2", STR_RANGE_SETTING, DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabelExt(u_stepslabel, 73, 362, 320, 35, "label3", STR_STEP_NUMBER, + InitRollLabel(u_stepslabel, 73, 362, 320, 35, "label3", STR_STEP_NUMBER, DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabelExt(u_calorielabel, 225, 235, 230, 35, "label4", STR_CALORIE_SETTING, + InitRollLabel(u_calorielabel, 225, 235, 230, 35, "label4", STR_CALORIE_SETTING, DEFAULT_VECTOR_FONT_FILENAME, 30); u_milelabel->SetTextColor(Color::Gray()); u_stepslabel->SetTextColor(Color::Gray()); -- 2.17.1