From: Caisking <3449750381@qq.com> Date: Fri, 29 Mar 2024 07:14:54 +0000 (+0800) Subject: 实现训练项目传递到Model;实现训练项长文本滚动显示 X-Git-Tag: release_V1.2.70_20241020_135402~1241^2~19^2~2 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=a1b1b2a147f692c62ada8b24600916e0c4b5ff74;p=mirrors%2FFD230.git 实现训练项目传递到Model;实现训练项长文本滚动显示 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h index 44714bf8c..14c370689 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h @@ -1,4 +1,11 @@ - +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-20 15:35:57 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-29 11:49:27 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #ifndef Traing_MODEL_H #define Traing_MODEL_H @@ -23,7 +30,7 @@ #include "traing/include/TraingModel.h" #include "traing/Training_UiConfig.h" #include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" +#include "language/font/ui_resource_string.h" #include "traing/include/TraingModel.h" #include "traing/Training_UiConfig.h" @@ -56,8 +63,8 @@ namespace OHOS TraingModel(); ~TraingModel(); static TraingModel *GetInstance(void); - bool InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize); - bool InitLabelExt(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize); + bool InitLabel(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize); + bool InitLabelExt(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, UIResourceTextId id, const char *fontName, int fontSize); bool InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId); bool InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath); void InitList(); @@ -69,11 +76,15 @@ namespace OHOS void StopTimer(void); char *ShowTimer(void); + void SetSportEvent(UIResourceTextId id); + UIResourceTextId GetSportEvent(); + private: TraingModel(const TraingModel &) = delete; TraingModel &operator=(const TraingModel &) = delete; - std::string trainingTimer; // 训练时长 + std::string trainingTimer_; // 训练时长 + UIResourceTextId sportId_ = STR_EXTREME_SPORTS; // 训练项目 }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlView.cpp index 5578eadcb..2fe0e4a73 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingControlView.cpp @@ -57,10 +57,10 @@ namespace OHOS container_->Add(button2_); // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 188, 52, 90, 35, "label1", "训练中", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label2_, 98, 110, 60, 35, "label2", "00:00:00", DEFAULT_VECTOR_FONT_FILENAME, 65); - TraingModel::GetInstance()->InitLabelExt(label3_, 125, 324, 60, 40, "label3", "结束", DEFAULT_VECTOR_FONT_FILENAME, 20); - TraingModel::GetInstance()->InitLabelExt(label4_, 280, 324, 60, 40, "label4", "暂停", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label1_, 188, 52, 90, 35, "label1", "训练中", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 98, 110, 60, 35, "label2", "00:00:00", DEFAULT_VECTOR_FONT_FILENAME, 65); + TraingModel::GetInstance()->InitLabel(label3_, 125, 324, 60, 40, "label3", "结束", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label4_, 280, 324, 60, 40, "label4", "暂停", DEFAULT_VECTOR_FONT_FILENAME, 20); container_->Add(label1_); container_->Add(label2_); container_->Add(label3_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataView.cpp index 53f79031a..76fc84518 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDataView.cpp @@ -54,11 +54,11 @@ namespace OHOS container_->Add(image4_); container_->Add(image5_); // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 185, 60, 90, 35, "label1", "23:54", DEFAULT_VECTOR_FONT_FILENAME, 40); - TraingModel::GetInstance()->InitLabelExt(label2_, 158, 120, 150, 35, "label2", "跳绳运动中", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label3_, 90, 175, 60, 40, "label3", "00:31:26", DEFAULT_VECTOR_FONT_FILENAME, 80); - TraingModel::GetInstance()->InitLabelExt(label4_, 150, 276, 60, 40, "label4", "144", DEFAULT_VECTOR_FONT_FILENAME, 23); - TraingModel::GetInstance()->InitLabelExt(label5_, 167, 350, 60, 40, "label4", "中等强度", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label1_, 185, 60, 90, 35, "label1", "23:54", DEFAULT_VECTOR_FONT_FILENAME, 40); + TraingModel::GetInstance()->InitLabel(label2_, 158, 120, 150, 35, "label2", "跳绳运动中", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label3_, 90, 175, 60, 40, "label3", "00:31:26", DEFAULT_VECTOR_FONT_FILENAME, 80); + TraingModel::GetInstance()->InitLabel(label4_, 150, 276, 60, 40, "label4", "144", DEFAULT_VECTOR_FONT_FILENAME, 23); + TraingModel::GetInstance()->InitLabel(label5_, 167, 350, 60, 40, "label4", "中等强度", DEFAULT_VECTOR_FONT_FILENAME, 26); container_->Add(label1_); container_->Add(label2_); container_->Add(label3_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailView.cpp index 5470ca092..e40c94d54 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingDetailView.cpp @@ -61,14 +61,14 @@ namespace OHOS container_->Add(image6_); container_->Add(image7_); // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 174, 60, 90, 35, "label1", "心率(次/分)", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label2_, 80, 190, 60, 40, "label2", "距离(公里)", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label3_, 332, 189, 60, 40, "label3", "步数", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label4_, 167, 336, 60, 40, "label4", "卡路里(千卡)", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label5_, 202, 94, 60, 40, "label5", "144", DEFAULT_VECTOR_FONT_FILENAME, 40); - TraingModel::GetInstance()->InitLabelExt(label6_, 76, 233, 60, 40, "label6", "13.21", DEFAULT_VECTOR_FONT_FILENAME, 40); - TraingModel::GetInstance()->InitLabelExt(label7_, 300, 233, 60, 40, "label7", "28312", DEFAULT_VECTOR_FONT_FILENAME, 40); - TraingModel::GetInstance()->InitLabelExt(label8_, 175, 376, 60, 40, "label8", "210.03", DEFAULT_VECTOR_FONT_FILENAME, 40); + TraingModel::GetInstance()->InitLabel(label1_, 174, 60, 90, 35, "label1", "心率(次/分)", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label2_, 80, 190, 60, 40, "label2", "距离(公里)", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label3_, 332, 189, 60, 40, "label3", "步数", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label4_, 167, 336, 60, 40, "label4", "卡路里(千卡)", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label5_, 202, 94, 60, 40, "label5", "144", DEFAULT_VECTOR_FONT_FILENAME, 40); + TraingModel::GetInstance()->InitLabel(label6_, 76, 233, 60, 40, "label6", "13.21", DEFAULT_VECTOR_FONT_FILENAME, 40); + TraingModel::GetInstance()->InitLabel(label7_, 300, 233, 60, 40, "label7", "28312", DEFAULT_VECTOR_FONT_FILENAME, 40); + TraingModel::GetInstance()->InitLabel(label8_, 175, 376, 60, 40, "label8", "210.03", DEFAULT_VECTOR_FONT_FILENAME, 40); container_->Add(label1_); container_->Add(label2_); container_->Add(label3_); 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 f83b6f913..a76b1c98f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataView.cpp @@ -87,20 +87,20 @@ namespace OHOS scrollView1_->Add(button1_); // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 188, 52, 90, 35, "label1", "健身类", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label2_, 220, 140, 60, 40, "label2", "达标", DEFAULT_VECTOR_FONT_FILENAME, 20); - TraingModel::GetInstance()->InitLabelExt(label3_, 114, 252, 60, 40, "label3", "终", DEFAULT_VECTOR_FONT_FILENAME, 20); - TraingModel::GetInstance()->InitLabelExt(label4_, 172, 284, 60, 40, "label4", "èµ·", DEFAULT_VECTOR_FONT_FILENAME, 20); - TraingModel::GetInstance()->InitLabelExt(label5_, 155, 372, 60, 40, "label5", "距离:8.3KM", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label6_, 146, 478, 60, 40, "label6", "健走", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label7_, 146, 517, 60, 40, "label7", "13:00:22-15:00:12", DEFAULT_VECTOR_FONT_FILENAME, 28); - - TraingModel::GetInstance()->InitLabelExt(label8_, 146, 590, 60, 40, "label8", "目标完成度", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label9_, 146, 720, 60, 40, "label9", "训练时长", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label10_, 146, 850, 60, 40, "label10", "距离(ç±³)", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label11_, 146, 980, 60, 40, "label11", "平均心率(次/分)", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label12_, 146, 1110, 60, 40, "label2", "训练强度", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label18_, 155, 1232, 60, 40, "label8", "更多数据请前往手机\nAPP“小希爱玩”查看", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label1_, 188, 52, 90, 35, "label1", "健身类", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 220, 140, 60, 40, "label2", "达标", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label3_, 114, 252, 60, 40, "label3", "终", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label4_, 172, 284, 60, 40, "label4", "èµ·", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label5_, 155, 372, 60, 40, "label5", "距离:8.3KM", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label6_, 146, 478, 60, 40, "label6", "健走", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label7_, 146, 517, 60, 40, "label7", "13:00:22-15:00:12", DEFAULT_VECTOR_FONT_FILENAME, 28); + + TraingModel::GetInstance()->InitLabel(label8_, 146, 590, 60, 40, "label8", "目标完成度", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label9_, 146, 720, 60, 40, "label9", "训练时长", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label10_, 146, 850, 60, 40, "label10", "距离(ç±³)", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label11_, 146, 980, 60, 40, "label11", "平均心率(次/分)", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label12_, 146, 1110, 60, 40, "label2", "训练强度", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label18_, 155, 1232, 60, 40, "label8", "更多数据请前往手机\nAPP“小希爱玩”查看", DEFAULT_VECTOR_FONT_FILENAME, 26); label7_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f)); label8_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f)); @@ -110,17 +110,17 @@ namespace OHOS label12_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f)); label18_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f)); - TraingModel::GetInstance()->InitLabelExt(label13_, 146, 626, 60, 40, "label18", "226%", DEFAULT_VECTOR_FONT_FILENAME, 40); + TraingModel::GetInstance()->InitLabel(label13_, 146, 626, 60, 40, "label18", "226%", DEFAULT_VECTOR_FONT_FILENAME, 40); label13_->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff)); - TraingModel::GetInstance()->InitLabelExt(label14_, 146, 756, 60, 40, "label14", "05:45:46", DEFAULT_VECTOR_FONT_FILENAME, 40); + TraingModel::GetInstance()->InitLabel(label14_, 146, 756, 60, 40, "label14", "05:45:46", DEFAULT_VECTOR_FONT_FILENAME, 40); label14_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x8a, 0x36, 0xff)); - TraingModel::GetInstance()->InitLabelExt(label15_, 146, 886, 60, 40, "label15", "8,301", DEFAULT_VECTOR_FONT_FILENAME, 40); + TraingModel::GetInstance()->InitLabel(label15_, 146, 886, 60, 40, "label15", "8,301", DEFAULT_VECTOR_FONT_FILENAME, 40); label15_->SetTextColor(Color::GetColorFromRGBA(0x36, 0x4a, 0xff, 0xff)); - TraingModel::GetInstance()->InitLabelExt(label16_, 146, 1016, 60, 40, "label16", "144", DEFAULT_VECTOR_FONT_FILENAME, 40); + TraingModel::GetInstance()->InitLabel(label16_, 146, 1016, 60, 40, "label16", "144", DEFAULT_VECTOR_FONT_FILENAME, 40); label16_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff)); - TraingModel::GetInstance()->InitLabelExt(label17_, 146, 1146, 60, 40, "label17", "中等强度", DEFAULT_VECTOR_FONT_FILENAME, 40); + TraingModel::GetInstance()->InitLabel(label17_, 146, 1146, 60, 40, "label17", "中等强度", DEFAULT_VECTOR_FONT_FILENAME, 40); label17_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff)); - TraingModel::GetInstance()->InitLabelExt(label19_, 201, 1348, 60, 40, "label19", "关闭", DEFAULT_VECTOR_FONT_FILENAME, 31); + TraingModel::GetInstance()->InitLabel(label19_, 201, 1348, 60, 40, "label19", "关闭", DEFAULT_VECTOR_FONT_FILENAME, 31); scrollView1_->Add(label1_); scrollView1_->Add(label2_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2View.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2View.cpp index 3332c876f..18e43c786 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2View.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2View.cpp @@ -44,8 +44,8 @@ namespace OHOS } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 203, 52, 90, 35, "label1", "注意", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label2_, 56, 167, 60, 40, "label2", "当前运动量太小,无法记录\n是否结束运动", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label1_, 203, 52, 90, 35, "label1", "注意", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 56, 167, 60, 40, "label2", "当前运动量太小,无法记录\n是否结束运动", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label1_); container_->Add(label2_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnoteView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnoteView.cpp index b6c99eac5..53675c23f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnoteView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnoteView.cpp @@ -44,8 +44,8 @@ namespace OHOS } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 173, 52, 90, 35, "label1", "结束运动", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label2_, 116, 187, 60, 40, "label2", "是否结束本次运动", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label1_, 173, 52, 90, 35, "label1", "结束运动", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 116, 187, 60, 40, "label2", "是否结束本次运动", DEFAULT_VECTOR_FONT_FILENAME, 26); container_->Add(label1_); container_->Add(label2_); 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 f68cb483a..07496416b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp @@ -83,12 +83,12 @@ namespace OHOS * @return * @brief 初始化标签 */ - bool TraingModel::InitLabel(UILabel *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize) + bool TraingModel::InitLabel(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize) { // 检查标签指针是否为空 if (label == nullptr) { - label = new UILabel(); + label = new UILabelExt(); } if (label == nullptr) { @@ -127,7 +127,7 @@ namespace OHOS * @return {*} * @brief 初始化多国语言标签 */ - bool TraingModel::InitLabelExt(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize) + bool TraingModel::InitLabelExt(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, UIResourceTextId id, const char *fontName, int fontSize) { // 检查标签指针是否为空 if (label == nullptr) @@ -147,11 +147,11 @@ namespace OHOS label->SetStyle(STYLE_TEXT_FONT, fontSize); label->SetFont(fontName, fontSize); // 设置标签的文本和其他属性 - label->SetText(text); + label->SetTextId(id); // label->SetFontId(); - label->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label->SetRollSpeed(0); + label->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); + label->SetRollSpeed(100); // 设置标签可见 label->SetVisible(true); // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingModel::InitLabelExt is succeed"); @@ -221,6 +221,15 @@ namespace OHOS return true; } + void TraingModel::SetSportEvent(UIResourceTextId id) + { + sportId_ = id; + } + UIResourceTextId TraingModel::GetSportEvent() + { + return sportId_; + } + #if TIMER /* * @brief 在这里添加定时器到期后的处理逻辑 diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalView.cpp index 9ba235bb5..131c57e61 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalView.cpp @@ -43,10 +43,11 @@ namespace OHOS container_->SetStyle(STYLE_BACKGROUND_OPA, 0); } + UIResourceTextId sport_id = TraingModel::GetInstance()->GetSportEvent(); // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 137, 52, 195, 35, "label1", "高空弹跳/蹦极", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabelExt(label1_, 137, 52, 195, 35, "label1", sport_id, DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label1_); - TraingModel::GetInstance()->InitLabelExt(label2_, 160, 370, 146, 35, "label2", "设定目标 >", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 160, 370, 146, 35, "label2", "设定目标 >", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label2_); // 初始化Button TraingModel::GetInstance()->InitButton(button1_, 133, 133, 200, 200, BUTTONGO); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetCaluliView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetCaluliView.cpp index 06141f6fc..bc7ea09b7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetCaluliView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetCaluliView.cpp @@ -109,7 +109,7 @@ namespace OHOS container_->SetStyle(STYLE_BACKGROUND_OPA, 0); } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 173, 52, 120, 35, "label1", "卡路里设定", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label1_, 173, 52, 120, 35, "label1", "卡路里设定", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label1_); // 初始化UIPicker diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetDistView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetDistView.cpp index bcbaf84d3..c378c81cd 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetDistView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetDistView.cpp @@ -110,7 +110,7 @@ namespace OHOS container_->SetStyle(STYLE_BACKGROUND_OPA, 0); } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 173, 52, 120, 35, "label1", "步数设定", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label1_, 173, 52, 120, 35, "label1", "步数设定", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label1_); // 初始化UIPicker diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetSeptView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetSeptView.cpp index 1c6408ff1..8e282bb2b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetSeptView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetSeptView.cpp @@ -109,7 +109,7 @@ namespace OHOS container_->SetStyle(STYLE_BACKGROUND_OPA, 0); } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 173, 52, 120, 35, "label1", "步数设定", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label1_, 173, 52, 120, 35, "label1", "步数设定", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label1_); // 初始化UIPicker diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetTimeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetTimeView.cpp index f2d761b53..ff770a7a6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetTimeView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetTimeView.cpp @@ -109,7 +109,7 @@ namespace OHOS container_->SetStyle(STYLE_BACKGROUND_OPA, 0); } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 173, 52, 120, 35, "label1", "时长设定", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label1_, 173, 52, 120, 35, "label1", "时长设定", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label1_); // 初始化UIPicker 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 1203ece44..6d22528ec 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetView.cpp @@ -52,11 +52,11 @@ namespace OHOS container_->Add(button2_); // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 173, 52, 120, 35, "label1", "极限运动", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label2_, 130, 150, 60, 35, "label2", "时长", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label3_, 270, 155, 69, 23, "label3", "30 分钟", DEFAULT_VECTOR_FONT_FILENAME, 20); - TraingModel::GetInstance()->InitLabelExt(label4_, 130, 270, 60, 35, "label4", "卡路里", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label5_, 270, 275, 60, 35, "label5", "1000 千卡", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label1_, 173, 52, 120, 35, "label1", "极限运动", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 130, 150, 60, 35, "label2", "时长", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label3_, 270, 155, 69, 23, "label3", "30 分钟", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label4_, 130, 270, 60, 35, "label4", "卡路里", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label5_, 270, 275, 60, 35, "label5", "1000 千卡", DEFAULT_VECTOR_FONT_FILENAME, 20); container_->Add(label1_); container_->Add(label2_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongView.cpp index e810e2351..5f5a3f416 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongView.cpp @@ -61,12 +61,12 @@ namespace OHOS scrollView1_->SetVisible(true); // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 52, 173, 120, 35, "label1", "训练强度", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label2_, 133, 33, 60, 35, "label2", "训练强度用于判断是否训练不足或\n者训练太过,到底使心率增加多少\n的运动强度才是最合适的。", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label3_, 305, 33, 69, 23, "label3", "该强度区间是对应靶心率(由个人\n基本资料计算得出)强弱的实时状\n态显示,有助于提高训练质量。", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label4_, 465, 33, 60, 35, "label4", "训练状态代表的意义:", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label5_, 505, 97, 60, 35, "label5", "较低强度-热身运动\n中等强度-燃脂区\n高等强度-提升心肺机能\n超高强度-专业运动员", DEFAULT_VECTOR_FONT_FILENAME, 26); - TraingModel::GetInstance()->InitLabelExt(label6_, 740, 51, 60, 35, "label5", "注:该训练强度并非专业运动评\n估,数据仅供参考。", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label1_, 52, 173, 120, 35, "label1", "训练强度", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 133, 33, 60, 35, "label2", "训练强度用于判断是否训练不足或\n者训练太过,到底使心率增加多少\n的运动强度才是最合适的。", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label3_, 305, 33, 69, 23, "label3", "该强度区间是对应靶心率(由个人\n基本资料计算得出)强弱的实时状\n态显示,有助于提高训练质量。", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label4_, 465, 33, 60, 35, "label4", "训练状态代表的意义:", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label5_, 505, 97, 60, 35, "label5", "较低强度-热身运动\n中等强度-燃脂区\n高等强度-提升心肺机能\n超高强度-专业运动员", DEFAULT_VECTOR_FONT_FILENAME, 26); + TraingModel::GetInstance()->InitLabel(label6_, 740, 51, 60, 35, "label5", "注:该训练强度并非专业运动评\n估,数据仅供参考。", DEFAULT_VECTOR_FONT_FILENAME, 26); label6_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x8a, 0x36, 0xff)); scrollView1_->Add(label1_); scrollView1_->Add(label2_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingView.cpp index f0d7a59ed..dd97ffbbb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingView.cpp @@ -71,13 +71,13 @@ namespace OHOS { // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingModel::AddLabel"); // 初始化标签 - TraingModel::GetInstance()->InitLabelExt(title_label, TITLE_LABEL_X, TITLE_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "title_label", "快速训练", DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE); + TraingModel::GetInstance()->InitLabel(title_label, TITLE_LABEL_X, TITLE_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "title_label", "快速训练", DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE); const char *dataStr1 = (data->training1_Text).c_str(); const char *dataStr2 = (data->training2_Text).c_str(); const char *dataStr3 = (data->training3_Text).c_str(); - TraingModel::GetInstance()->InitLabelExt(btn1_label, BTN1_LABEL_X, BTN1_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "btu1_label", dataStr1, DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE); - TraingModel::GetInstance()->InitLabelExt(btn2_label, BTN2_LABEL_X, BTN2_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "btu2_label", dataStr2, DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE); - TraingModel::GetInstance()->InitLabelExt(btn3_label, BTN3_LABEL_X, BTN3_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "btu3_label", dataStr3, DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE); + TraingModel::GetInstance()->InitLabel(btn1_label, BTN1_LABEL_X, BTN1_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "btu1_label", dataStr1, DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE); + TraingModel::GetInstance()->InitLabel(btn2_label, BTN2_LABEL_X, BTN2_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "btu2_label", dataStr2, DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE); + TraingModel::GetInstance()->InitLabel(btn3_label, BTN3_LABEL_X, BTN3_LABEL_Y, LABEL_X_SIZE, LABEL_Y_SIZE, "btu3_label", dataStr3, DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT_SIZE); return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinView.cpp index bbd9a44da..d64c54b8f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinView.cpp @@ -119,14 +119,14 @@ namespace OHOS } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 155, 52, 195, 35, "label1", "目标已达成", DEFAULT_VECTOR_FONT_FILENAME, 35); + TraingModel::GetInstance()->InitLabel(label1_, 155, 52, 195, 35, "label1", "目标已达成", DEFAULT_VECTOR_FONT_FILENAME, 35); container_->Add(label1_); - TraingModel::GetInstance()->InitLabelExt(label2_, 108, 215, 146, 35, "label2", "10,000", DEFAULT_VECTOR_FONT_FILENAME, 80); + TraingModel::GetInstance()->InitLabel(label2_, 108, 215, 146, 35, "label2", "10,000", DEFAULT_VECTOR_FONT_FILENAME, 80); label2_->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff)); container_->Add(label2_); - TraingModel::GetInstance()->InitLabelExt(label3_, 132, 307, 146, 35, "label3", "完成目标", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label3_, 132, 307, 146, 35, "label3", "完成目标", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label3_); - TraingModel::GetInstance()->InitLabelExt(label4_, 280, 307, 146, 35, "label3", "100%", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label4_, 280, 307, 146, 35, "label3", "100%", DEFAULT_VECTOR_FONT_FILENAME, 30); label4_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f)); container_->Add(label4_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSView.cpp index 1c0712e69..b769a1d79 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSView.cpp @@ -43,13 +43,13 @@ namespace OHOS } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 203, 52, 195, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label1_, 203, 52, 195, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label1_); - TraingModel::GetInstance()->InitLabelExt(label2_, 160, 370, 146, 35, "label2", "设定目标 >", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 160, 370, 146, 35, "label2", "设定目标 >", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label2_); - TraingModel::GetInstance()->InitLabelExt(label3_, 41, 237, 54, 41, "lable3", "144", DEFAULT_VECTOR_FONT_FILENAME, 35); + TraingModel::GetInstance()->InitLabel(label3_, 41, 237, 54, 41, "lable3", "144", DEFAULT_VECTOR_FONT_FILENAME, 35); container_->Add(label3_); - TraingModel::GetInstance()->InitLabelExt(label4_, 361, 237, 54, 41, "lable4", "GPS", DEFAULT_VECTOR_FONT_FILENAME, 35); + TraingModel::GetInstance()->InitLabel(label4_, 361, 237, 54, 41, "lable4", "GPS", DEFAULT_VECTOR_FONT_FILENAME, 35); container_->Add(label4_); // 初始化image TraingModel::GetInstance()->InitImageView(image1_, 48, 193, 40, 40, "image1", HEARTRATE_1_IMAGE); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSbackView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSbackView.cpp index 9ba146b35..d4957f1f3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSbackView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSbackView.cpp @@ -42,9 +42,9 @@ namespace OHOS } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 175, 52, 195, 35, "label1", "GPS连接", DEFAULT_VECTOR_FONT_FILENAME, 35); + TraingModel::GetInstance()->InitLabel(label1_, 175, 52, 195, 35, "label1", "GPS连接", DEFAULT_VECTOR_FONT_FILENAME, 35); container_->Add(label1_); - TraingModel::GetInstance()->InitLabelExt(label2_, 55, 253, 146, 35, "label2", "GPS已连接,当前信号正常", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 55, 253, 146, 35, "label2", "GPS已连接,当前信号正常", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label2_); // 初始化image diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSlackView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSlackView.cpp index e6bd415eb..a0a2fb33c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSlackView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSlackView.cpp @@ -44,13 +44,13 @@ namespace OHOS } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 203, 52, 195, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label1_, 203, 52, 195, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label1_); - TraingModel::GetInstance()->InitLabelExt(label2_, 160, 370, 146, 35, "label2", "设定目标 >", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 160, 370, 146, 35, "label2", "设定目标 >", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label2_); - TraingModel::GetInstance()->InitLabelExt(label3_, 41, 237, 54, 41, "lable3", "--", DEFAULT_VECTOR_FONT_FILENAME, 35); + TraingModel::GetInstance()->InitLabel(label3_, 41, 237, 54, 41, "lable3", "--", DEFAULT_VECTOR_FONT_FILENAME, 35); container_->Add(label3_); - TraingModel::GetInstance()->InitLabelExt(label4_, 361, 237, 54, 41, "lable4", "--", DEFAULT_VECTOR_FONT_FILENAME, 35); + TraingModel::GetInstance()->InitLabel(label4_, 361, 237, 54, 41, "lable4", "--", DEFAULT_VECTOR_FONT_FILENAME, 35); container_->Add(label4_); // 初始化image TraingModel::GetInstance()->InitImageView(image1_, 48, 193, 40, 40, "image1", HEARTRATE_2_IMAGE); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSlostView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSlostView.cpp index b7c24621c..8839621d7 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSlostView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSlostView.cpp @@ -44,9 +44,9 @@ namespace OHOS } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 175, 52, 195, 35, "label1", "GPS丢失", DEFAULT_VECTOR_FONT_FILENAME, 35); + TraingModel::GetInstance()->InitLabel(label1_, 175, 52, 195, 35, "label1", "GPS丢失", DEFAULT_VECTOR_FONT_FILENAME, 35); container_->Add(label1_); - TraingModel::GetInstance()->InitLabelExt(label2_, 55, 253, 146, 35, "label2", "当前位置搜索不到GPS信号", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 55, 253, 146, 35, "label2", "当前位置搜索不到GPS信号", DEFAULT_VECTOR_FONT_FILENAME, 30); container_->Add(label2_); // 初始化image diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSnoteView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSnoteView.cpp index bc53b07ff..6d1206458 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSnoteView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSnoteView.cpp @@ -72,10 +72,10 @@ namespace OHOS scrollView1_->Add(button2_); // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 160, 52, 90, 35, "label1", "GPS未准备", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label2_, 33, 215, 60, 40, "label2", "GPS仍在定位,建议等待定位\n完成后再开始训练", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label3_, 181, 357, 60, 40, "label3", "继续等待", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label4_, 181, 457, 60, 40, "label4", "直接开始", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label1_, 160, 52, 90, 35, "label1", "GPS未准备", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 33, 215, 60, 40, "label2", "GPS仍在定位,建议等待定位\n完成后再开始训练", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label3_, 181, 357, 60, 40, "label3", "继续等待", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label4_, 181, 457, 60, 40, "label4", "直接开始", DEFAULT_VECTOR_FONT_FILENAME, 30); scrollView1_->Add(label1_); scrollView1_->Add(label2_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSsetView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSsetView.cpp index cb8fbe8e7..851942c85 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSsetView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_GPS/src/TraingGPSsetView.cpp @@ -134,11 +134,11 @@ namespace OHOS scrollView1_->Add(image4_); // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 203, 52, 120, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabelExt(label2_, 300, 160, 60, 35, "label2", "30 分钟", DEFAULT_VECTOR_FONT_FILENAME, 20); - TraingModel::GetInstance()->InitLabelExt(label3_, 300, 280, 69, 23, "label3", "5 公里", DEFAULT_VECTOR_FONT_FILENAME, 20); - TraingModel::GetInstance()->InitLabelExt(label4_, 300, 400, 60, 35, "label4", "500 千卡", DEFAULT_VECTOR_FONT_FILENAME, 20); - TraingModel::GetInstance()->InitLabelExt(label5_, 300, 520, 60, 35, "label5", "2000 æ­¥", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label1_, 203, 52, 120, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label2_, 300, 160, 60, 35, "label2", "30 分钟", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label3_, 300, 280, 69, 23, "label3", "5 公里", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label4_, 300, 400, 60, 35, "label4", "500 千卡", DEFAULT_VECTOR_FONT_FILENAME, 20); + TraingModel::GetInstance()->InitLabel(label5_, 300, 520, 60, 35, "label5", "2000 æ­¥", DEFAULT_VECTOR_FONT_FILENAME, 20); scrollView1_->Add(label1_); scrollView1_->Add(label2_); scrollView1_->Add(label3_); 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 6c914a9f8..54d327615 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 @@ -49,9 +49,9 @@ namespace OHOS } // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 0, 55, 466, 466, "label1", "训练", DEFAULT_VECTOR_FONT_FILENAME, 200); - TraingModel::GetInstance()->InitLabelExt(label2_, 0, 55, 466, 466, "label2", "暂停", DEFAULT_VECTOR_FONT_FILENAME, 200); - TraingModel::GetInstance()->InitLabelExt(label3_, 0, 55, 466, 466, "label3", "结束", DEFAULT_VECTOR_FONT_FILENAME, 200); + TraingModel::GetInstance()->InitLabel(label1_, 0, 55, 466, 466, "label1", "训练", DEFAULT_VECTOR_FONT_FILENAME, 200); + TraingModel::GetInstance()->InitLabel(label2_, 0, 55, 466, 466, "label2", "暂停", DEFAULT_VECTOR_FONT_FILENAME, 200); + TraingModel::GetInstance()->InitLabel(label3_, 0, 55, 466, 466, "label3", "结束", DEFAULT_VECTOR_FONT_FILENAME, 200); swipe_->Add(label1_); swipe_->Add(label2_); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/include/TraingDanceItemView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/include/TraingDanceItemView.h index ff6b44684..7682fd2de 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/include/TraingDanceItemView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/include/TraingDanceItemView.h @@ -42,7 +42,7 @@ namespace OHOS virtual void SetItemInfo(const TraingDanceItem itemInfo); virtual void SetUpChild(); AppViewId GetTraingDanceIndex(); - + UIResourceTextId GetTraingDanceId(); private: TraingDanceItemView(const TraingDanceItemView &); UIImageView sbackground; // 背景 diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDanceItemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDanceItemView.cpp index 4b907bd49..5755fa3da 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDanceItemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDanceItemView.cpp @@ -1,9 +1,17 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-27 15:25:02 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-29 11:45:56 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDanceItemView.cpp + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #include "traing/training_list_dance/include/TraingDanceItemView.h" #include "traing/include/TraingModel.h" #include "traing/Training_UiConfig.h" #include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" +#include "language/font/ui_resource_string.h" #include "UiConfig.h" namespace OHOS { @@ -57,5 +65,8 @@ namespace OHOS { return sItemInfo.id; } - + UIResourceTextId TraingDanceItemView::GetTraingDanceId() + { + return sItemInfo.labelid; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDanceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDanceView.cpp index d0db319fc..f01fed9e1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDanceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDanceView.cpp @@ -61,7 +61,7 @@ namespace OHOS scrollView->SetYScrollBarVisible(true); // 设置滑动滚动条 /* -------------------------------------------------------------------------- */ // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(title, 173, 52, 200, 60, "label1", "舞蹈运动", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(title, 173, 52, 200, 60, "label1", "舞蹈运动", DEFAULT_VECTOR_FONT_FILENAME, 30); scrollView->Add(title); // UIList 的适配器 p_TraingDanceListAdapter = new TraingDanceAdapter(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/include/TraingFitnessItemView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/include/TraingFitnessItemView.h index b25a56977..535de0632 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/include/TraingFitnessItemView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/include/TraingFitnessItemView.h @@ -24,7 +24,7 @@ namespace OHOS virtual void SetItemInfo(const TraingFitnessItem itemInfo); virtual void SetUpChild(); AppViewId GetTraingFitnessIndex(); - + UIResourceTextId GetTraingFitnessId(); private: TraingFitnessItemView(const TraingFitnessItemView &); UIImageView sbackground; // 背景 diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessItemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessItemView.cpp index 7f021d550..3e12df8ec 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessItemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessItemView.cpp @@ -1,14 +1,4 @@ - -/*** - * @Author: Caisking 3449750381@qq.com - * @Date: 2024-03-27 14:18:24 - * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-03-27 14:22:59 - * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessAdapter.cpp - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - */ - #include "traing/training_list_fitness/include/TraingFitnessItemView.h" #include "traing/include/TraingModel.h" #include "traing/Training_UiConfig.h" @@ -66,4 +56,10 @@ namespace OHOS return sItemInfo.id; } + /// @brief 获取list的中每个组件的在list的运动Id + /// @return 返回下标 + UIResourceTextId TraingFitnessItemView::GetTraingFitnessId() + { + return sItemInfo.labelid; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessView.cpp index 0600af81e..d51c00fd9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessView.cpp @@ -59,7 +59,7 @@ namespace OHOS scrollView->SetYScrollBarVisible(true); // 设置滑动滚动条 /* -------------------------------------------------------------------------- */ // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(title, 173, 52, 200, 60, "label1", "健身运动", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(title, 173, 52, 200, 60, "label1", "健身运动", DEFAULT_VECTOR_FONT_FILENAME, 30); scrollView->Add(title); // UIList 的适配器 p_TraingFitnessListAdapter = new TraingFitnessAdapter(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/include/TraingFitnessItemView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/include/TraingFitnessItemView.h new file mode 100644 index 000000000..535de0632 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/include/TraingFitnessItemView.h @@ -0,0 +1,37 @@ + + +#ifndef TraingFitness_ITEM_VIEW_H +#define TraingFitness_ITEM_VIEW_H + +#include "components/ui_label.h" +#include "components/ui_label_ext.h" +#include "language/font/ui_resource_string.h" +#include "components/ui_view_group.h" +#include "components/ui_checkbox.h" +#include "components/ui_image_view.h" +#include "traing/training_list_fitness/include/TraingFitnessAdapter.h" +#include "components/ui_label_button.h" +#include "AppViewIDs.h" +#include "ohos_types.h" + +namespace OHOS +{ + class TraingFitnessItemView : public UIViewGroup + { + public: + explicit TraingFitnessItemView(); + virtual ~TraingFitnessItemView(); + virtual void SetItemInfo(const TraingFitnessItem itemInfo); + virtual void SetUpChild(); + AppViewId GetTraingFitnessIndex(); + UIResourceTextId GetTraingFitnessId(); + private: + TraingFitnessItemView(const TraingFitnessItemView &); + UIImageView sbackground; // 背景 + UIImageView sicon; // 箭头 + UILabelExt sLabel; // 标签 + TraingFitnessItem sItemInfo = {VIEW_INVALID, STR_EXERCISE_GENERAL}; + }; + +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/include/TraingIceItemView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/include/TraingIceItemView.h index 7ee035c27..5966800d3 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/include/TraingIceItemView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/include/TraingIceItemView.h @@ -25,6 +25,7 @@ namespace OHOS virtual void SetItemInfo(const TraingIceItem itemInfo); virtual void SetUpChild(); AppViewId GetTraingIceIndex(); + UIResourceTextId GetTraingIceId(); private: TraingIceItemView(const TraingIceItemView &); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceItemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceItemView.cpp index d159a9474..05c6b3ba9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceItemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceItemView.cpp @@ -1,9 +1,17 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-27 11:13:16 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-29 11:47:02 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceItemView.cpp + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #include "traing/training_list_ice/include/TraingIceItemView.h" #include "traing/include/TraingModel.h" #include "traing/Training_UiConfig.h" #include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" +#include "language/font/ui_resource_string.h" #include "UiConfig.h" namespace OHOS { @@ -58,4 +66,8 @@ namespace OHOS return sItemInfo.id; } + UIResourceTextId TraingIceItemView::GetTraingIceId() + { + return sItemInfo.labelid; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIcePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIcePresenter.cpp index ebe797c06..434daeced 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIcePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIcePresenter.cpp @@ -93,6 +93,7 @@ namespace OHOS if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGMORE); + } UNUSED(view); return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceView.cpp index f6f446414..4fb4ed076 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceView.cpp @@ -2,7 +2,7 @@ * @Author: Caisking 3449750381@qq.com * @Date: 2024-03-26 09:46:17 * @LastEditors: Caisking 3449750381@qq.com - * @LastEditTime: 2024-03-28 19:59:38 + * @LastEditTime: 2024-03-29 12:06:57 * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceView.cpp * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -69,7 +69,7 @@ namespace OHOS scrollView->SetYScrollBarVisible(true); // 设置滑动滚动条 /* -------------------------------------------------------------------------- */ // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(title, 173, 52, 200, 60, "label1", "冰上运动", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(title, 173, 52, 200, 60, "label1", "冰上运动", DEFAULT_VECTOR_FONT_FILENAME, 30); scrollView->Add(title); // UIList 的适配器 p_TraingIceListAdapter = new TraingIceAdapter(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/include/TraingLimitItemView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/include/TraingLimitItemView.h index 43ff02dd7..f6b28310a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/include/TraingLimitItemView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/include/TraingLimitItemView.h @@ -1,3 +1,11 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2024-03-26 17:05:18 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-03-29 14:30:24 + * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/include/TraingLimitItemView.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ /*** * @Author: Caisking 3449750381@qq.com * @Date: 2024-03-26 17:05:18 @@ -20,7 +28,7 @@ #include "components/ui_label_button.h" #include "AppViewIDs.h" #include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" +#include "language/font/ui_resource_string.h" #include "ohos_types.h" namespace OHOS @@ -33,12 +41,13 @@ namespace OHOS virtual void SetItemInfo(const TraingLimitItem itemInfo); virtual void SetUpChild(); AppViewId GetTraingLimitIndex(); + UIResourceTextId GetTraingLimitId(); private: TraingLimitItemView(const TraingLimitItemView &); UIImageView sbackground; // 背景 - UIImageView sicon; // 箭头 - UILabelExt sLabel; // 标签 + UIImageView sicon; // 箭头 + UILabelExt sLabel; // 标签 TraingLimitItem sItemInfo = {VIEW_INVALID, STR_EXERCISE_GENERAL}; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitItemView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitItemView.cpp index 1ad774fb2..cc6532249 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitItemView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitItemView.cpp @@ -1,17 +1,17 @@ -/*** +/*** * @Author: Caisking 3449750381@qq.com * @Date: 2024-03-26 17:05:30 * @LastEditors: Caisking 3449750381@qq.com * @LastEditTime: 2024-03-29 11:18:05 * @FilePath: /sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitItemView.cpp - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%A */ #include "traing/training_list_limit/include/TraingLimitItemView.h" #include "traing/include/TraingModel.h" #include "traing/Training_UiConfig.h" #include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" +#include "language/font/ui_resource_string.h" #include "UiConfig.h" namespace OHOS { @@ -65,5 +65,8 @@ namespace OHOS { return sItemInfo.id; } - + UIResourceTextId TraingLimitItemView::GetTraingLimitId() + { + return sItemInfo.labelid; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitPresenter.cpp index 04e338ffe..27b47aa50 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitPresenter.cpp @@ -17,7 +17,7 @@ #include "AppViewIDs.h" #include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" +#include "language/font/ui_resource_string.h" #include "NativeAbility.h" #include @@ -26,6 +26,7 @@ #include "traing/training_list_limit/include/TraingLimitItemView.h" #include "traing/training_list_limit/include/TraingLimitPresenter.h" #include "traing/training_list_limit/include/TraingLimitView.h" +#include "traing/include/TraingModel.h" // #include "TraingLimitView.h" namespace OHOS @@ -103,6 +104,8 @@ namespace OHOS UNUSED(event); TraingLimitItemView *itemView = static_cast(&view); AppViewId viewId = itemView->GetTraingLimitIndex(); + UIResourceTextId sportid = itemView->GetTraingLimitId(); + TraingModel::GetInstance()->SetSportEvent(sportid); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d\n", viewId); if (viewId < VIEW_MAX_INTER_APP) { diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitView.cpp index 234cf21d3..137e1159f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitView.cpp @@ -61,7 +61,7 @@ namespace OHOS scrollView->SetYScrollBarVisible(true); // 设置滑动滚动条 /* -------------------------------------------------------------------------- */ // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(title, 173, 52, 200, 60, "label1", "极限运动", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(title, 173, 52, 200, 60, "label1", "极限运动", DEFAULT_VECTOR_FONT_FILENAME, 30); scrollView->Add(title); // UIList 的适配器 p_TraingLimitListAdapter = new TraingLimitAdapter(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMoreView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMoreView.cpp index f06465c5c..de837fa7a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMoreView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMoreView.cpp @@ -111,7 +111,7 @@ namespace OHOS scrollView1_->SetVisible(true); // 初始化Lable - TraingModel::GetInstance()->InitLabelExt(label1_, 203, 52, 200, 60, "label1", "训练", DEFAULT_VECTOR_FONT_FILENAME, 30); + TraingModel::GetInstance()->InitLabel(label1_, 203, 52, 200, 60, "label1", "训练", DEFAULT_VECTOR_FONT_FILENAME, 30); scrollView1_->Add(label1_); // 初始化Button TraingModel::GetInstance()->InitButton(button1_, 43, 120, 380, 100, BUTTON_FITNESS);