From 9c8c6f3b44d0b55ec61f2f04926ef5607c266bfb Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E8=A2=81=E6=B8=85=E6=A2=A6?= <3449750381@qq.com> Date: Wed, 8 May 2024 02:35:04 +0000 Subject: [PATCH] Merge #139 into xts_origin from refs/changes/139/head MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Code review from 袁清梦 * refs/changes/139/head: (16 commits squashed) - 替换结构体成员变量 - 更新多国语言xml以及font文件 - 更新训练Slice的多国语言配置 - Merge branch 'xts_origin' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into xts_origin - 优化设置训练频率 - 适配心率Slice多国语言 - Merge branch 'xts_origin' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into xts_origin - 多国语言支持变量适配(updateLabel) - 增加佩戴状态下的无效数控制 - 更新字体文件 - 优化心率血氧time的更新显示逻辑 - 适配血氧Slice多国语言 - Merge branch 'xts_origin' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into xts_origin - Merge branch 'xts_origin' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into xts_origin - 适配信息通知Slice多国语言 - 适配训练记录Slice多国语言 Signed-off-by: Caisking <3449750381@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/139 --- .../bloodoxygen/include/BloodBandoffView.h | 2 +- .../bloodoxygen/include/BloodCheckView.h | 9 +- .../include/BloodOxygenPresenter.h | 4 +- .../bloodoxygen/include/BloodOxygenView.h | 18 +- .../bloodoxygen/include/BloodResultView.h | 15 +- .../bloodoxygen/src/BloodBandoffView.cpp | 6 +- .../bloodoxygen/src/BloodCheckView.cpp | 13 +- .../bloodoxygen/src/BloodOxygenPresenter.cpp | 23 +- .../bloodoxygen/src/BloodOxygenView.cpp | 71 +++--- .../bloodoxygen/src/BloodResultView.cpp | 27 +- .../heartrate/include/HeartBandoffView.h | 14 +- .../heartrate/include/HeartCheckView.h | 15 +- .../nativeui/heartrate/include/HeartModel.h | 5 +- .../heartrate/include/HeartPresenter.h | 2 +- .../heartrate/include/HeartResultView.h | 13 +- .../nativeui/heartrate/include/HeartView.h | 20 +- .../heartrate/src/HeartBandoffView.cpp | 6 +- .../nativeui/heartrate/src/HeartCheckView.cpp | 19 +- .../nativeui/heartrate/src/HeartModel.cpp | 22 +- .../nativeui/heartrate/src/HeartPresenter.cpp | 23 +- .../heartrate/src/HeartResultView.cpp | 30 ++- .../nativeui/heartrate/src/HeartView.cpp | 84 +++---- .../language/Language_xml/Chinese.txt | 238 ------------------ .../language/Language_xml/input_list_zh.txt | 82 ++++-- .../language/Language_xml/language_zh.xml | 84 +++++-- .../fd230app/nativeui/language/font/en.lang | Bin 6105 -> 6355 bytes .../fd230app/nativeui/language/font/ja.lang | Bin 6519 -> 6769 bytes .../language/font/ui_resource_string.h | 216 ++++++++++------ .../fd230app/nativeui/language/font/zh.lang | Bin 5532 -> 6331 bytes .../nativeui/message/src/MessageView.cpp | 4 +- .../fd230app/nativeui/traing/TrainingType.h | 186 ++++++++++++++ .../nativeui/traing/src/TraingEnddataView.cpp | 16 +- .../nativeui/traing/src/TraingModel.cpp | 2 +- .../nativeui/traing/src/TraingSetView.cpp | 8 +- .../traing/src/TrainingSetCaluliView.cpp | 2 +- .../traing/src/TrainingSetMileView.cpp | 2 +- .../traing/src/TrainingSetStepView.cpp | 2 +- .../traing/src/TrainingSetTimeView.cpp | 2 +- .../training_card/src/TraingCardView.cpp | 10 +- .../training_card/src/TrainingControlView.cpp | 6 +- .../training_card/src/TrainingDetailView.cpp | 6 +- .../traingrecord/src/TraingRecordView.cpp | 4 +- .../nativeui/uicomponents/UIComponents.cpp | 34 +++ .../nativeui/uicomponents/UIComponents.h | 11 + 44 files changed, 749 insertions(+), 607 deletions(-) delete mode 100644 code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/Chinese.txt create mode 100644 code/sdk/application/wearable/fd230app/nativeui/traing/TrainingType.h diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodBandoffView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodBandoffView.h index d230a1abe..7a66ee0d3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodBandoffView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodBandoffView.h @@ -27,7 +27,7 @@ namespace OHOS UIImageAnimatorView *GetImageAnimator(); private: - UILabel *label; + UILabelExt *label; UILabelButton *testButton; UIScrollView *BloodBandoffScrollView; UIViewGroup *group; diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodCheckView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodCheckView.h index 1fc13a8da..64a2a1f79 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodCheckView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodCheckView.h @@ -22,6 +22,7 @@ #include "bloodoxygen/include/BloodOxygenPresenter.h" #include "bloodoxygen/include/BloodBandoffView.h" #include "components/ui_scroll_view.h" +#include "components/ui_label_button_ext.h" namespace OHOS { class BloodOxygenPresenter; @@ -35,16 +36,16 @@ namespace OHOS static BloodCheckView *GetInstance(void); UIScrollView *BloodCheckViewInit(); UIImageAnimatorView *GetImageAnimator(); - UILabelButton *CreateAndSetUIButton(const char *title); + UILabelButtonExt *CreateAndSetUIButton(const char *title); void UpShowBloodText(); private: BloodBandoffView *bloodbandoff{nullptr}; UIImageAnimatorView *imageAnimator; - UILabel *titleLabel; - UILabel *Spo2Text; + UILabelExt *titleLabel; + UILabelExt *Spo2Text; UIScrollView *BloodCheckScrollView; - UILabelButton *testButton; + UILabelButtonExt *testButton; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenPresenter.h index e23bf5bce..3324fe354 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenPresenter.h @@ -28,6 +28,8 @@ namespace OHOS MAX_BLOODVIEW, } BLOODVIEWID; + + class BloodOxygenView; class BloodOxygenPresenter : public Presenter, public UIView::OnClickListener, @@ -51,7 +53,7 @@ namespace OHOS bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 uint64_t GetCurrentTime(); - std::string GetTDOA(uint64_t new_time, uint64_t old_time); + int GetTDOA(uint64_t new_time, uint64_t old_time); private: bool CheckPointersValue(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenView.h index d654824ea..35db087c6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenView.h @@ -1,4 +1,4 @@ -/*** +/*** * @Date: 2024-04-15 10:55:58 * @LastEditors: Caisking 3449750381@qq.com * @LastEditTime: 2024-04-18 10:23:54 @@ -31,6 +31,7 @@ #include "bloodoxygen/include/BloodBandoffView.h" #include "bloodoxygen/include/BloodCheckView.h" #include "bloodoxygen/include/BloodResultView.h" +#include "components/ui_label_button_ext.h" #include "power_display_service.h" namespace OHOS @@ -50,7 +51,7 @@ namespace OHOS void OnTearDownView() override; void OnStart() override; static BloodOxygenView *GetInstance(void); - + bool ChangeBloodView(int16_t thisview); // 主视图 bool ChangeBandoffView(int16_t thisview); bool ChangeCheckView(int16_t thisview); @@ -60,13 +61,14 @@ namespace OHOS void ChangeView(int16_t hideView, int16_t showView); UIScrollView *GetBloodScrollView(int ViewId); void UpBloodText(); + private: // 增加图片 bool InitImageDisplay(void); // 初始化标签 bool InitLabel(void); // 添加label按键 - UILabelButton *CreateAndSetUIButton(const char *title); + UILabelButtonExt *CreateAndSetUIButton(const char *title); // 初始化界面 bool InitBloodView(void); bool SetOnDragListener(void); @@ -77,11 +79,11 @@ namespace OHOS UIScrollView *BloodScrollView[4]{nullptr}; UIViewGroup *group; - UIImageView *imageViewMain; // 背景图片 - UILabel *percent; // 心率值 - UILabel *timeLabel; // 检测时间 - UILabel *titleLabel; // 页面title - UILabelButton *testButton; // 检测按键 + UIImageView *imageViewMain; // 背景图片 + UILabelExt *percent; // 心率值 + UILabelExt *timeLabel; // 检测时间 + UILabelExt *titleLabel; // 页面title + UILabelButtonExt *testButton; // 检测按键 const power_display_svr_api_t *display_api = power_display_svr_get_api(); uint32_t display_time; diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodResultView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodResultView.h index 26a81d86d..586341447 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodResultView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodResultView.h @@ -1,7 +1,7 @@ /*** * @Date: 2024-04-15 10:55:58 * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-04-18 12:11:45 + * @LastEditTime: 2024-05-07 18:51:13 * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodResultView.h */ /* @@ -28,6 +28,7 @@ #include "BloodOxygenPresenter.h" #include "BloodBandoffView.h" #include "components/ui_scroll_view.h" +#include "components/ui_label_button_ext.h" namespace OHOS { class BloodOxygenPresenter; @@ -47,14 +48,14 @@ namespace OHOS bool InitLabel(void); BloodResultView *bloodresult{nullptr}; UIImageView *imageerror; // 图片 - UILabel *titlelabel; - UILabel *label1; - UILabel *label2; - UILabel *label3; + UILabelExt *titlelabel; + UILabelExt *label1; + UILabelExt *label2; + UILabelExt *label3; UIScrollView *BloodResultScrollView; - UILabelButton *ReButton; - UILabelButton *StButton; + UILabelButtonExt *ReButton; + UILabelButtonExt *StButton; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodBandoffView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodBandoffView.cpp index 2905c9068..c41ab9e01 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodBandoffView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodBandoffView.cpp @@ -9,6 +9,7 @@ #include "wearable_log.h" #include "BloodBandoffView.h" #include "BloodOxygenModel.h" +#include "language/font/ui_resource_string.h" namespace OHOS { @@ -116,14 +117,15 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodBandoffView::CreateUIViewGroup"); // 佩戴title - label = new UILabel(); + label = new UILabelExt(); if (label == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodBandoffView::new Label fail"); // return nullptr; } label->SetPosition(LABEL_POSITION_X, LABEL_POSITION_Y, LABEL_POSITION_WIDTH, LABEL_POSITION_HEIGHT); - label->SetText("偏紧佩戴,保持静止"); + // label->SetText("偏紧佩戴,保持静止"); + label->SetTextId(STR_CHECKNOTE); label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); BloodBandoffScrollView->Add(label); diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodCheckView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodCheckView.cpp index 8fc7537ee..658836897 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodCheckView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodCheckView.cpp @@ -4,6 +4,7 @@ #include "BloodOxygenModel.h" #include "ui_image_animator.h" #include "BloodCheckView.h" +#include "language/font/ui_resource_string.h" namespace OHOS { // 动态刷新设置 @@ -92,7 +93,7 @@ namespace OHOS BloodCheckScrollView->SetPosition(0, 0); BloodCheckScrollView->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); /* -------------------------------------------------------------------------- */ - titleLabel = new UILabel(); + titleLabel = new UILabelExt(); if (titleLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::new titleLabel fail"); @@ -102,7 +103,8 @@ namespace OHOS titleLabel->Resize(200, 90); // widget's width and height titleLabel->SetViewId("label3"); // Set style titleLabel->SetStyle(STYLE_TEXT_FONT, 28); - titleLabel->SetText("正在检测"); + // titleLabel->SetText("正在检测"); + titleLabel->SetTextId(STR_CHECKON); titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); titleLabel->SetRollSpeed(0); @@ -124,7 +126,7 @@ namespace OHOS /* -------------------------------------------------------------------------- */ if (testButton == nullptr) { - testButton = new UILabelButton(); + testButton = new UILabelButtonExt(); } testButton->SetPosition(118, 336); // widget's left position and top position testButton->Resize(230, 80); // widget's width and height @@ -132,7 +134,8 @@ namespace OHOS testButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); // Set additional property - testButton->SetText("停止检测"); + // testButton->SetText("停止检测"); + testButton->SetTextId(STR_CHECKSTOP); testButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); testButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); testButton->SetViewId("checkstop"); @@ -145,7 +148,7 @@ namespace OHOS testButton->SetOnClickListener(clickLeftListener); BloodCheckScrollView->Add(testButton); /* -------------------------------------------------------------------------- */ - Spo2Text = new UILabel(); + Spo2Text = new UILabelExt(); if (Spo2Text == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::new Spo2Text fail"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp index 5b74c7932..ce5e8998e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp @@ -62,32 +62,15 @@ namespace OHOS } // 获取时间差,现在传进来的是两个时间戳 - std::string BloodOxygenPresenter::GetTDOA(uint64_t new_time, uint64_t old_time) + int BloodOxygenPresenter::GetTDOA(uint64_t new_time, uint64_t old_time) { if (new_time == old_time || old_time > new_time) { - return "刚刚"; + return 0; } int time_diff = new_time - old_time; - if (time_diff > 60) - { - int hours = time_diff / 60; - int minutes = time_diff % 60; - std::stringstream ss; - ss << hours << "小时"; - if (minutes > 0) - { - ss << minutes << "分钟"; - } - return ss.str() + "前"; - } - else - { - std::stringstream ss; - ss << time_diff << "分钟前"; - return ss.str(); - } + return time_diff; } /* -------------------------------------------------------------------------- */ diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenView.cpp index 9d13e05a7..c6bced889 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenView.cpp @@ -1,3 +1,9 @@ +/*** + * @Date: 2024-04-15 10:55:58 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-05-07 18:22:47 + * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenView.cpp + */ /* * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. * Description: bloodOxygen view @@ -10,6 +16,7 @@ #include "bloodoxygen/include/BloodOxygenPresenter.h" #include "displaybrightness/include/DisplayBrightnessModel.h" #include "power_display_service.h" +#include "uicomponents/UIComponents.h" namespace OHOS { // 按钮设置 @@ -75,22 +82,35 @@ namespace OHOS void BloodOxygenView::UpBloodText() { // 更新血氧数据 - uint16_t spo2_ = BloodOxygenModel::GetInstance()->GetSPO2data(); - if (spo2_ != 0) // 判断是否为默认数据 + uint16_t spo2 = BloodOxygenModel::GetInstance()->GetSPO2data(); + if (spo2 != 0) // 判断是否为默认数据 { // 更新数据 - std::string bloodoxygenStr = std::to_string(spo2_); + std::string bloodoxygenStr = std::to_string(spo2); percent->SetText(bloodoxygenStr.c_str()); - // 更新时间 + + // 获取时间差 uint32_t time = BloodOxygenPresenter::GetInstance()->GetCurrentTime(); uint32_t check_time = BloodOxygenModel::GetInstance()->GetCheckTime(); - std::string TimeStr = BloodOxygenPresenter::GetInstance()->GetTDOA(time, check_time) + "检测"; - timeLabel->SetText(TimeStr.c_str()); + int time_diff = BloodOxygenPresenter::GetInstance()->GetTDOA(time, check_time); + + if (time_diff == 0) + { + timeLabel->SetTextId(STR_CHECKNEW); + } + else if (time_diff <= 60) + { + UpdateLabel(timeLabel, time_diff); + } + else + { + timeLabel->SetTextId(STR_CHECKLONG); + } } else { percent->SetText("--"); - timeLabel->SetText("暂无检测结果"); + timeLabel->SetTextId(STR_CHECKNO); } } @@ -101,7 +121,7 @@ namespace OHOS std::string bloodoxygenStr; std::string TimeStr; - percent = new UILabel(); + percent = new UILabelExt(); if (percent == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::new percent fail"); @@ -111,28 +131,12 @@ namespace OHOS percent->Resize(200, 200); // widget's width and height percent->SetViewId("label2"); // Set style percent->SetStyle(STYLE_TEXT_FONT, PERCENT_FONT_SIZE); - uint16_t spo2_ = BloodOxygenModel::GetInstance()->GetSPO2data(); - if (spo2_ != 0) - { - bloodoxygenStr = std::to_string(spo2_); - // 更新时间 - uint64_t time = BloodOxygenPresenter::GetInstance()->GetCurrentTime(); - uint64_t check_time = BloodOxygenModel::GetInstance()->GetCheckTime(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "time:%lld check_time:%lld", time, check_time); - TimeStr = BloodOxygenPresenter::GetInstance()->GetTDOA(time, check_time) + "检测"; - } - else - { - percent->SetText("--"); - TimeStr = "暂无测量数据"; - } percent->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); percent->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); percent->SetRollSpeed(0); percent->SetFont(DEFAULT_VECTOR_FONT_FILENAME, PERCENT_FONT_SIZE); - percent->SetText(bloodoxygenStr.c_str()); /* -------------------------------------------------------------------------- */ - timeLabel = new UILabel(); + timeLabel = new UILabelExt(); if (timeLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::new timeLabel fail"); @@ -142,15 +146,14 @@ namespace OHOS timeLabel->Resize(280, 100); // widget's width and height timeLabel->SetViewId("label1"); // Set style timeLabel->SetStyle(STYLE_TEXT_FONT, TIMELABEL_FONT_SIZE); - /* -------------------------------------------------------------------------- */ - timeLabel->SetText(TimeStr.c_str()); - /* -------------------------------------------------------------------------- */ timeLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); timeLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); timeLabel->SetRollSpeed(0); timeLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TIMELABEL_FONT_SIZE); - /* -------------------------------------------------------------------------- */ - titleLabel = new UILabel(); + + UpBloodText(); + + titleLabel = new UILabelExt(); if (titleLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::new titleLabel fail"); @@ -160,7 +163,7 @@ namespace OHOS titleLabel->Resize(200, 90); // widget's width and height titleLabel->SetViewId("label3"); // Set style titleLabel->SetStyle(STYLE_TEXT_FONT, TITLE_FONT_SIZE); - titleLabel->SetText("血氧饱和度"); + titleLabel->SetTextId(STR_BLOOD); titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); titleLabel->SetRollSpeed(0); @@ -169,10 +172,10 @@ namespace OHOS return true; } // 创建标签按键 - UILabelButton *BloodOxygenView::CreateAndSetUIButton(const char *title) + UILabelButtonExt *BloodOxygenView::CreateAndSetUIButton(const char *title) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::CreateAndSetUIButton"); - UILabelButton *btn = new UILabelButton(); + UILabelButtonExt *btn = new UILabelButtonExt(); if (btn == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::new UILabelButton fail"); @@ -180,7 +183,7 @@ namespace OHOS } btn->SetPosition(TESTBUTTON_X, TESTBUTTON_Y, BUTTON_WIDHT2, BUTTON_HEIGHT2); btn->SetStyle(STYLE_BACKGROUND_COLOR, 0xffcd492c); - btn->SetText(title); + btn->SetTextId(STR_CHECK); // btn->SetTextColor(Color::Red()); btn->SetFont(DEFAULT_VECTOR_FONT_FILENAME, BUTTON_LABEL_SIZE); btn->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp index da68c4676..fabdc2195 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodResultView.cpp @@ -6,6 +6,8 @@ #include "BloodOxygenModel.h" #include "ui_image_animator.h" #include "BloodResultView.h" +#include "common/image_cache_manager.h" +#include "language/font/ui_resource_string.h" namespace OHOS { // 图片设置 @@ -71,7 +73,7 @@ namespace OHOS // 初始化标签 bool BloodResultView::InitLabel() { - titlelabel = new UILabel(); + titlelabel = new UILabelExt(); if (titlelabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail"); @@ -83,13 +85,14 @@ namespace OHOS titlelabel->SetStyle(STYLE_TEXT_FONT, 28); // Set additional property - titlelabel->SetText("检测不到结果"); + // titlelabel->SetText("检测不到结果"); + titlelabel->SetTextId(STR_CHECKERROR); titlelabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); titlelabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); titlelabel->SetRollSpeed(0); titlelabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28); /* -------------------------------------------------------------------------- */ - label1 = new UILabel(); + label1 = new UILabelExt(); if (label1 == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail"); @@ -100,13 +103,13 @@ namespace OHOS label1->SetViewId("label4"); // Set style label1->SetStyle(STYLE_TEXT_FONT, 30); - label1->SetText("请确认已带上手表,并保持"); + label1->SetText("请确认已带上手表,并保持静止"); label1->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); label1->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label1->SetRollSpeed(0); label1->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ - label2 = new UILabel(); + label2 = new UILabelExt(); if (label2 == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail"); @@ -116,14 +119,14 @@ namespace OHOS label2->Resize(200, 60); // widget's width and height label2->SetViewId("label5"); // Set style label2->SetStyle(STYLE_TEXT_FONT, 30); - label2->SetText("静止,准备好后点击下方按钮"); + label2->SetText("准备好后点击下方按钮"); label2->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); label2->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label2->SetRollSpeed(0); label2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ - label3 = new UILabel(); + label3 = new UILabelExt(); if (label3 == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail"); @@ -194,7 +197,7 @@ namespace OHOS return nullptr; } /* -------------------------------------------------------------------------- */ - ReButton = new UILabelButton(); + ReButton = new UILabelButtonExt(); if (ReButton == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UILabelButton fail"); @@ -202,7 +205,8 @@ namespace OHOS } ReButton->SetPosition(118, 334); ReButton->Resize(230, 80); - ReButton->SetText("重新检测"); + // ReButton->SetText("重新检测"); + ReButton->SetTextId(STR_RECHECK); ReButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffFF8A36); ReButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); ReButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); @@ -215,7 +219,7 @@ namespace OHOS } ReButton->SetOnClickListener(clickLeft1Listener); /* -------------------------------------------------------------------------- */ - StButton = new UILabelButton(); + StButton = new UILabelButtonExt(); if (StButton == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UILabelButton fail"); @@ -223,7 +227,8 @@ namespace OHOS } StButton->SetPosition(118, 434); // widget's left position and top position StButton->Resize(230, 80); // widget's width and height - StButton->SetText("停止检测"); + // StButton->SetText("停止检测"); + StButton->SetTextId(STR_CHECKSTOP); StButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); StButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); StButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartBandoffView.h b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartBandoffView.h index 762b5bb8c..6f8acc687 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartBandoffView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartBandoffView.h @@ -1,3 +1,15 @@ +/*** + * @Date: 2024-04-15 10:55:58 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-05-07 18:46:22 + * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartBandoffView.h + */ +/*** + * @Date: 2024-04-15 10:55:58 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-05-07 14:53:32 + * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartBandoffView.h + */ #ifndef Heart_BANDOFF_VIEW_H @@ -27,7 +39,7 @@ namespace OHOS UIImageAnimatorView *GetImageAnimator(); private: - UILabel *label; + UILabelExt *label; UILabelButton *testButton; UIScrollView *HeartBandoffScrollView; UIViewGroup *group; diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartCheckView.h b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartCheckView.h index fb9941e55..2adb7aff5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartCheckView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartCheckView.h @@ -1,3 +1,9 @@ +/*** + * @Date: 2024-04-15 10:55:58 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-05-07 14:55:13 + * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartCheckView.h + */ /* * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. * Description: bloodCheck view @@ -21,6 +27,7 @@ #include "components/ui_view_group.h" #include "HeartPresenter.h" #include "components/ui_scroll_view.h" +#include "components/ui_label_button_ext.h" namespace OHOS { class HeartPresenter; @@ -34,15 +41,15 @@ namespace OHOS static HeartCheckView *GetInstance(void); UIScrollView *HeartCheckViewInit(); UIImageAnimatorView *GetImageAnimator(); - UILabelButton *CreateAndSetUIButton(const char *title); + UILabelButtonExt *CreateAndSetUIButton(const char *title); void UpShowHeartText(); private: UIImageAnimatorView *imageAnimator; - UILabel *titleLabel; - UILabel *HeartText; + UILabelExt *titleLabel; + UILabelExt *HeartText; UIScrollView *HeartCheckScrollView; - UILabelButton *testButton; + UILabelButtonExt *testButton; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartModel.h b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartModel.h index 4a14b4abc..b720bbf8f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartModel.h @@ -158,8 +158,9 @@ extern "C" bool initstatus = true; uint8_t wear_; - uint8_t valid_counter_ = 0;//有效数计数器 - uint8_t unwear_counter_ = 0;//佩戴错误计数器 + uint8_t valid_counter_ = 0; // 有效数计数器 + uint8_t disvalid_counter_ = 0; // 无效数计数器 + uint8_t unwear_counter_ = 0; // 佩戴错误计数器 }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartPresenter.h index 8e403a447..970ae3e75 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartPresenter.h @@ -50,7 +50,7 @@ namespace OHOS bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 uint64_t GetCurrentTime(); - std::string GetTDOA(uint64_t new_time, uint64_t old_time); + int GetTDOA(uint64_t new_time, uint64_t old_time); private: bool CheckPointersValue(void); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartResultView.h b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartResultView.h index b3d30dd22..d31466e6d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartResultView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartResultView.h @@ -21,6 +21,7 @@ #include "components/ui_view_group.h" #include "HeartPresenter.h" #include "components/ui_scroll_view.h" +#include "components/ui_label_button_ext.h" namespace OHOS { class HeartPresenter; @@ -40,14 +41,14 @@ namespace OHOS bool InitLabel(void); HeartResultView *bloodresult{nullptr}; UIImageView *imageerror; // 图片 - UILabel *titlelabel; - UILabel *label1; - UILabel *label2; - UILabel *label3; + UILabelExt *titlelabel; + UILabelExt *label1; + UILabelExt *label2; + UILabelExt *label3; UIScrollView *HeartResultScrollView; - UILabelButton *ReButton; - UILabelButton *StButton; + UILabelButtonExt *ReButton; + UILabelButtonExt *StButton; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartView.h b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartView.h index 889e565b0..e6749a056 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartView.h @@ -24,6 +24,8 @@ #include "HeartCheckView.h" #include "HeartResultView.h" #include "power_display_service.h" +#include "components/ui_label_button_ext.h" + namespace OHOS { class HeartPresenter; @@ -52,10 +54,10 @@ namespace OHOS void UpHeartText(); // 更新心率结果文本 private: - bool InitImageDisplay(void); // 初始化背景图片 - bool InitLabel(void); // 初始化标签 - UILabelButton *CreateAndSetUIButton(const char *title); // 添加label按键 - bool InitHeartView(void); // 初始化界面 + bool InitImageDisplay(void); // 初始化背景图片 + bool InitLabel(void); // 初始化标签 + UILabelButtonExt *CreateAndSetUIButton(const char *title); // 添加label按键 + bool InitHeartView(void); // 初始化界面 bool SetOnDragListener(void); HeartBandoffView *heartbandoff{nullptr}; @@ -64,11 +66,11 @@ namespace OHOS UIScrollView *HeartScrollView[4]{nullptr}; UIViewGroup *group; - UIImageView *imageViewMain; // 背景图片 - UILabel *percent; // 心率值 - UILabel *timeLabel; // 检测时间 - UILabel *titleLabel; // 页面title - UILabelButton *testButton; // 检测按键 + UIImageView *imageViewMain; // 背景图片 + UILabelExt *percent; // 心率值 + UILabelExt *timeLabel; // 检测时间 + UILabelExt *titleLabel; // 页面title + UILabelButtonExt *testButton; // 检测按键 const power_display_svr_api_t *display_api = power_display_svr_get_api(); uint32_t display_time; // 获取系统亮屏时间暂存 diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartBandoffView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartBandoffView.cpp index 59af17ed0..fd71a52a4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartBandoffView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartBandoffView.cpp @@ -9,6 +9,7 @@ #include "wearable_log.h" #include "HeartBandoffView.h" #include "HeartModel.h" +#include "language/font/ui_resource_string.h" namespace OHOS { @@ -116,14 +117,15 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartBandoffView::CreateUIViewGroup"); // 佩戴title - label = new UILabel(); + label = new UILabelExt(); if (label == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartBandoffView::new Label fail"); // return nullptr; } label->SetPosition(LABEL_POSITION_X, LABEL_POSITION_Y, LABEL_POSITION_WIDTH, LABEL_POSITION_HEIGHT); - label->SetText("偏紧佩戴,保持静止"); + // label->SetText("偏紧佩戴,保持静止"); + label->SetTextId(STR_CHECKNOTE); label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); HeartBandoffScrollView->Add(label); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartCheckView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartCheckView.cpp index eaabed248..1c58fc954 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartCheckView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartCheckView.cpp @@ -6,6 +6,7 @@ #include "HeartModel.h" #include "ui_image_animator.h" #include "HeartCheckView.h" +#include "language/font/ui_resource_string.h" namespace OHOS { // 动态刷新设置 @@ -94,7 +95,7 @@ namespace OHOS HeartCheckScrollView->SetPosition(0, 0); HeartCheckScrollView->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); /* -------------------------------------------------------------------------- */ - titleLabel = new UILabel(); + titleLabel = new UILabelExt(); if (titleLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartView::new titleLabel fail"); @@ -104,7 +105,8 @@ namespace OHOS titleLabel->Resize(200, 90); // widget's width and height titleLabel->SetViewId("label3"); // Set style titleLabel->SetStyle(STYLE_TEXT_FONT, 28); - titleLabel->SetText("正在检测"); + // titleLabel->SetText("正在检测"); + titleLabel->SetTextId(STR_CHECKON); titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); titleLabel->SetRollSpeed(0); @@ -119,14 +121,14 @@ namespace OHOS return nullptr; } imageAnimator->SetImageAnimatorSrc(g_imageAnimatorInfo_Time, CHECKIMAGEANIMATORVIEW_SIZE, CHECKIMAGEANIMATORVIEW_SPEED); - //imageAnimator->SetRepeatTimes(30); + // imageAnimator->SetRepeatTimes(30); imageAnimator->SetRepeat(true); imageAnimator->Start(); HeartCheckScrollView->Add(imageAnimator); /* -------------------------------------------------------------------------- */ if (testButton == nullptr) { - testButton = new UILabelButton(); + testButton = new UILabelButtonExt(); } testButton->SetPosition(118, 336); // widget's left position and top position testButton->Resize(230, 80); // widget's width and height @@ -134,7 +136,8 @@ namespace OHOS testButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); // Set additional property - testButton->SetText("停止检测"); + // testButton->SetText("停止检测"); + testButton->SetTextId(STR_CHECKSTOP); testButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); testButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); testButton->SetViewId("checkstop"); @@ -147,15 +150,15 @@ namespace OHOS testButton->SetOnClickListener(clickLeftListener); HeartCheckScrollView->Add(testButton); /* -------------------------------------------------------------------------- */ - HeartText = new UILabel(); + HeartText = new UILabelExt(); if (HeartText == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartView::new HeartText fail"); return nullptr; } HeartText->SetPosition(83, 110); // widget's left position and top position - HeartText->Resize(300, 250); // widget's width and height - HeartText->SetViewId("label"); // Set style + HeartText->Resize(300, 250); // widget's width and height + HeartText->SetViewId("label"); // Set style HeartText->SetStyle(STYLE_TEXT_FONT, 140); uint16_t heart_ = HeartModel::GetInstance()->GetHeartdata(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetHeartData %d", heart_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp index 7487468d1..1b2826cdf 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp @@ -19,8 +19,9 @@ extern "C" { #endif -#define MAX_UNWEAR_COUNT 30 -#define MAX_VALID_HRS_COUNT 30 +#define MAX_UNWEAR_COUNT 20 +#define MAX_VALID_HRS_COUNT 40 +#define MAX_DISVALID_HRS_COUNT 40 #define HEARTTEST 1 //[0 开启测试 1 关闭] /* 佩戴检测结果 */ enum @@ -475,6 +476,7 @@ namespace OHOS { valid_counter_ = 0; unwear_counter_ = 0; + disvalid_counter_ = 0; SetCheckStatus(false); SetWearStatus(1); } @@ -482,7 +484,7 @@ namespace OHOS void HeartModel::SetWearStatus(int32_t wear) { // 设置佩戴状态 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartModel Weartest::%d", wear); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartModel Weartest::%d", wear); if (wear_ != 1 && wear != 1) { unwear_counter_++; // 佩戴错误计时器计数 @@ -585,11 +587,21 @@ namespace OHOS if (Show_Heart_ != 0) { Heart_ = heart; - valid_counter_++; // 增加有效计数器 + valid_counter_++; // 增加有效计数器 + disvalid_counter_ = 0; // 清零无效数 } else { - valid_counter_ = 0; // 清零有效计数器 + valid_counter_ = 0; // 清零有效计数器 + disvalid_counter_++; // 增加无效数 + } + // 一直为无效数 + if (disvalid_counter_ >= MAX_DISVALID_HRS_COUNT) + { + // 结束本次测试 + PRINT("MAX_DISVALID_HRS_COUNT\r\n"); + Heart_Stop(); + return; } #if HEARTTEST if (valid_counter_ >= MAX_VALID_HRS_COUNT) diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartPresenter.cpp index 929a961d2..323581252 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartPresenter.cpp @@ -53,32 +53,15 @@ namespace OHOS return current_time; } - std::string HeartPresenter::GetTDOA(uint64_t new_time, uint64_t old_time) + int HeartPresenter::GetTDOA(uint64_t new_time, uint64_t old_time) { if (new_time == old_time || old_time > new_time) { - return "刚刚"; + return 0; } int time_diff = new_time - old_time; - if (time_diff > 60) - { - int hours = time_diff / 60; - int minutes = time_diff % 60; - std::stringstream ss; - ss << hours << "小时"; - if (minutes > 0) - { - ss << minutes << "分钟"; - } - return ss.str() + "前"; - } - else - { - std::stringstream ss; - ss << time_diff << "分钟前"; - return ss.str(); - } + return time_diff; } HeartPresenter::HeartPresenter() diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartResultView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartResultView.cpp index 20078aeab..6c05a52ba 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartResultView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartResultView.cpp @@ -6,6 +6,7 @@ #include "HeartModel.h" #include "ui_image_animator.h" #include "HeartResultView.h" +#include "language/font/ui_resource_string.h" namespace OHOS { // 图片设置 @@ -71,7 +72,7 @@ namespace OHOS // 初始化标签 bool HeartResultView::InitLabel() { - titlelabel = new UILabel(); + titlelabel = new UILabelExt(); if (titlelabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail"); @@ -83,13 +84,14 @@ namespace OHOS titlelabel->SetStyle(STYLE_TEXT_FONT, 28); // Set additional property - titlelabel->SetText("检测不到结果"); + // titlelabel->SetText("检测不到结果"); + titlelabel->SetTextId(STR_CHECKERROR); titlelabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); titlelabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); titlelabel->SetRollSpeed(0); titlelabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28); /* -------------------------------------------------------------------------- */ - label1 = new UILabel(); + label1 = new UILabelExt(); if (label1 == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail"); @@ -100,13 +102,13 @@ namespace OHOS label1->SetViewId("label4"); // Set style label1->SetStyle(STYLE_TEXT_FONT, 30); - label1->SetText("请确认已带上手表,并保持"); + label1->SetText("请确认已带上手表,并保持静止"); label1->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); label1->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label1->SetRollSpeed(0); label1->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ - label2 = new UILabel(); + label2 = new UILabelExt(); if (label2 == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail"); @@ -116,14 +118,14 @@ namespace OHOS label2->Resize(200, 60); // widget's width and height label2->SetViewId("label5"); // Set style label2->SetStyle(STYLE_TEXT_FONT, 30); - label2->SetText("静止,准备好后点击下方按钮"); + label2->SetText("准备好后点击下方按钮"); label2->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); label2->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label2->SetRollSpeed(0); label2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* -------------------------------------------------------------------------- */ - label3 = new UILabel(); + label3 = new UILabelExt(); if (label3 == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabel fail"); @@ -194,15 +196,16 @@ namespace OHOS return nullptr; } /* -------------------------------------------------------------------------- */ - ReButton = new UILabelButton(); + ReButton = new UILabelButtonExt(); if (ReButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UILabelButton fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UILabelButtonExt fail"); return nullptr; } ReButton->SetPosition(118, 334); ReButton->Resize(230, 80); - ReButton->SetText("重新检测"); + // ReButton->SetText("重新检测"); + ReButton->SetTextId(STR_RECHECK); ReButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffFF8A36); ReButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); ReButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); @@ -215,15 +218,16 @@ namespace OHOS } ReButton->SetOnClickListener(clickLeft1Listener); /* -------------------------------------------------------------------------- */ - StButton = new UILabelButton(); + StButton = new UILabelButtonExt(); if (StButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UILabelButton fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UILabelButtonExt fail"); return nullptr; } StButton->SetPosition(118, 434); // widget's left position and top position StButton->Resize(230, 80); // widget's width and height - StButton->SetText("停止检测"); + // StButton->SetText("停止检测"); + StButton->SetTextId(STR_CHECKSTOP); StButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); StButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); StButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartView.cpp index ba9f44b5b..fac88ccca 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartView.cpp @@ -13,6 +13,8 @@ #include "heartrate/include/HeartBandoffView.h" #include "heartrate/include/HeartCheckView.h" #include "heartrate/include/HeartRateView.h" +#include "language/font/ui_resource_string.h" +#include "uicomponents/UIComponents.h" namespace OHOS { @@ -80,32 +82,45 @@ namespace OHOS } void HeartView::UpHeartText() { - // 更新血氧数据 - uint64_t heart_ = HeartModel::GetInstance()->GetHeartdata(); - std::string heartStr; - std::string TimeStr; - if (heart_ != 0) // 判断是否为默认数据 + // 更新心率数据 + uint8_t heart = HeartModel::GetInstance()->GetHeartdata(); + if (heart != 0) // 判断是否为默认数据 { - heartStr = std::to_string(heart_); - // 更新时间 - uint64_t time = HeartPresenter::GetInstance()->GetCurrentTime(); - uint64_t check_time = HeartModel::GetInstance()->GetCheckTime(); - TimeStr = HeartPresenter::GetInstance()->GetTDOA(time, check_time) + "检测"; + // 更新心率数据 + std::string heartStr = std::to_string(heart); + percent->SetText(heartStr.c_str()); + + // 获取时间差 + uint32_t time = HeartPresenter::GetInstance()->GetCurrentTime(); + uint32_t check_time = HeartModel::GetInstance()->GetCheckTime(); + int time_diff = HeartPresenter::GetInstance()->GetTDOA(time, check_time); + + // 更新时间标签 + if (time_diff == 0) + { + timeLabel->SetTextId(STR_CHECKNEW); + } + else if (time_diff <= 60) + { + UpdateLabel(timeLabel, time_diff); + } + else + { + timeLabel->SetTextId(STR_CHECKLONG); + } } else { - heartStr = "--"; - TimeStr = "暂无检测记录"; + percent->SetText("--"); + timeLabel->SetTextId(STR_CHECKNO); } - percent->SetText(heartStr.c_str()); - timeLabel->SetText(TimeStr.c_str()); } // 初始化标签 bool HeartView::InitLabel() { /* -------------------------------------------------------------------------- */ - percent = new UILabel(); + percent = new UILabelExt(); if (percent == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartView::new percent fail"); @@ -120,7 +135,7 @@ namespace OHOS percent->SetRollSpeed(0); percent->SetFont(DEFAULT_VECTOR_FONT_FILENAME, PERCENT_FONT_SIZE); /* -------------------------------------------------------------------------- */ - timeLabel = new UILabel(); + timeLabel = new UILabelExt(); if (timeLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartView::new timeLabel fail"); @@ -136,7 +151,7 @@ namespace OHOS timeLabel->SetRollSpeed(0); timeLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TIMELABEL_FONT_SIZE); /* -------------------------------------------------------------------------- */ - titleLabel = new UILabel(); + titleLabel = new UILabelExt(); if (titleLabel == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartView::new titleLabel fail"); @@ -146,48 +161,31 @@ namespace OHOS titleLabel->Resize(200, 90); // widget's width and height titleLabel->SetViewId("label3"); // Set style titleLabel->SetStyle(STYLE_TEXT_FONT, TITLE_FONT_SIZE); - titleLabel->SetText("心率检测结果"); - titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + // titleLabel->SetText("心率检测结果"); + titleLabel->SetTextId(STR_HEARTDATA); + titleLabel->SetLineBreakMode(UILabelExt::LINE_BREAK_ADAPT); titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); titleLabel->SetRollSpeed(0); titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TITLE_FONT_SIZE); - /* -------------------------------------------------------------------------- */ - uint64_t heart_ = HeartModel::GetInstance()->GetHeartdata(); - std::string heartStr; - std::string TimeStr; - if (heart_ != 0) // 判断是否为默认数据 - { - heartStr = std::to_string(heart_); - // 更新时间 - uint64_t time = HeartPresenter::GetInstance()->GetCurrentTime(); - uint64_t check_time = HeartModel::GetInstance()->GetCheckTime(); - TimeStr = HeartPresenter::GetInstance()->GetTDOA(time, check_time) + "检测"; - } - else - { - heartStr = "--"; - TimeStr = "暂无检测记录"; - } - percent->SetText(heartStr.c_str()); - - timeLabel->SetText(TimeStr.c_str()); + UpHeartText(); /* -------------------------------------------------------------------------- */ return true; } // 创建标签按键 - UILabelButton *HeartView::CreateAndSetUIButton(const char *title) + UILabelButtonExt *HeartView::CreateAndSetUIButton(const char *title) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartView::CreateAndSetUIButton"); - UILabelButton *btn = new UILabelButton(); + UILabelButtonExt *btn = new UILabelButtonExt(); if (btn == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartView::new UILabelButton fail"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartView::new UILabelButtonExt fail"); return nullptr; } btn->SetPosition(TESTBUTTON_X, TESTBUTTON_Y, BUTTON_WIDHT2, BUTTON_HEIGHT2); btn->SetStyle(STYLE_BACKGROUND_COLOR, 0xffcd492c); - btn->SetText(title); + // btn->SetText(title); + btn->SetTextId(STR_CHECK); // btn->SetTextColor(Color::Red()); btn->SetFont(DEFAULT_VECTOR_FONT_FILENAME, BUTTON_LABEL_SIZE); btn->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/Chinese.txt b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/Chinese.txt deleted file mode 100644 index 2042bd6cc..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/Chinese.txt +++ /dev/null @@ -1,238 +0,0 @@ -Ò»°ã¶ÍÁ¶ -×ÔÓÉѵÁ· -¼¡Á¦ÑµÁ· -·ÉÂÖ³µ/ÊÒÄÚ½¡Éí³µ -̤²½»ú -Âþ²½»ú -HIIT/¸ßÇ¿¶È¼äЪѵÁ· -½¡Éí -ÍÅÌå²Ù -è¤çì -è¤çìèʽ -è¤çìţʽ -è¤çìÑÛ¾µÉßʽ -è¤çìÓ¢ÐÛʽ1 -è¤çìÓ¢ÐÛʽ2 -è¤çìÓ¢ÐÛʽ3 -è¤çì¹öÂÖ -ÊÒÍâ×ß· -ÊÒÍâÅܲ½ -ÊÒÄÚ×ß· -ÊÒÄÚÅܲ½ -ÊÒÍâÆïÐÐ -ÌøÉþ -ƤÀ­Ìá˹ -»ìºÏ½¡Éí -¹¦ÄÜÐÔѵÁ· -ÌåÄÜѵÁ· -õÌÈ­µÀ/ÌßÈ­ -È­»÷ -×ÔÓɲ«»÷ -¿ÕÊÖµÀ -»÷½£ -ºËÐÄѵÁ· -È­»÷ÓÐÑõ -½£µÀ -µ¥¸Ü -Ë«¸Ü -Ñ­»·ÑµÁ· -ÓÐÑõÔ˶¯ -½¡ÃÀ²Ù -P90X -ºøÁåѵÁ· -×ۺϸñ¶· -ÅÀÂ¥ÌÝ»ú -¾ÙÖØ -Barre -ÊÖÂÖ -Ìï¾¶ -½ÇÁ¦ -ÉíÐÄÔ˶¯ -ÈáÈí²Ù -»ìºÍÓÐÑõ -´«Í³¼¡Á¦ÑµÁ· -½»²æÑµÁ· -Ìå²Ù -½×ÌÝѵÁ· -ÍÖÔ²»ú -»®´¬»ú -Ò»°ãÎ赸 -¶ÇƤÎè -¾ôÊ¿Îè -À­¶¡Îè -°ÅÀÙ -½ÖÎè -¹ã³¡Îè -×ð°Í -Éç½»Îè -Ìß̤Îè -Ò»°ãÐÝÏÐÔ˶¯ -»¬ÂÖÁï±ù -ÎäÊõ -Ì«¼«È­ -ºôÀ­È¦ -·ÉÅÌ -·ÉïÚ -Éä¼ý -ÆïÂí -¶ÔÕ½ÓÎÏ· -·Å·çóÝ -°ÎºÓ -íFía -ÅÀÂ¥ÌÝ -Õϰ­Èü -µöÓã -´òÁÔ -»¬°å³µ -»¬ÏèÉ¡ -ÍŶӾº¼¼ -½¡ÉíµçÍæ -½¡ÐÐ -ÂíÊõÔ˶¯ -ÍæÀÖ -Ò»°ãÇòÀàÔ˶¯ -ÓðëÇò -ƹÅÒÇò -ÍøÇò -ײÇò -±£ÁäÇò -ÅÅÇò -ë¦×ÓÇò -ÊÖÇò -°ôÇò -ÀÝÇò -°åÇò -ÃÀʽéÏé­Çò -ɳ̲×ãÇò -ɳ̲ÅÅÇò -é³Çò -Çú¹÷Çò -Ӣʽ±ÚÇò -ÌÙÇò -¶ã±ÜÇò -ÀºÇò -×ãÇò -¸ß¶û·òÇò -ÂíÇò -ÃÀʽ±ÚÇò -ӢʽéÏé­Çò -ÃÅÇò -Æ¥¿ËÇò -´ü¹÷Çò -Ò»°ãË®Éϻ -·«´¬ -³åÀË -·ºÖÛ -»®ÁúÖÛ -Çáͧ -Èüͧ -Ë®ÉÏĦÍгµ -Á¢½°³åÀË -DZˮ -ÌøË® -»¬ÏèÉ¡³åÀË -³åÀË»¬Ë® -Ë®Çò -·ç·«³åÀË -ƯÁ÷»î¶¯ -Ë®Öн¡Éí -Ë®ÉÏÔ˶¯ -»§ÍâÓÎÓ¾ -ÊÒÄÚÓÎÓ¾ -ÓÎÓ¾_×ÔÓÉʽ -ÓÎÓ¾_ÍÜʽ -ÓÎÓ¾_Ñöʽ -ÓÎÓ¾_µûʽ -Ò»°ã±ùÉÏÔ˶¯ -Áï±ù -±ùÇò -±ùʯºø/±ùºø -Ñ©ÉÏĦÍгµ -Ñ©ÇÁ -¶¬¼¾Á½Ïî -Ô½Ò°»¬Ñ© -»¬Ñ© -µ¥°å»¬Ñ©/»¬Ñ©°å -ѩЬ½¡ÐÐ -Ñ©µØÔ˶¯ -Ò»°ã¼«ÏÞÔ˶¯ -»¬°å -ÅÊÑÒ -¸ß¿Õµ¯Ìø/±Ä¼«»î¶¯ -ÅÜ¿á -BMX -¶¨ÏòÔ½Ò° -ÌøÉ¡ -Èü³µ -ÌúÈËÈýÏîÔ˶¯ -³ËµçÌÝ -³ËÊÖ·öÌÝ -×öÔ°ÒÕ -×ö¼ÒÎñ -ÔÚ³µÀï -Ú¤Ïë -¾²Ö¹ -Çãб -×øÂÖÒÎÒÆ¶¯ -½¡ÉíÀà -ÇòÀà -Ë®ÉÏÔ˶¯ -Î赸Àà -¼«ÏÞÔ˶¯ -±ùÉÏÔ˶¯ -ÐÝÏÐÔ˶¯ -ÆäËû -Î赸Ô˶¯ -ÇòÀàÔ˶¯ -ÆäËûÔ˶¯ -½¡ÉíÔ˶¯ -ѵÁ· -¿ìËÙѵÁ· -ÉèÖÃÄ¿±ê > -ʱ³¤ -ʱ³¤É趨 -·ÖÖÓ -¿¨Â·Àï -¿¨Â·ÀïÉ趨 -ǧ¿¨ -¾àÀë -¾àÀëÉ趨 -Ã× -¹«Àï -²½Êý -²½ÊýÉ趨 -²½ -ÐÄÂÊ -ƽ¾ùÐÄÂÊ -´Î/·Ö -ƽ¾ùÐÄÂÊ(´Î/·Ö) -ÖÐ -½ÏµÍÇ¿¶È -ÖеÈÇ¿¶È -¸ßµÈÇ¿¶È -³¬¸ßÇ¿¶È -ѵÁ·Ç¿¶È -ѵÁ·Ç¿¶ÈÓÃÓÚÅжÏÊÇ·ñѵÁ·²»×ã»òÕßѵÁ·Ì«¹ý£¬µ½µ×ʹÐÄÂÊÔö¼Ó¶àÉÙµÄÔ˶¯Ç¿¶È²ÅÊÇ×îºÏÊʵġ£ -¸ÃÇ¿¶ÈÇø¼äÊǶÔÓ¦°ÐÐÄÂÊ£¨ÓɸöÈË»ù±¾×ÊÁϼÆËãµÃ³ö£©Ç¿ÈõµÄʵʱ״̬ÏÔʾ£¬ÓÐÖúÓÚÌá¸ßѵÁ·ÖÊÁ¿ -ѵÁ·×´Ì¬´ú±íµÄÒâÒå -ÈÈÉíÔ˶¯ -È¼Ö¬Çø -ÌáÉýÐķλúÄÜ -רҵÔ˶¯Ô± -×¢£º¸ÃѵÁ·Ç¿¶È²¢·ÇרҵÔ˶¯ÆÀ¹À£¬Êý¾Ý½ö¹©²Î¿¼ -ѵÁ·ÖÐ -ÔÝͣѵÁ· -½áÊø -ÔÝÍ£ -¼ÌÐø -Ä¿±êÒÑ´ï³É -Íê³ÉÄ¿±ê -È·¶¨ -×¢Òâ -µ±Ç°Ô˶¯Á¿Ì«Ð¡£¬ÎÞ·¨¼Ç¼ ÊÇ·ñ½áÊøÔ˶¯ -½áÊøÔ˶¯ -ÊÇ·ñ½áÊø±¾´ÎÔ˶¯ -Ä¿±êÍê³É¶È -ѵÁ·Ê±³¤ -¹Ø±Õ -¸ü¶à \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt index 0285debbc..4352f791a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt +++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/input_list_zh.txt @@ -186,40 +186,25 @@ STR_DANCING_TITLE$舞蹈运动 STR_BALL_LIST_TITLE$球类运动 STR_OTHER_TITLE$其他运动 STR_EXERCISE_TITLE$健身运动 -STR_TRAINING$训练 STR_RAPID_TRAINING$快速训练 STR_SET_GOALS$设置目标 > STR_DURATION$时长 -STR_DURATION_SETTING$时长设定 -STR_MINUTES$分钟 +STR_DURATION_SETTING$时长(分钟) STR_CALORIE$卡路里 -STR_CALORIE_SETTING$卡路里设定 -STR_KILOCALORIE$千卡 +STR_CALORIE_SETTING$卡路里(千卡) STR_DISTANCE$距离 -STR_RANGE_SETTING$距离设定 -STR_METER$ç±³ -STR_KILOMETRE$公里 +STR_RANGE_SETTING$距离(公里) STR_STEP_NUMBER$步数 -STR_STEP_SETTING$步数设定 -STR_STEP$æ­¥ -STR_HEART_RATE$心率 +STR_STEP_SETTING$步数(步) +STR_HEART_RATE$心率(次/分) STR_MEAN_HEART_RATE$平均心率 STR_TIMES_PER_MIN$次/分 STR_MEAN_HEART_RATE_MIN$平均心率(次/分) -STR_IN_THE$中 STR_LOWER_STRENGTH$较低强度 STR_MEDIUM_STRENGTH$中等强度 STR_HIGH_STRENGTH$高等强度 -STR_ULTRA_HIGH_STRENGTH$超高强度 +STR_ULTRA_HIGH_STRENGTH$超大强度 STR_TRAINING_INTENSITY$训练强度 -STR_TRAINING_INTENSITY_DESCRIPTION$训练强度用于判断是否训练不足或者训练太过,到底使心率增加多少的运动强度才是最合适的。 -STR_INTENSITY_INTERVAL_DESCRIPTION$该强度区间是对应靶心率(由个人基本资料计算得出)强弱的实时状态显示,有助于提高训练质量 -STR_TRAINING_STATE_MEANING$训练状态代表的意义 -STR_WARM_UP_EXERCISE$热身运动 -STR_FAT_BURNING_ZONE$燃脂区 -STR_IMPROVE_CARDIOPULMONARY_FUNCTION$提升心肺机能 -STR_PROFESSIONAL_ATHLETE$专业运动员 -STR_TRAINING_INTENSITY_NOTE$注:该训练强度并非专业运动评估,数据仅供参考 STR_TRAINING_IN_PROGRESS$训练中 STR_BREAK_TRAINING$暂停训练 STR_FINISH$结束 @@ -229,13 +214,64 @@ STR_GOAL_ACHIEVED$目标已达成 STR_ACCOMPLISH_GOAL$完成目标 STR_OK$确定 STR_LOOK_OUT$注意 -STR_INSUFFICIENT_EXERCISE_AMOUNT$当前运动量太小,无法记录。是否结束运动 +STR_INSUFFICIENT_EXERCISE_AMOUNT$当前运动量太小,无法记录 STR_END_MOVEMENT$结束运动 STR_END_THIS_MOVEMENT$是否结束本次运动 STR_GOAL_ACCOMPLISHMENT_DEGREE$目标完成度 STR_TRAINING_DURATION$训练时长 -STR_OFF$关闭 +STR_RANGE_MILE$距离(米) +STR_CLOSE$关闭 STR_MORE$更多 +STR_MORE_APP$更多前往APP查看 +STR_SAVENOTE$开启省电模式会关闭非必要的蓝牙连接,以及传感器监测等功能 +STR_SAVEBACK$长按屏幕3秒以上或充电可退出省电模式 +STR_SAVEASK$是否开启 +STR_BLOOD$血氧饱和度 +STR_CHECK$检测 +STR_CHECKNEW$刚刚检测 +STR_CHECKTIME$XX分钟前检测 +STR_CHECKLONG$超过1个小时前检测 +STR_CHECKNO$暂无检测记录 +STR_CHECKNOTE$偏紧佩戴,保持静止 +STR_CHECKON$正在检测 +STR_CHECKSTOP$停止检测 +STR_CHECKERROR$检测不到结果 +STR_WAERKEEP$请确认已带上手表,并保持静止 +STR_WEARRE$进行重新检测 +STR_WEARREADY$准备好后点击下方按钮 +STR_RECHECK$重新检测 +STR_CHECKEWARN$血氧提醒 +STR_BLOODSHORT$当前血氧含量已低于XX% +STR_HEARTNOTE$请注意身体健康 +STR_KONW$知道了 +STR_EXPLAIN$说明 +STR_HEARTREST$静息 +STR_HEARTDATA$心率检测结果 +STR_HEARTTITLE$心率提醒 +STR_HEARTMAX$当前心率值高于XX +STR_HEARTMIN$当前心率值低于XX +STR_TRAINGNO$无记录 +STR_TRAINGGO$去训练 +STR_MESSAGE$通知 +STR_MESSAGENO$暂无内容 +STR_STEP$今日步数 +STR_DIS$里程(KM) +STR_DUR$燃脂时间 +STR_STANDUP$站立次数 +STR_SLEEP$昨夜睡眠 +STR_SLEEPHOUR$小时 +STR_SLEEPMGOAL$目标 +STR_REATTIME$作息时间 +STR_SLEEPTIME$入睡时间 +STR_WALKTIME$醒来时间 +STR_DISTURB$手表将在20分钟后开启勿扰模式,关闭请到控制中心 +STR_DISTURBNOTE$已开启勿扰模式,此模式下手表将不会发出震动与铃声 +STR_MORNNING$早安 +STR_NOW$当前 +STR_NAP$小睡(5分钟) +STR_TACK$请先打开app,进入“设备”-“拍照” +STR_CLICK$点击拍照 +STR_TACKNUM$已拍摄XXå¼  STR_HEART_RATE$心率 STR_BLOOD_OXYGEN$血氧 STR_TRAINING$训练 diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml index cc595a949..49199dd35 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml +++ b/code/sdk/application/wearable/fd230app/nativeui/language/Language_xml/language_zh.xml @@ -187,40 +187,25 @@ - - + - - + - - + - - - + - - - + + - - + - - - - - - - - @@ -230,13 +215,64 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang b/code/sdk/application/wearable/fd230app/nativeui/language/font/en.lang index 6626452bd585dc5a1dea51c77d679642ea53bf52..4b5af2e7e7c3bc1d01f255b6eb31935bbe216bd1 100644 GIT binary patch delta 622 zcmZ|NJ4oAM5CHJcN3?4GKBCduRK-E-Thk>jBG##sf>0+X%_dPn5lTy(1nH=tNTG{^ zi$W1fXK~QUL4*np9ZMH+aPrmPnxP;3jyn!MxZ|z{FVe|(og-V>TqtcgC2$%&kG-zV~KUX^0(FpbyiJ8iY_vYGsz4&KC;dh zdmQkC6VCa~4Mhn<(a3wIsF)Q#v3-<^J;pNy7xKSiYCfA?ENE^vB|abRCPrib06?}v AHvj+t delta 370 zcmY+*KS%;`9ER~P#7`IhT_QRuLQW2%4LSrTxrl>{2e(FWi)0)PEgm=&&Z5xP6f`sl zA&84OI5`OlLIg)(5Ypfvh)dM7_QD6=}2df!M-g04jC>OfcCGlT8jL8)#X;D_9J{JXEw?%SoSfU+a@G z6VY31NB;6-Gid~QB~m~UHcBX?f+`%;P)7qzw9rNeE;PFE&_f>s3^BqO6Zn{7hB+2W ja+J}V=0#50X&E{EXP`Gm?vD~8D5^pOL!f-@IKt|AcPD`_!OVvYkUud z`L_sh7w*M+1aT6l@iR31iKh8Nv|=?j<7K=t-$gK9QYhgp&f^a(xRse>71rYkY{4sd z7k!8!i7bxeBu?W8{00LTa0&C8g}4LTk-|8Rx%l}Qf8mDPglNH?Sc-?S4o_h-w&GRn z#2$Fy#{dpt0yFpoU*Q}42m^oP5}Fne1FcvA*Q5MAhE3Rxx9}cZ2qTUo$fJk~PU3T% z##x-lMKrZAI9jm+H!c)nF_vHz9>+#(!wz&T6fcMmc!RN-h(~v~JneDn)=<(rWyW$s4HsoYdINGYEN2GR>Y0A}Yvms0-!Hvh0?F`%>2^zB<=VJH9hi`jF?&M7 zNV-)aW2Pr%f3LM*b=XY^A^k)AJB9XkI|;1GsWGO#M&0FGqm@6Bg|LcEUu{xDdsS@I z?q}o+a&|ySPgpNzwAmxdU$hogPpDpxnHW^LL*(PIjAt)L^~9-j3id-Q_ep<2uSV6u zxG*M4dNOb1Q?hhSmR)1kS_45NnPpTtGkx8_Mt#^w_L{yvwZCwAcwe_n`DA)lMnd}D z8R@HP<)GR>!xozTd2wA|dtX#IVs`fnIU8kxc9o2bo4zm;&|I@2trBW)UuMlqO=VSA z*r<$a^!21=r6lx`wCRazm2TRL>Oe?XOZH3%S?|S)rsAbKLH$47;oR-q5))u>NsvvFqbbeG;Vom9-#_?Z1siL}#XXG0dc$>}4jol_GD z*=J1#>nc#N55JYL#&u!q$gc`zq<>l~=UAPvlH0f~|NB7YQqIjGYoy(k%o2$MV%?Njc|EJVZeS`*d%Hg0K&bT^6#rbc|QEuZ#Op8;zc6*){d-!WVD)52Dj|_5c6? delta 1142 zcmZwETS!xJ90%}UdBJQ>A$_QXh#(}N#224LDtoCYg0dHTFp#c97eaj5+@(#~@^aMK z+ML#urQ4iM*LJqHUh<_L0--|aAv*udc}Ws|&AxUP6m;No{{Qp8{Qke+|74p2jdk^h z%0=%r`sX>mSXWkJX|EtU1DBv1Zo>oU11ESufhh>XJfz_be1tU+unD{N5Sig1_@Ta% zs0G^L9CX1wScU?;uOthtqO%5H;RpPLvb{tmsDcB~3@6|`bift32|e%L{ts+a0HG)6STrGK02BMIG6nkA##abM47LBVIf6PLq5U z6tmf4Q=AfuNn*~Z?(z_i&G4~Au_;btOc^mZmuTsj^48pF(dQ>vPG#yW$#_g;?f>}@ zqY+Jg%-mr<9^(@WY-rY4s-?X$mE`VmX>}Gihv#I$wVv}ZcY>*7+Uo)<*u`TPdp5}i zrdZg|62rppkcA;O5cz$QWtR7Q5tIk4Y{;!!ZJ7RMwUJzyF*0EuRrf9J9J`QV>Zl$} z86nqmZZW#3rROwNWg(RZqH@{6$Dhdfw21py-p5?(dai#bNNy29S$vZFQeq&*t$lnV zFT$Ah@PMVC4ZJ{gd~gUiVN@ZPBD!m^cpt_NE&E(fM-YZP2DMB-342Vc^F|#cTz2WO zAyGmU=5--KX+uV;w7(`Tt!Qa~vEtzg;>pN*&X4kpvzm)lW>R`^^6#~B!J*|6J2{Re zxHqn4om&1W8?;HQT`^Y&%9%5%`(nym^{G1Cm+@OfR^h>rah9^R?_RkGPK&@)vb*+T F=`Uh_+g<SetReboundSize(50); lackView->SetDirection(1); /*初始化label*/ - InitLabelDefault(labeltitle, 83, 50, 300, 35, "labletitle", "通知"); - InitLabelDefault(labelmeage, 53, 276, 360, 40, "labelrecord", "暂无内容"); + InitLabelExt(labeltitle, 83, 50, 300, 35, "labletitle", STR_MESSAGE, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelmeage, 53, 276, 360, 40, "labelrecord", 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/traing/TrainingType.h b/code/sdk/application/wearable/fd230app/nativeui/traing/TrainingType.h new file mode 100644 index 000000000..daabd241a --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/TrainingType.h @@ -0,0 +1,186 @@ +/*** + * @Date: 2024-04-23 17:54:29 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-04-23 17:55:36 + * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/traing/TrainingType.h + */ +#ifndef TRAINING_TYPE_H +#define TRAINING_TYPE_H +#include "traing/include/TraingModel.h" +#include "uicomponents/UIComponents.h" +namespace OHOS +{ +#define MAX_TAININGNUM 176 + + struct training_data + { + Exercisetype sporttype; // 运动类 + UIResourceTextId sportId; // 运动项目 + ExerciseClass sport_cywee; // 在cywee里面对应的类型 + }; + + training_data tainging_indetail_data[MAX_TAININGNUM] = + { + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_FREETRAINING, ExerciseClass::FREE_TRAINING}, // 自由训练 + {Exercisetype::FITNESS, STR_EXERCISE_RESISTANCETRAINING, ExerciseClass::FREE_TRAINING}, // 肌力训练 + {Exercisetype::FITNESS, STR_EXERCISE_SPINBIKE, ExerciseClass::FREE_TRAINING}, // 飞轮车/室内健身车 + {Exercisetype::FITNESS, STR_EXERCISE_TREADMILL, ExerciseClass::FREE_TRAINING}, // 踏步机 + {Exercisetype::FITNESS, STR_EXERCISE_STROLLMACHINE, ExerciseClass::FREE_TRAINING}, // 漫步机 + {Exercisetype::FITNESS, STR_EXERCISE_HIIT, ExerciseClass::FREE_TRAINING}, // 高强度间歇训练 + {Exercisetype::FITNESS, STR_EXERCISE_CROSSFIT, ExerciseClass::FREE_TRAINING}, // 健身 + {Exercisetype::FITNESS, STR_EXERCISE_GROUPCALISTHENICS, ExerciseClass::FREE_TRAINING}, // 团体操 + {Exercisetype::FITNESS, STR_EXERCISE_YOGA, ExerciseClass::FREE_TRAINING}, // 瑜珈 + {Exercisetype::FITNESS, STR_EXERCISE_YOGACAT, ExerciseClass::FREE_TRAINING}, // 瑜珈猫式 + {Exercisetype::FITNESS, STR_EXERCISE_YOGACOW, ExerciseClass::FREE_TRAINING}, // 瑜珈牛式 + {Exercisetype::FITNESS, STR_EXERCISE_YOGACOBRA, ExerciseClass::FREE_TRAINING}, // 瑜珈眼镜蛇式 + {Exercisetype::FITNESS, STR_EXERCISE_YOGAHERO1, ExerciseClass::FREE_TRAINING}, // 瑜珈英雄式1 + {Exercisetype::FITNESS, STR_EXERCISE_YOGAHERO2, ExerciseClass::FREE_TRAINING}, // 瑜珈英雄式2 + {Exercisetype::FITNESS, STR_EXERCISE_YOGAHERO3, ExerciseClass::FREE_TRAINING}, // 瑜珈英雄式3 + {Exercisetype::FITNESS, STR_EXERCISE_YOGAROLLING, ExerciseClass::FREE_TRAINING}, // 瑜珈滚轮 + + {Exercisetype::FITNESS, STR_EXERCISE_OUTDOORWALKING, ExerciseClass::FREE_TRAINING}, // 室外走路 + {Exercisetype::FITNESS, STR_EXERCISE_OUTDOORRUNNING, ExerciseClass::OUTDOOR}, // 室外跑步 + {Exercisetype::FITNESS, STR_EXERCISE_INDOORWALKING, ExerciseClass::FREE_TRAINING}, // 室内走路 + {Exercisetype::FITNESS, STR_EXERCISE_INDOORRUNNING, ExerciseClass::INDOOR}, // 室内跑步 + {Exercisetype::FITNESS, STR_EXERCISE_OUTDOORBIKING, ExerciseClass::FREE_TRAINING}, // 室外骑行 + + {Exercisetype::FITNESS, STR_EXERCISE_JUMPINGROPE, ExerciseClass::FREE_TRAINING}, // 跳绳 + {Exercisetype::FITNESS, STR_EXERCISE_PILATES, ExerciseClass::FREE_TRAINING}, // 皮拉提斯 + {Exercisetype::FITNESS, STR_EXERCISE_CROSS_FIT, ExerciseClass::FREE_TRAINING}, // 混合健身 + {Exercisetype::FITNESS, STR_EXERCISE_FUNCTIONALTRAINING, ExerciseClass::FREE_TRAINING}, // 功能性训练 + {Exercisetype::FITNESS, STR_EXERCISE_PHYSICALTRAINING, ExerciseClass::FREE_TRAINING}, // 体能训练 + {Exercisetype::FITNESS, STR_EXERCISE_TAEKWONDO, ExerciseClass::FREE_TRAINING}, // 跆拳道/踢拳 + {Exercisetype::FITNESS, STR_EXERCISE_BOXING, ExerciseClass::FREE_TRAINING}, // 拳击 + {Exercisetype::FITNESS, STR_EXERCISE_KICKBOXING, ExerciseClass::FREE_TRAINING}, // 自由搏击 + {Exercisetype::FITNESS, STR_EXERCISE_KARATE, ExerciseClass::FREE_TRAINING}, // 空手道 + {Exercisetype::FITNESS, STR_EXERCISE_FENCING, ExerciseClass::FREE_TRAINING}, // 击剑 + {Exercisetype::FITNESS, STR_EXERCISE_CORETRAINING, ExerciseClass::FREE_TRAINING}, // 核心训练 + {Exercisetype::FITNESS, STR_EXERCISE_BODYCOMBAT, ExerciseClass::FREE_TRAINING}, // 拳击有氧 + {Exercisetype::FITNESS, STR_EXERCISE_KENDO, ExerciseClass::FREE_TRAINING}, // 剑道 + {Exercisetype::FITNESS, STR_EXERCISE_HORIZONTALBAR, ExerciseClass::FREE_TRAINING}, // 单杠 + {Exercisetype::FITNESS, STR_EXERCISE_PARALLELBARS, ExerciseClass::FREE_TRAINING}, // 双杠 + {Exercisetype::FITNESS, STR_EXERCISE_CIRCUIT, ExerciseClass::FREE_TRAINING}, // 循环训练 + {Exercisetype::FITNESS, STR_EXERCISE_AEROBICS, ExerciseClass::FREE_TRAINING}, // 有氧运动 + {Exercisetype::FITNESS, STR_EXERCISE_CALISTHENICE, ExerciseClass::FREE_TRAINING}, // 健美操 + {Exercisetype::FITNESS, STR_EXERCISE_P90X, ExerciseClass::FREE_TRAINING}, // P90X + {Exercisetype::FITNESS, STR_EXERCISE_KETTLEBELLTRAINING, ExerciseClass::FREE_TRAINING}, // 壶铃训练 + {Exercisetype::FITNESS, STR_EXERCISE_MIXEDMARTIALARTS, ExerciseClass::FREE_TRAINING}, // 综合格斗 + {Exercisetype::FITNESS, STR_EXERCISE_STAIRCLIMBINGMACHINE, ExerciseClass::FREE_TRAINING}, // 爬楼梯机 + {Exercisetype::FITNESS, STR_EXERCISE_WEIGHTLIFTING, ExerciseClass::FREE_TRAINING}, // 举重 + {Exercisetype::FITNESS, STR_EXERCISE_BARRE, ExerciseClass::FREE_TRAINING}, // Barre + {Exercisetype::FITNESS, STR_EXERCISE_HANDCYCLING, ExerciseClass::FREE_TRAINING}, // 手轮 + {Exercisetype::FITNESS, STR_EXERCISE_TRACKFIELD, ExerciseClass::FREE_TRAINING}, // 田径 + {Exercisetype::FITNESS, STR_EXERCISE_WRESTLING, ExerciseClass::FREE_TRAINING}, // 角力 + {Exercisetype::FITNESS, STR_EXERCISE_MINDBODY, ExerciseClass::FREE_TRAINING}, // 身心运动 + {Exercisetype::FITNESS, STR_EXERCISE_FLEXIBILITY, ExerciseClass::FREE_TRAINING}, // 柔软操 + {Exercisetype::FITNESS, STR_EXERCISE_MIXEDCARDIO, ExerciseClass::FREE_TRAINING}, // 混和有氧 + {Exercisetype::FITNESS, STR_EXERCISE_TRADITIONALSTRENGTHTRAINING, ExerciseClass::FREE_TRAINING}, // 传统肌力训练 + {Exercisetype::FITNESS, STR_EXERCISE_CROSSTRAINING, ExerciseClass::FREE_TRAINING}, // 交叉训练 + {Exercisetype::FITNESS, STR_EXERCISE_GYMNASTICS, ExerciseClass::FREE_TRAINING}, // 体操 + {Exercisetype::FITNESS, STR_EXERCISE_STEPTRAINING, ExerciseClass::FREE_TRAINING}, // 阶梯训练 + {Exercisetype::FITNESS, STR_EXERCISE_ELLIPTICALTRAINER, ExerciseClass::FREE_TRAINING}, // 椭圆机 + {Exercisetype::FITNESS, STR_EXERCISE_ROWINGMACHINE, ExerciseClass::FREE_TRAINING}, // 划船机 + + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + {Exercisetype::FITNESS, STR_EXERCISE_GENERAL, ExerciseClass::FREE_TRAINING}, // 一般训练 + }; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataView.cpp index a0e1a30fe..55a0a676b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataView.cpp @@ -80,13 +80,13 @@ namespace OHOS InitLabel(labeltype, 188, 52, 90, 35, "label1", "健身类", DEFAULT_VECTOR_FONT_FILENAME, 30); InitLabel(labelsport, 147, 140, 240, 35, "label6", "健走", DEFAULT_VECTOR_FONT_FILENAME, 30); InitLabel(labelduration, 146, 179, 240, 40, "label7", "13:00:22-15:00:12", DEFAULT_VECTOR_FONT_FILENAME, 28); - InitLabel(labelutag, 146, 252, 240, 40, "label8", "目标完成度", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labelutime, 146, 382, 240, 40, "label9", "训练时长", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labelumile, 146, 512, 240, 40, "label10", "距离(ç±³)", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labeluheart, 146, 642, 240, 40, "label11", "平均心率(次/分)", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labelusteps, 146, 772, 240, 40, "label12", "步数", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labelustrong, 146, 902, 240, 40, "label2", "训练强度", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labelnote, 80, 1024, 300, 40, "label8", "更多请前往APP查看", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelutag, 146, 252, 240, 40, "label8",STR_GOAL_ACCOMPLISHMENT_DEGREE, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelutime, 146, 382, 240, 40, "label9", STR_TRAINING_DURATION, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelumile, 146, 512, 240, 40, "label10", STR_RANGE_MILE, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labeluheart, 146, 642, 240, 40, "label11",STR_MEAN_HEART_RATE_MIN, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelusteps, 146, 772, 240, 40, "label12",STR_STEP_NUMBER, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelustrong, 146, 902, 240, 40, "label2", STR_TRAINING_INTENSITY, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelnote, 80, 1024, 300, 40, "label8", STR_MORE_APP, DEFAULT_VECTOR_FONT_FILENAME, 30); // 设置文本颜色 labelduration->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f)); @@ -129,7 +129,7 @@ namespace OHOS scrollView_->Add(labelsteps); // 初始化button - InitButtonExt(buttonexit, 42, 1111, 380, 100, BUTTONBACK, STR_OFF, 30); + InitButtonExt(buttonexit, 42, 1111, 380, 100, BUTTONBACK, STR_CLOSE, 30); buttonexit->SetOnClickListener(static_cast(TraingEnddataPresenter::GetInstance())); scrollView_->Add(buttonexit); } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp index d61dbde54..973b6fe6e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -728,7 +728,7 @@ namespace OHOS { sportdata->duration = g_motionTimes; // 训练时长 /*判断是否开启自动获取*/ - if (ConfigModel::GetInstance()->get_configData_bool(ConfigModel::CONFIGMODEL_ITEM_TRANING_AUTO)) + if (ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_TRANING_AUTO)) { freq = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_TRANING_FREQ); PRINT("freq%d\r\n", freq); // 获取实时数据频率 diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetView.cpp index 396ca94ad..42b483a0f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetView.cpp @@ -61,10 +61,10 @@ namespace OHOS // 初始化Lable UIResourceTextId sportid = TraingModel::GetInstance()->GetSportEvent(); InitLabelExt(labeltitle, 83, 50, 300, 35, "label1", sportid, DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labelTime, 100, 150, 150, 35, "label2", "时长", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labelKcal, 100, 270, 150, 35, "label4", "卡路里", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labelDistance, 100, 390, 150, 35, "label3", "距离", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labelSteps, 100, 510, 150, 35, "label5", "步数", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelTime, 100, 150, 150, 35, "label2", STR_DURATION, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelKcal, 100, 270, 150, 35, "label4", STR_CALORIE, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelDistance, 100, 390, 150, 35, "label3", STR_DISTANCE, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelSteps, 100, 510, 150, 35, "label5", STR_STEP_NUMBER, DEFAULT_VECTOR_FONT_FILENAME, 30); SetTagScrollView[SET_VIEW]->Add(labeltitle); SetTagScrollView[SET_VIEW]->Add(labelTime); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetCaluliView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetCaluliView.cpp index 0797a6529..b68c45d90 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetCaluliView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetCaluliView.cpp @@ -175,7 +175,7 @@ namespace OHOS SetCaluliScrollView->SetVerticalScrollState(false); // 禁止垂直滑动 /* -------------------------------------------------------------------------- */ // 初始化Lable - InitLabel(labeltitle_, 83, 50, 300, 35, "label1", "卡路里(千卡)", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labeltitle_, 83, 50, 300, 35, "label1",STR_CALORIE_SETTING, DEFAULT_VECTOR_FONT_FILENAME, 30); SetCaluliScrollView->Add(labeltitle_); // 初始化UIPicker diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetMileView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetMileView.cpp index 63d65fe9f..bc17316e9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetMileView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetMileView.cpp @@ -169,7 +169,7 @@ namespace OHOS SetMileScrollView->SetVerticalScrollState(false); // 禁止垂直滑动 /* -------------------------------------------------------------------------- */ // 初始化Lable - InitLabel(labeltitle_, 83, 50, 300, 35, "label1", "距离(公里)", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labeltitle_, 83, 50, 300, 35, "label1",STR_RANGE_SETTING, DEFAULT_VECTOR_FONT_FILENAME, 30); SetMileScrollView->Add(labeltitle_); // 初始化UIPicker diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetStepView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetStepView.cpp index cdffebd50..ad304e52f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetStepView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetStepView.cpp @@ -169,7 +169,7 @@ namespace OHOS SetStepScrollView->SetVerticalScrollState(false); // 禁止垂直滑动 /* -------------------------------------------------------------------------- */ // 初始化Lable - InitLabel(labeltitle_, 83, 50, 300, 35, "label1", "步数(æ­¥)", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labeltitle_, 83, 50, 300, 35, "label1", STR_STEP_SETTING, DEFAULT_VECTOR_FONT_FILENAME, 30); SetStepScrollView->Add(labeltitle_); // 初始化UIPicker diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetTimeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetTimeView.cpp index 188fe3b13..e608c1d3c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetTimeView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TrainingSetTimeView.cpp @@ -169,7 +169,7 @@ namespace OHOS SetTimeScrollView->SetVerticalScrollState(false); // 禁止垂直滑动 /* -------------------------------------------------------------------------- */ // 初始化Lable - InitLabel(labeltitle_, 83, 50, 300, 35, "label1", "时长(分钟)", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labeltitle_, 83, 50, 300, 35, "label1", STR_DURATION_SETTING, DEFAULT_VECTOR_FONT_FILENAME, 30); SetTimeScrollView->Add(labeltitle_); // 初始化UIPicker diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardView.cpp index 89a8fa0e4..b320479a2 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardView.cpp @@ -349,8 +349,8 @@ namespace OHOS endView->SetReboundSize(50); endView->SetDirection(1); - InitLabel(endtitle, 83, 50, 300, 35, "label1", "注意", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(notelabel, 56, 167, 360, 80, "label2", "当前运动量过少,无法记录 是否结束运动", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(endtitle, 83, 50, 300, 35, "label1", STR_LOOK_OUT, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(notelabel, 56, 167, 360, 80, "label2", STR_INSUFFICIENT_EXERCISE_AMOUNT, DEFAULT_VECTOR_FONT_FILENAME, 30); endView->Add(endtitle); endView->Add(notelabel); @@ -385,9 +385,9 @@ namespace OHOS getView->SetDirection(1); // 初始化Lable - InitLabel(labeltitle, 83, 50, 300, 35, "label1", "目标已达成", DEFAULT_VECTOR_FONT_FILENAME, 35); + InitLabelExt(labeltitle, 83, 50, 300, 35, "label1",STR_GOAL_ACHIEVED, DEFAULT_VECTOR_FONT_FILENAME, 35); getView->Add(labeltitle); - InitLabel(labelgettag, 103, 307, 200, 35, "label3", "完成目标", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelgettag, 103, 307, 200, 35, "label3", STR_ACCOMPLISH_GOAL, DEFAULT_VECTOR_FONT_FILENAME, 30); getView->Add(labelgettag); InitLabel(labelpre, 233, 307, 160, 35, "label3", "100%", DEFAULT_VECTOR_FONT_FILENAME, 30); getView->Add(labelpre); @@ -421,7 +421,7 @@ namespace OHOS heartView->SetDirection(1); // 初始化Lable - InitLabel(hearttitle, 83, 50, 300, 35, "label1", "心率提醒", DEFAULT_VECTOR_FONT_FILENAME, 35); + InitLabelExt(hearttitle, 83, 50, 300, 35, "label1", STR_HEARTTITLE, DEFAULT_VECTOR_FONT_FILENAME, 35); heartView->Add(hearttitle); int maxheart = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_TRAINING_HEART_MAX); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingControlView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingControlView.cpp index 96dd998a3..916d78e2b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingControlView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingControlView.cpp @@ -55,10 +55,10 @@ namespace OHOS Add(buttonStop); // 初始化Lable - InitLabel(labeltitle, 83, 50, 300, 35, "label1", "训练中", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labeltitle, 83, 50, 300, 35, "label1", STR_TRAINING_IN_PROGRESS, DEFAULT_VECTOR_FONT_FILENAME, 30); InitLabel(labeltimer, 78, 110, 290, 80, "label2", "00:00:00", DEFAULT_VECTOR_FONT_FILENAME, 65); - InitLabel(labelend, 81, 330, 130, 35, "label3", "结束", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(labelstop, 251, 330, 130, 35, "label4", "暂停", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelend, 81, 330, 130, 35, "label3", STR_FINISH, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelstop, 251, 330, 130, 35, "label4", STR_PAUSE, DEFAULT_VECTOR_FONT_FILENAME, 30); Add(labeltitle); Add(labeltimer); Add(labelend); 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 a68780771..dd4b8469b 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 @@ -46,9 +46,9 @@ namespace OHOS Add(lineimage2_); // 初始化Lable - InitLabel(u_milelabel, 16, 234, 220, 35, "label2", "距离(公里)", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(u_stepslabel, 73, 362, 320, 35, "label3", "步数", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(u_calorielabel, 225, 235, 230, 35, "label4", "卡路里(千卡)", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(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, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(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()); u_calorielabel->SetTextColor(Color::Gray()); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordView.cpp index 0db274499..0e495deef 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordView.cpp @@ -114,8 +114,8 @@ namespace OHOS lackView->SetReboundSize(50); lackView->SetDirection(1); /*初始化label*/ - InitLabelDefault(labeltitle_, 83, 50, 300, 35, "labletitle", "训练记录"); - InitLabelDefault(labelrecord_, 53, 260, 360, 40, "labelrecord", "无记录"); + InitLabelExt(labeltitle_, 83, 50, 300, 35, "labletitle", STR_TRAINGNO, DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(labelrecord_, 53, 260, 360, 40, "labelrecord", STR_TRAINGGO, DEFAULT_VECTOR_FONT_FILENAME, 30); /*初始化image*/ InitImageView(imagerecord, 174, 120, 118, 120, "image", RECOED_IMAGE); /*初始化按键*/ diff --git a/code/sdk/application/wearable/fd230app/nativeui/uicomponents/UIComponents.cpp b/code/sdk/application/wearable/fd230app/nativeui/uicomponents/UIComponents.cpp index 7f817d4d4..87c9fd1ed 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uicomponents/UIComponents.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/uicomponents/UIComponents.cpp @@ -267,4 +267,38 @@ namespace OHOS { InitLabel(label, x, y, width, height, viewId, text, fontName, fontSize); } + + /*更新label的数字*/ + void UpdateLabel(UILabelExt *&label, int num) + { + std::string str = label->GetText(); + std::string numStr = std::to_string(num); + printf("UpdateLabel:%s->%d\r\n", str.c_str(), num); + + // 找到标志"XX"在字符串中的位置 + size_t pos = str.find("XX"); + if (pos != std::string::npos) + { + // 替换标志"XX"为数字字符串 + str.replace(pos, 2, numStr); // 2 是标志"XX"的长度 + } + + label->SetText(str.c_str()); + } + + /*更新label的字符串*/ + void UpdateLabel(UILabelExt *&label, const std::string updatestr) + { + std::string str = label->GetText(); + printf("UpdateLabel:%s->%s\r\n", str.c_str(), updatestr.c_str()); + // 找到标志"XX"在字符串中的位置 + size_t pos = str.find("XX"); + if (pos != std::string::npos) + { + // 替换标志"XX"为数字字符串 + str.replace(pos, 2, updatestr); // 2 是标志"XX"的长度 + } + + label->SetText(str.c_str()); + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/uicomponents/UIComponents.h b/code/sdk/application/wearable/fd230app/nativeui/uicomponents/UIComponents.h index 1b5d04f5c..7b0164af3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uicomponents/UIComponents.h +++ b/code/sdk/application/wearable/fd230app/nativeui/uicomponents/UIComponents.h @@ -1,3 +1,9 @@ +/*** + * @Date: 2024-04-25 10:56:15 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-05-06 18:24:03 + * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/uicomponents/UIComponents.h + */ /*** * @Date: 2024-04-23 16:04:31 * @LastEditors: Caisking 3449750381@qq.com @@ -46,5 +52,10 @@ namespace OHOS /*InitLabel[默认参数]*/ void InitLabelDefault(UILabelExt *&label, int x, int y, int width, int height, const char *viewId, const char *text, int fontSize = 30, const char *fontName = DEFAULT_VECTOR_FONT_FILENAME); + /*更新label的数字*/ + void UpdateLabel(UILabelExt *&label, int num); + /*更新label的字符串*/ + void UpdateLabel(UILabelExt *&label, const std::string updatestr); + } #endif // UICOMPONENTS_H \ No newline at end of file -- 2.17.1