删除训练强度介绍Slice
authorCaisking <3449750381@qq.com>
Wed, 17 Apr 2024 08:41:02 +0000 (16:41 +0800)
committerCaisking <3449750381@qq.com>
Wed, 17 Apr 2024 08:41:02 +0000 (16:41 +0800)
14 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h
code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h
code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingModel.h
code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetView.h
code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingStrongPresenter.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingStrongView.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongView.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TrainingWinView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingWinView.cpp [new file with mode: 0644]

index 296af74..bdad07b 100644 (file)
@@ -486,8 +486,6 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEnddataPresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinPresenter.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingStrongView.cpp
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingStrongPresenter.cpp
 
     #主界面训练卡片
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/training_card/src/Training_CardView.cpp
index 2b15b11..40775ed 100644 (file)
@@ -80,7 +80,6 @@ typedef enum : uint16_t
     VIEW_TRAININGSETSTEP,   // 设置训练步数
     VIEW_TRAININGCRAD,      // 训练控制卡片
     VIEW_TRAININGENDDATA,   // 训练结束详细数据
-    VIEW_TRAININGSTRONG,    // 训练强度介绍
     VIEW_TRAININGWIN,       // 目标达成
     VIEW_TRAINING_RECORD,   // 训练记录
     /* ---------------------------------- 训练列表 ---------------------------------- */
index 9acbadc..78c260b 100644 (file)
@@ -67,7 +67,6 @@ namespace OHOS
         void InitTraingSlice(void);
         void InitTraingNomalSlice(void);
         void InitTraingSetSlice(void);
-        void InitTraingStrongSlice(void);
         void InitTraingSetTimeSlice(void);
         void InitTraingSetCaluliSlice(void);
         void InitTraingSetDistSlice(void);
index 06c3350..8abf4e2 100644 (file)
 #include "traing/include/TraingSetSeptView.h"
 #include "traing/include/TraingEnddataPresenter.h"
 #include "traing/include/TraingEnddataView.h"
-#include "traing/include/TraingStrongPresenter.h"
-#include "traing/include/TraingStrongView.h"
 #include "traing/include/TraingWinPresenter.h"
 #include "traing/include/TraingWinView.h"
 /* ---------------------------------- GPS训练 --------------------------------- */
@@ -315,7 +313,6 @@ namespace OHOS
         {VIEW_TRAININGGPS, &NativeLauncher::InitTraingGPSSlice},         // GPS训练
         {VIEW_TRAININGGPSLACK, &NativeLauncher::InitTraingGPSlackSlice}, // GPS缺少
         {VIEW_TRAININGGPSNOTE, &NativeLauncher::InitTraingGPSnoteSlice}, // 提醒连接GPS
-        {VIEW_TRAININGSTRONG, &NativeLauncher::InitTraingStrongSlice},   // 训练强度介绍
         {VIEW_TRAININGGPSLOST, &NativeLauncher::InitTraingGPSlostSlice}, // GPS断联
         {VIEW_TRAININGGPSBACK, &NativeLauncher::InitTraingGPSbackSlice}, // GPS回连
 
@@ -956,11 +953,6 @@ namespace OHOS
         SliceProxy *traingGPSnoteview = new AbilitySliceProxy<TraingGPSnoteView, TraingGPSnotePresenter>;
         NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGGPSNOTE, traingGPSnoteview);
     }
-    void NativeLauncher::InitTraingStrongSlice(void)
-    {
-        SliceProxy *traingStrongview = new AbilitySliceProxy<TraingStrongView, TraingStrongPresenter>;
-        NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGSTRONG, traingStrongview);
-    }
     void NativeLauncher::InitTraingGPSlostSlice(void)
     {
         SliceProxy *traingGPSlostview = new AbilitySliceProxy<TraingGPSlostView, TraingGPSlostPresenter>;
index 629fb9b..f37743c 100644 (file)
@@ -155,6 +155,7 @@ namespace OHOS
         int steps;                // 训练步数
         int distance;             // 训练距离
         int intensity;            // 训练强度 (0:较低强度 1:中等强度 2:高等强度 3:超高强度)
+        int heart;                // 运动心率
         int avgheart;             // 训练平均心率
         std::string start_date;   // 训练开始日期
         std::string start_time;   // 训练开始时间
@@ -172,6 +173,7 @@ namespace OHOS
             steps = 0;
             distance = 0;
             intensity = 1;
+            heart = 0;
             avgheart = 0;
             start_date = nullptr;
             start_time = nullptr;
index 7b2c17f..55d7feb 100644 (file)
@@ -1,3 +1,9 @@
+/***
+ * @Date: 2024-04-15 10:55:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-04-17 16:29:01
+ * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingSetView.h
+ */
 #ifndef _TraingSet_VIEW_H
 #define _TraingSet_VIEW_H
 
@@ -41,7 +47,7 @@ namespace OHOS
         void OnStop() override;
         void InitView();
         void DeInit();
-       
+
         void InitList();
         void PreLoad(void);
 
@@ -52,19 +58,17 @@ namespace OHOS
 
         UIViewGroup *container_ = nullptr;
 
-        UILabelExt *label1_ = nullptr;
-        UILabelExt *label2_ = nullptr;
-        UILabelExt *label3_ = nullptr;
-        UILabelExt *label4_ = nullptr;
-        UILabelExt *label5_ = nullptr;
+        UILabelExt *labeltitle = nullptr;
+        UILabelExt *labeltime = nullptr;
+        UILabelExt *labelKcal = nullptr;
 
-        UIImageView *image1_ = nullptr;
-        UIImageView *image2_ = nullptr;
-        UIImageView *image3_ = nullptr;
-        UIImageView *image4_ = nullptr;
+        UIImageView *imagetime = nullptr;
+        UIImageView *imagcal = nullptr;
+        UIImageView *imagicon1 = nullptr;
+        UIImageView *imagico2 = nullptr;
 
-        UIButton *button1_ = nullptr;
-        UIButton *button2_ = nullptr;
+        UIButton *butTime = nullptr;
+        UIButton *butKcal = nullptr;
 
         bool viewiInitStatus{false};
     };
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingStrongPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingStrongPresenter.h
deleted file mode 100644 (file)
index d3122e3..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-
-#ifndef _TraingStrong_PRESENTER_H
-#define _TraingStrong_PRESENTER_H
-
-#include "Presenter.h"
-#include "TraingStrongView.h"
-
-namespace OHOS
-{
-    class TraingStrongView;
-
-    class TraingStrongPresenter : public Presenter<TraingStrongView>,
-                                 public UIView::OnClickListener,
-                                 public UIView::OnDragListener
-    {
-    public:
-        TraingStrongPresenter();
-        virtual ~TraingStrongPresenter();
-
-        void OnStart() override;
-        void OnPause() override;
-        void OnResume() override;
-        void OnStop() override;
-
-        static TraingStrongPresenter *GetInstance();
-
-    private:
-        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
-        bool OnClick(UIView &view, const ClickEvent &event) override;
-        bool OnDrag(UIView &view, const DragEvent &event) override;
-        bool OnDragEnd(UIView& view, const DragEvent& event) override;
-
-    };
-} // namespace OHOS
-
-#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingStrongView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingStrongView.h
deleted file mode 100644 (file)
index c3f66a3..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef _TraingStrong_VIEW_H
-#define _TraingStrong_VIEW_H
-
-#include "BaseView.h"
-#include "View.h"
-#include <ui_scroll_view.h>
-#include "components/ui_view_group.h"
-#include "components/ui_label.h"
-#include "components/ui_label_ext.h"
-#include "components/ui_image_view.h"
-#include "components/ui_button.h"
-#include "components/ui_image_animator.h"
-#include "components/ui_label_button_ext.h"
-#include "components/ui_chart.h"
-#include "components/ui_list.h"
-#include "components/icon_adapter.h"
-#include "wearable_log.h"
-#include "ohos_types.h"
-#include "components/ui_card_page.h"
-#include "traing/include/TraingModel.h"
-#include "traing/Training_UiConfig.h"
-
-#include "TraingStrongPresenter.h"
-namespace OHOS
-{
-#define BUTTONNO "button1"
-#define BUTTONYES "button2"
-
-    class TraingStrongPresenter;
-    class TraingStrongView : public View<TraingStrongPresenter>
-    {
-
-    public:
-        TraingStrongView();
-        virtual ~TraingStrongView();
-        static TraingStrongView *GetInstance(void);
-
-        void OnStart() override;
-        void OnSetUpView() override;
-        void OnTearDownView() override;
-        void OnStop() override;
-        void InitView();
-        void DeInit();
-       
-        void InitList();
-        void PreLoad(void);
-
-        // 通过函数改变
-        void SetLabel();
-        void SetButton();
-
-    private:
-        UIView::OnDragListener *draglistener{nullptr};
-        TraingStrongView(TraingStrongView &&) = delete;
-        TraingStrongView &operator=(TraingStrongView &&) = delete;
-
-        UIViewGroup *container_ = nullptr;
-        UIScrollView *scrollView1_ = nullptr;
-
-        UILabelExt *label1_ = nullptr;
-        UILabelExt *label2_ = nullptr;
-        UILabelExt *label3_ = nullptr;
-        UILabelExt *label4_ = nullptr;
-        UILabelExt *label5_ = nullptr;
-        UILabelExt *label6_ = nullptr;
-
-        UIImageView *image1_ = nullptr;
-        UIImageView *image2_ = nullptr;
-        UIImageView *image3_ = nullptr;
-        UIImageView *image4_ = nullptr;
-        UIImageView *image5_ = nullptr;
-        bool viewiInitStatus{false};
-    };
-} // namespace OHOS
-#endif // TraingStrong_PRESENTER_H
index e4b2ef0..d15c3ab 100644 (file)
@@ -44,110 +44,96 @@ namespace OHOS
         }\r
 \r
         //  初始化Button\r
-        TraingModel::GetInstance()->InitButton(button1_, 43, 120, 380, 100, BUTTONTIME);\r
-        TraingModel::GetInstance()->InitButton(button2_, 43, 240, 380, 100, BUTTONCALULI);\r
-        button1_->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingSetPresenter::GetInstance()));\r
-        button2_->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingSetPresenter::GetInstance()));\r
-        container_->Add(button1_);\r
-        container_->Add(button2_);\r
+        TraingModel::GetInstance()->InitButton(butTime, 43, 120, 380, 100, BUTTONTIME);\r
+        TraingModel::GetInstance()->InitButton(butKcal, 43, 240, 380, 100, BUTTONCALULI);\r
+        butTime->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingSetPresenter::GetInstance()));\r
+        butKcal->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingSetPresenter::GetInstance()));\r
+        container_->Add(butTime);\r
+        container_->Add(butKcal);\r
 \r
         // 初始化Lable\r
-        TraingModel::GetInstance()->InitLabel(label1_, 173, 52, 120, 35, "label1", "极限运动", DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-        TraingModel::GetInstance()->InitLabel(label2_, 130, 150, 60, 35, "label2", "时长", DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-        TraingModel::GetInstance()->InitLabel(label3_, 270, 155, 69, 23, "label3", "30 分钟", DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-        TraingModel::GetInstance()->InitLabel(label4_, 130, 270, 60, 35, "label4", "卡路里", DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-        TraingModel::GetInstance()->InitLabel(label5_, 270, 275, 60, 35, "label5", "1000 千卡", DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
-        container_->Add(label1_);\r
-        container_->Add(label2_);\r
-        container_->Add(label3_);\r
-        container_->Add(label4_);\r
-        container_->Add(label5_);\r
+        UIResourceTextId sportid = TraingModel::GetInstance()->GetSportEvent();\r
+        TraingModel::GetInstance()->InitLabelExt(labeltitle, 173, 52, 120, 35, "label1", sportid, DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+\r
+        TraingModel::GetInstance()->InitLabel(labeltime, 130, 150, 60, 35, "label2", "时长", DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+        TraingModel::GetInstance()->InitLabel(labelKcal, 130, 270, 60, 35, "label4", "卡路里", DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+\r
+        container_->Add(labeltitle);\r
+        container_->Add(labeltime);\r
+        container_->Add(labelKcal);\r
+\r
 \r
         // 初始化Image\r
-        TraingModel::GetInstance()->InitImageView(image1_, 70, 150, 100, 100, "image1", TIME_IMAGE);\r
-        TraingModel::GetInstance()->InitImageView(image2_, 70, 270, 100, 100, "image2", CALORIES_IMAGE);\r
-        TraingModel::GetInstance()->InitImageView(image3_, 380, 160, 100, 100, "image3", ICON_IMAGE);\r
-        TraingModel::GetInstance()->InitImageView(image4_, 380, 280, 100, 100, "image4", ICON_IMAGE);\r
-        container_->Add(image1_);\r
-        container_->Add(image2_);\r
-        container_->Add(image3_);\r
-        container_->Add(image4_);\r
+        TraingModel::GetInstance()->InitImageView(imagetime, 70, 150, 100, 100, "image1", TIME_IMAGE);\r
+        TraingModel::GetInstance()->InitImageView(imagcal, 70, 270, 100, 100, "image2", CALORIES_IMAGE);\r
+\r
+        TraingModel::GetInstance()->InitImageView(imagicon1, 380, 160, 100, 100, "image3", ICON_IMAGE);\r
+        TraingModel::GetInstance()->InitImageView(imagico2, 380, 280, 100, 100, "image4", ICON_IMAGE);\r
+        container_->Add(imagetime);\r
+        container_->Add(imagcal);\r
+        container_->Add(imagicon1);\r
+        container_->Add(imagico2);\r
     }\r
     /* DeInit:删除组件 */\r
     void TraingSetView::DeInit()\r
     {\r
         container_->RemoveAll();\r
         // 删除Label\r
-        if (label1_ != nullptr)\r
-        {\r
-            container_->Remove(label1_);\r
-            delete label1_;\r
-            label1_ = nullptr;\r
-        }\r
-        if (label2_ != nullptr)\r
+        if (labeltitle != nullptr)\r
         {\r
-            container_->Remove(label2_);\r
-            delete label2_;\r
-            label2_ = nullptr;\r
+            container_->Remove(labeltitle);\r
+            delete labeltitle;\r
+            labeltitle = nullptr;\r
         }\r
-        if (label3_ != nullptr)\r
+        if (labeltime != nullptr)\r
         {\r
-            container_->Remove(label3_);\r
-            delete label3_;\r
-            label3_ = nullptr;\r
+            container_->Remove(labeltime);\r
+            delete labeltime;\r
+            labeltime = nullptr;\r
         }\r
-        if (label4_ != nullptr)\r
+        if (labelKcal != nullptr)\r
         {\r
-            container_->Remove(label4_);\r
-            delete label4_;\r
-            label4_ = nullptr;\r
+            container_->Remove(labelKcal);\r
+            delete labelKcal;\r
+            labelKcal = nullptr;\r
         }\r
-        if (label5_ != nullptr)\r
-        {\r
-            container_->Remove(label5_);\r
-            delete label5_;\r
-            label5_ = nullptr;\r
-        }\r
-\r
         // 删除Button\r
-        if (button1_ != nullptr)\r
+        if (butTime != nullptr)\r
         {\r
-            container_->Remove(button1_);\r
-            delete button1_;\r
-            button1_ = nullptr;\r
+            container_->Remove(butTime);\r
+            delete butTime;\r
+            butTime = nullptr;\r
         }\r
-        if (button2_ != nullptr)\r
+        if (butKcal != nullptr)\r
         {\r
-            container_->Remove(button2_);\r
-            delete button2_;\r
-            button2_ = nullptr;\r
+            container_->Remove(butKcal);\r
+            delete butKcal;\r
+            butKcal = nullptr;\r
         }\r
-\r
         // 删除Image\r
-        if (image1_ != nullptr)\r
+        if (imagetime != nullptr)\r
         {\r
-            container_->Remove(image1_);\r
-            delete image1_;\r
-            image1_ = nullptr;\r
+            container_->Remove(imagetime);\r
+            delete imagetime;\r
+            imagetime = nullptr;\r
         }\r
-        if (image2_ != nullptr)\r
+        if (imagcal != nullptr)\r
         {\r
-            container_->Remove(image2_);\r
-            delete image2_;\r
-            image2_ = nullptr;\r
+            container_->Remove(imagcal);\r
+            delete imagcal;\r
+            imagcal = nullptr;\r
         }\r
-        if (image3_ != nullptr)\r
+        if (imagicon1 != nullptr)\r
         {\r
-            container_->Remove(image3_);\r
-            delete image3_;\r
-            image3_ = nullptr;\r
+            container_->Remove(imagicon1);\r
+            delete imagicon1;\r
+            imagicon1 = nullptr;\r
         }\r
-        if (image4_ != nullptr)\r
+        if (imagico2 != nullptr)\r
         {\r
-            container_->Remove(image4_);\r
-            delete image4_;\r
-            image4_ = nullptr;\r
+            container_->Remove(imagico2);\r
+            delete imagico2;\r
+            imagico2 = nullptr;\r
         }\r
 \r
         // 删除容器\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongPresenter.cpp
deleted file mode 100644 (file)
index 352bca4..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-
-#include "AppViewIDs.h"
-#include "components/ui_label_ext.h"
-#include"language/font/ui_resource_string.h"
-#include "NativeAbility.h"
-
-#include <iostream>
-#include <chrono>
-#include <thread>
-#include "traing/include/TraingStrongPresenter.h"
-// #include "TraingStrongView.h"
-
-namespace OHOS
-{
-
-    // 当前Presenter属性实例化的内存指针
-    static TraingStrongPresenter *g_pTraingStrongPresenter = nullptr;
-
-    TraingStrongPresenter::TraingStrongPresenter()
-    {
-
-        g_pTraingStrongPresenter = this;
-    }
-
-    TraingStrongPresenter::~TraingStrongPresenter()
-    {
-
-        g_pTraingStrongPresenter = nullptr;
-    }
-
-    TraingStrongPresenter *TraingStrongPresenter::GetInstance()
-    {
-
-        return g_pTraingStrongPresenter;
-    }
-
-    void TraingStrongPresenter::OnStart()
-    {
-
-        Presenter<TraingStrongView>::OnStart();
-    }
-
-    void TraingStrongPresenter::OnPause(void)
-    {
-
-        Presenter<TraingStrongView>::OnPause();
-    }
-
-    void TraingStrongPresenter::OnResume(void)
-    {
-
-        Presenter<TraingStrongView>::OnResume();
-    }
-
-    void TraingStrongPresenter::OnStop(void)
-    {
-
-        Presenter<TraingStrongView>::OnStop();
-    }
-    bool TraingStrongPresenter::OnDrag(UIView &view, const DragEvent &event)
-    {
-        return true;
-    }
-    bool TraingStrongPresenter::OnDragEnd(UIView &view, const DragEvent &event)
-    {
-
-        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)
-        {
-           // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA);
-        }
-        UNUSED(view);
-        return true;
-    }
-
-    bool TraingStrongPresenter::OnClick(UIView &view, const ClickEvent &event)
-    {
-        // 根据控件id查找是哪个控件触发了点击回调
-        if (strcmp(view.GetViewId(), "Remind") == 0)
-        {
-            // 模拟心率监测,等待20秒
-            // std::this_thread::sleep_for(std::chrono::seconds(20));
-            // NativeAbility::GetInstance().ChangeSlice(VIEW_TraingStrongREMIND);
-        }
-        return true;
-    }
-}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingStrongView.cpp
deleted file mode 100644 (file)
index 6b3343e..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-
-#include "traing/include/TraingStrongView.h"
-
-#include "common/image_cache_manager.h"
-#include "components/ui_label_ext.h"
-#include "language/font/ui_resource_string.h"
-#include "UiConfig.h"
-#include "ui_resource_image.h"
-#include <ui_scroll_view.h>
-#include "components/ui_button.h"
-#include "traing/include/TraingModel.h"
-#include "traing/Training_UiConfig.h"
-
-namespace OHOS
-{
-
-    static TraingStrongView *g_pTraingStrongView{nullptr};
-
-    TraingStrongView::TraingStrongView()
-    {
-        g_pTraingStrongView = this;
-    }
-
-    TraingStrongView::~TraingStrongView()
-    {
-        DeInit();
-        g_pTraingStrongView = nullptr;
-    }
-
-    TraingStrongView *TraingStrongView::GetInstance()
-    {
-
-        return g_pTraingStrongView;
-    }
-
-    /* InitView:初始化界面*/
-    void TraingStrongView ::InitView()
-    {
-        if (container_ == nullptr)
-        {
-            container_ = new UIViewGroup();
-            container_->SetPosition(0, 0, 466, 466);
-            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
-        }
-        // Add ScrollView to App
-        if (scrollView1_ == nullptr)
-        {
-            scrollView1_ = new UIScrollView();
-        }
-        scrollView1_->SetPosition(0, 0);        // widget's left position and top position
-        scrollView1_->Resize(466, 466);         // widget's width and height
-        scrollView1_->SetViewId("scrollView1"); // Set style
-        scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
-        scrollView1_->SetReboundSize(100);
-        scrollView1_->SetScrollBlankSize(52);
-        scrollView1_->SetHorizontalScrollState(false);
-        // Set additional property
-        // Add to rootView
-        container_->Add(scrollView1_);
-        scrollView1_->SetVisible(true);
-
-        // 初始化Lable
-        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_);
-        scrollView1_->Add(label3_);
-        scrollView1_->Add(label4_);
-        scrollView1_->Add(label5_);
-        scrollView1_->Add(label6_);
-
-        // 初始化Image
-        TraingModel::GetInstance()->InitImageView(image1_, 510, 60, 100, 100, "image1", POINT_BLUE_IMAGE);
-        TraingModel::GetInstance()->InitImageView(image2_, 550, 60, 100, 100, "image2", POINT_GREEN_IMAGE);
-        TraingModel::GetInstance()->InitImageView(image3_, 590, 60, 100, 100, "image3", POINT_ORANGE_IMAGE);
-        TraingModel::GetInstance()->InitImageView(image4_, 630, 60, 100, 100, "image4", POINT_YELLOW_IMAGE);
-        scrollView1_->Add(image1_);
-        scrollView1_->Add(image2_);
-        scrollView1_->Add(image3_);
-        scrollView1_->Add(image4_);
-
-        // Add ImageView to App
-        if (image5_ == nullptr)
-        {
-            image5_ = new UIImageView();
-        }
-        image5_->SetPosition(183, 813); // widget's left position and top position
-        image5_->Resize(100, 100);      // widget's width and height
-        image5_->SetViewId("image3");   // Set style
-        // Set additional property
-        // Add to scrollView2
-        scrollView1_->Add(image5_);
-        image5_->SetVisible(true);
-    }
-    /* DeInit:删除组件 */
-    void TraingStrongView::DeInit()
-    {
-        container_->RemoveAll();
-        UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
-        while (view != nullptr)
-        {
-            UIView *tempView = view;
-            view = view->GetNextSibling();
-            if (tempView->GetParent())
-            {
-                static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
-            }
-            delete tempView;
-        }
-        delete container_;
-        container_ = nullptr;
-    }
-
-    void TraingStrongView::PreLoad(void)
-    {
-        if (!viewiInitStatus)
-        {
-            InitView();
-            viewiInitStatus = true;
-        }
-    }
-    void TraingStrongView::OnStart()
-    {
-        container_ = new UIViewGroup();
-        if (container_ == nullptr)
-        {
-            return;
-        }
-        container_->SetPosition(0, 0);
-        container_->SetWidth(Screen::GetInstance().GetWidth());
-        container_->SetHeight(Screen::GetInstance().GetHeight());
-
-        // 创建 draglistener 实例并设置为拖动监听器
-        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingStrongPresenter::GetInstance());
-        if (draglistener == nullptr)
-        {
-            return;
-        }
-        container_->SetOnDragListener(draglistener);
-
-        container_->SetTouchable(true);
-        container_->SetDraggable(true);
-
-        PreLoad();
-        RootView::GetInstance()->Add(container_);
-    }
-
-    void TraingStrongView::OnSetUpView()
-    {
-
-        View<TraingStrongPresenter>::OnSetUpView();
-        Draw();
-    }
-
-    void TraingStrongView::OnTearDownView()
-    {
-
-        View<TraingStrongPresenter>::OnTearDownView();
-        return;
-    }
-
-    void TraingStrongView::OnStop()
-    {
-        View<TraingStrongPresenter>::OnStop();
-        RootView::GetInstance()->RemoveAll();
-        return;
-    }
-}
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TrainingWinView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/include/TrainingWinView.h
new file mode 100644 (file)
index 0000000..e69de29
index 6039afc..1e65184 100644 (file)
@@ -188,7 +188,7 @@ namespace OHOS
         std::string stepsStr = (sportdata->steps != 0) ? std::to_string(sportdata->steps) : "--";\r
         std::string calorieStr = (sportdata->calories != 0) ? std::to_string(sportdata->calories) : "--";\r
 \r
-        TrainingDataView::GetInstance()->GetHeartLabel()->SetText(hal_gpio_ctrl_id_t.c_str());\r
+        TrainingDataView::GetInstance()->GetHeartLabel()->SetText(heartStr.c_str());\r
 \r
         TrainingDetailView::GetInstance()->GetCalorieLabel()->SetText(calorieStr.c_str());\r
         TrainingDetailView::GetInstance()->GetMileLabel()->SetText(distanceStr.c_str());\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingWinView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TrainingWinView.cpp
new file mode 100644 (file)
index 0000000..e69de29