删除原训练达到目标弹窗Slice;修复bug
authorCaisking <3449750381@qq.com>
Fri, 19 Apr 2024 12:32:45 +0000 (20:32 +0800)
committerCaisking <3449750381@qq.com>
Fri, 19 Apr 2024 12:32:45 +0000 (20:32 +0800)
13 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/TraingWinPresenter.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingWinView.h [deleted file]
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingNomalPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingSetPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinPresenter.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinView.cpp [deleted file]
code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp

index 6f0b8ce..2ced285 100644 (file)
@@ -476,8 +476,6 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingSetPresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEnddataView.cpp
     ${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/TrainingSetCaluliView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TrainingSetTimeView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TrainingSetMileView.cpp
index dc4e127..e004d2b 100644 (file)
@@ -76,7 +76,6 @@ typedef enum : uint16_t
     VIEW_TRAININGSET,       // 训练目标(时长,卡路里)
     VIEW_TRAININGCRAD,      // 训练控制卡片
     VIEW_TRAININGENDDATA,   // 训练结束详细数据
-    VIEW_TRAININGWIN,       // 目标达成
     VIEW_TRAINING_RECORD,   // 训练记录
     /* ---------------------------------- 训练列表 ---------------------------------- */
     VIEW_TRAININGMORE,    // 更多训练
index 809a500..3ec9939 100644 (file)
@@ -66,10 +66,9 @@ namespace OHOS
         /* ----------------------------------- 训练 ----------------------------------- */
         void InitTraingSlice(void);
         void InitTraingNomalSlice(void);
-        void InitTraingSetSlice(void);     
+        void InitTraingSetSlice(void);
         void InitTraingCardSlice(void);
         void InitTraingEnddataSlice(void);
-        void InitTraingWinSlice(void);
 
         void InitTraingMoreSlice(void);    // 更多训练
         void InitTraingLimitSlice(void);   // 极限训练
@@ -80,8 +79,7 @@ namespace OHOS
         void InitTraingBallSlice(void);    // 球类训练
         void InitTraingAquaticSlice(void); // 水上训练
         void InitTraingOtherSlice(void);   // 其他训练
-
-        void InitTraingRecordSlice(void); // 训练记录
+        void InitTraingRecordSlice(void);  // 训练记录
 
         void InitSecondaryFunction(void);
         void InitFastTrainingSlice(void);
index 7115ef3..be66da1 100644 (file)
 #include "traing/include/TraingSetView.h"
 #include "traing/include/TraingEnddataPresenter.h"
 #include "traing/include/TraingEnddataView.h"
-#include "traing/include/TraingWinPresenter.h"
-#include "traing/include/TraingWinView.h"
 /* ---------------------------------- 训练记录 ---------------------------------- */
 #include "traingrecord/include/TraingRecordView.h"
 #include "traingrecord/include/TraingRecordPresenter.h"
@@ -279,8 +277,7 @@ namespace OHOS
         {VIEW_TRAININGSET, &NativeLauncher::InitTraingSetSlice},         // 训练目标设置界面
         {VIEW_TRAININGCRAD, &NativeLauncher::InitTraingCardSlice},       // 训练卡片
         {VIEW_TRAININGENDDATA, &NativeLauncher::InitTraingEnddataSlice}, // 训练结束详细数据
-        {VIEW_TRAININGWIN, &NativeLauncher::InitTraingWinSlice},         // 训练目标达成
-        {VIEW_TRAINING_RECORD, &NativeLauncher::InitTraingRecordSlice},  // 训练目标达成
+        {VIEW_TRAINING_RECORD, &NativeLauncher::InitTraingRecordSlice},  // 训练记录
 
         {VIEW_TRAININGMORE, &NativeLauncher::InitTraingMoreSlice},       // 更多训练
         {VIEW_TRAININGLIMIT, &NativeLauncher::InitTraingLimitSlice},     // 极限训练
@@ -867,11 +864,6 @@ namespace OHOS
         SliceProxy *traingenddataview = new AbilitySliceProxy<TraingEnddataView, TraingEnddataPresenter>;
         NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGENDDATA, traingenddataview);
     }
-    void NativeLauncher::InitTraingWinSlice(void)
-    {
-        SliceProxy *traingwinview = new AbilitySliceProxy<TraingWinView, TraingWinPresenter>;
-        NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGWIN, traingwinview);
-    }
     void NativeLauncher::InitTraingRecordSlice(void)
     {
         SliceProxy *traingrecordview = new AbilitySliceProxy<TraingRecordView, TraingRecordPresenter>;
index b9d7890..ba321b7 100644 (file)
@@ -108,6 +108,11 @@ extern "C"
 
 namespace OHOS
 {
+#define TIME_INTERVAL 10;
+#define CALORIES_INTERVAL 100;
+#define DISTANCE_INTERVAL 1;
+#define STEPS_INTERVAL 500;
+
     // 运动状态
     enum class ExerciseState
     {
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingWinPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingWinPresenter.h
deleted file mode 100644 (file)
index ed8b1e1..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef _TraingWin_PRESENTER_H
-#define _TraingWin_PRESENTER_H
-
-#include "Presenter.h"
-#include "TraingWinView.h"
-
-namespace OHOS
-{
-    class TraingWinView;
-
-    class TraingWinPresenter : public Presenter<TraingWinView>,
-                                 public UIView::OnClickListener,
-                                 public UIView::OnDragListener
-    {
-    public:
-        TraingWinPresenter();
-        virtual ~TraingWinPresenter();
-
-        void OnStart() override;
-        void OnPause() override;
-        void OnResume() override;
-        void OnStop() override;
-
-        static TraingWinPresenter *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/TraingWinView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingWinView.h
deleted file mode 100644 (file)
index d64a20a..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef _TraingWin_VIEW_H
-#define _TraingWin_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 "TraingWinPresenter.h"
-namespace OHOS
-{
-#define BUTTONOK "button1"
-
-    class TraingWinPresenter;
-    class TraingWinView : public View<TraingWinPresenter>
-    {
-
-    public:
-        TraingWinView();
-        virtual ~TraingWinView();
-        static TraingWinView *GetInstance(void);
-
-        void OnStart() override;
-        void OnSetUpView() override;
-        void OnTearDownView() override;
-        void OnStop() override;
-        void InitView();
-        void DeInit();
-
-        void InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId,int time);
-       
-        void InitList();
-        void PreLoad(void);
-
-    private:
-        UIView::OnDragListener *draglistener{nullptr};
-        TraingWinView(TraingWinView &&) = delete;
-        TraingWinView &operator=(TraingWinView &&) = delete;
-        UIViewGroup *container_ = nullptr;
-        UILabelExt *label1_ = nullptr;
-        UILabelExt *label2_ = nullptr;
-        UILabelExt *label3_ = nullptr;
-        UILabelExt *label4_ = nullptr;
-        UIButton *button1_ = nullptr;
-        UIImageView *image1_ = nullptr;
-        UIImageAnimatorView *imageAnimator;
-        bool viewiInitStatus{false};
-    };
-
-} // namespace OHOS
-#endif // TraingWin_PRESENTER_H
index a247865..5e076de 100644 (file)
@@ -1,4 +1,4 @@
-/*** 
+/***
  * @Date: 2024-04-15 14:19:47
  * @LastEditors: Caisking 3449750381@qq.com
  * @LastEditTime: 2024-04-17 14:59:43
@@ -78,7 +78,7 @@ namespace OHOS
         // 根据控件id查找是哪个控件触发了点击回调
         if (strcmp(view.GetViewId(), BUTTONBACK) == 0)
         {
-            NativeAbility::GetInstance().Back();
+            NativeAbility::GetInstance().EnterSlice(VIEW_APPLIST);
         }
         return true;
     }
index 03d6073..537782d 100644 (file)
@@ -79,7 +79,7 @@ namespace OHOS
         }\r
         if (strcmp(view.GetViewId(), BUTTONGO) == 0)\r
         {\r
-            NativeAbility::GetInstance().EnterSlice(VIEW_TRAININGCRAD);\r
+            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCRAD);\r
             // 获取运动类型\r
             ExerciseClass type = TraingModel::GetInstance()->GetSportType();\r
             // 开启对应的运动\r
index b34a2b7..13f7d8c 100644 (file)
@@ -14,6 +14,7 @@
 #include <thread>\r
 #include "traing/include/TraingSetPresenter.h"\r
 #include "traing/training_card/include/TraingCardPresenter.h"\r
+#include "traing/include/TraingModel.h"\r
 // #include "TraingSetView.h"\r
 \r
 namespace OHOS\r
@@ -121,7 +122,7 @@ namespace OHOS
                 TraingModel::GetInstance()->SetSportTag(GetExerciseTagFromCard(CardID), tag);\r
                 // TraingModel::GetInstance()->SetSportTag(ExerciseTag::STEP, 10); // 测试\r
                 PRINT("GetButtonIdFromCard:%d tag:%d \r\n", CardID, tag);\r
-                NativeAbility::GetInstance().EnterSlice(VIEW_TRAININGCRAD);\r
+                NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCRAD);\r
                 ExerciseClass type = TraingModel::GetInstance()->GetSportType();\r
                 TraingCardPresenter::GetInstance()->OpenSensor(type);\r
             }\r
@@ -178,16 +179,26 @@ namespace OHOS
      */\r
     int TraingSetPresenter::GetTagFromCard(int cardID)\r
     {\r
+        int selectedValue = 0;\r
+\r
         switch (cardID)\r
         {\r
         case SET_DURATION:\r
-            return TrainingSetTimeView::GetInstance()->GetTimePicker()->GetSelected();\r
+            // 获取时间选择器中选定的时间值,并加1后乘以区间值\r
+            selectedValue = TrainingSetTimeView::GetInstance()->GetTimePicker()->GetSelected();\r
+            return (selectedValue + 1) * TIME_INTERVAL;\r
         case SET_CALORIES:\r
-            return TrainingSetCaluliView::GetInstance()->GetCaluliPicker()->GetSelected();\r
+            // 获取卡路里选择器中选定的卡路里值,并加1后乘以区间值\r
+            selectedValue = TrainingSetCaluliView::GetInstance()->GetCaluliPicker()->GetSelected();\r
+            return (selectedValue + 1) * CALORIES_INTERVAL;\r
         case SET_DISTANCE:\r
-            return TrainingSetMileView::GetInstance()->GetMilePicker()->GetSelected();\r
+            // 获取距离选择器中选定的距离值,并加1后乘以区间值\r
+            selectedValue = TrainingSetMileView::GetInstance()->GetMilePicker()->GetSelected();\r
+            return (selectedValue + 1) * DISTANCE_INTERVAL;\r
         case SET_STEPS:\r
-            return TrainingSetStepView::GetInstance()->GetSetpPicker()->GetSelected();\r
+            // 获取步数选择器中选定的步数值,并加1后乘以区间值\r
+            selectedValue = TrainingSetStepView::GetInstance()->GetSetpPicker()->GetSelected();\r
+            return (selectedValue + 1) * STEPS_INTERVAL;\r
         default:\r
             return 0;\r
         }\r
diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinPresenter.cpp
deleted file mode 100644 (file)
index 4bf9d63..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*** 
- * @Date: 2024-04-15 10:55:58
- * @LastEditors: Caisking 3449750381@qq.com
- * @LastEditTime: 2024-04-17 14:22:58
- * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingWinPresenter.cpp
- */
-
-#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/TraingWinPresenter.h"
-// #include "TraingWinView.h"
-
-namespace OHOS
-{
-
-    // 当前Presenter属性实例化的内存指针
-    static TraingWinPresenter *g_pTraingWinPresenter = nullptr;
-
-    TraingWinPresenter::TraingWinPresenter()
-    {
-
-        g_pTraingWinPresenter = this;
-    }
-
-    TraingWinPresenter::~TraingWinPresenter()
-    {
-        g_pTraingWinPresenter = nullptr;
-    }
-
-    TraingWinPresenter *TraingWinPresenter::GetInstance()
-    {
-
-        return g_pTraingWinPresenter;
-    }
-
-    void TraingWinPresenter::OnStart()
-    {
-
-        Presenter<TraingWinView>::OnStart();
-    }
-
-    void TraingWinPresenter::OnPause(void)
-    {
-
-        Presenter<TraingWinView>::OnPause();
-    }
-
-    void TraingWinPresenter::OnResume(void)
-    {
-
-        Presenter<TraingWinView>::OnResume();
-    }
-
-    void TraingWinPresenter::OnStop(void)
-    {
-
-        Presenter<TraingWinView>::OnStop();
-    }
-
-    bool TraingWinPresenter::OnDrag(UIView &view, const DragEvent &event)
-    {
-
-        // if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
-        //     (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))
-        // {
-        //     uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
-        //    NativeAbility::GetInstance().ChangeSlice(preSlice);
-        // }
-        UNUSED(view);
-        return true;
-    }
-
-    bool TraingWinPresenter::OnClick(UIView &view, const ClickEvent &event)
-    {
-        // 根据控件id查找是哪个控件触发了点击回调
-        if (strcmp(view.GetViewId(), BUTTONOK) == 0)
-        {
-            NativeAbility::GetInstance().EnterSlice(VIEW_TRAININGENDDATA);
-        }
-        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
deleted file mode 100644 (file)
index 854ec1d..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-
-#include "traing/include/TraingWinView.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 TraingWinView *g_pTraingWinView{nullptr};
-    TraingWinView::TraingWinView()
-    {
-        g_pTraingWinView = this;
-    }
-
-    TraingWinView::~TraingWinView()
-    {
-        DeInit();
-        g_pTraingWinView = nullptr;
-    }
-    TraingWinView *TraingWinView::GetInstance()
-    {
-
-        return g_pTraingWinView;
-    }
-
-    /**
-     * 创建包含图片文件路径的数组
-     * @param  basePath  包含图片文件的基本路径
-     * @param  fileExtension  图片文件的扩展名
-     * @param  numImages  图片文件的数量
-     * @return  返回包含图片文件路径的数组
-     */
-    const char **CreateImagePathsArray(const char *basePath, const char *fileExtension, int numImages)
-    {
-        const char **imagePaths = new const char *[numImages];
-        char buffer[256];
-        for (int i = 0; i < numImages; i++)
-        {
-            snprintf(buffer, sizeof(buffer), "%s/%d.%s", basePath, i + 1, fileExtension);
-            imagePaths[i] = strdup(buffer);
-        }
-        return imagePaths;
-    }
-
-    /**
-     * 释放图片文件路径数组占用的内存
-     * @param  imagePaths  图片文件路径数组
-     * @param  numImages  图片文件的数量
-     */
-    void FreeImagePathsArray(const char **imagePaths, int numImages)
-    {
-        for (int i = 0; i < numImages; i++)
-        {
-            free((void *)imagePaths[i]);
-        }
-        delete[] imagePaths;
-    }
-    /**
-     * @brief 初始化UIImageAnimatorView,并设置为GIF动画。
-     *
-     * 该函数用于使用提供的GIF图像和属性初始化UIImageAnimatorView。
-     *
-     * @param imageAnimator 要初始化的UIImageAnimatorView对象的引用。
-     * @param paths GIF图像文件路径的数组。
-     * @param numFrames GIF中的帧数。
-     * @param left 视图的左侧位置。
-     * @param top 视图的顶部位置。
-     * @param width 视图的宽度。
-     * @param height 视图的高度。
-     * @param viewId 视图的ID。
-     * @param time 视图的帧速
-     * @return 如果初始化成功则返回true,否则返回false。
-     */
-    void TraingWinView::InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId, int time)
-    {
-        if (imageAnimator == nullptr)
-        {
-            imageAnimator = new UIImageAnimatorView();
-        }
-        imageAnimator->SetPosition(left, top);
-        imageAnimator->Resize(width, height);
-        imageAnimator->SetViewId(viewId);
-        imageAnimator->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
-        imageAnimator->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
-
-        ImageAnimatorInfo *imageAnimatorInfo = new ImageAnimatorInfo[numFrames];
-        for (int i = 0; i < numFrames; i++)
-        {
-            imageAnimatorInfo[i].imagePath = imagePaths[i];
-            imageAnimatorInfo[i].pos.x = left;
-            imageAnimatorInfo[i].pos.y = top;
-            imageAnimatorInfo[i].width = width;
-            imageAnimatorInfo[i].height = height;
-            imageAnimatorInfo[i].imageType = IMG_SRC_FILE_PATH;
-        }
-
-        imageAnimator->SetImageAnimatorSrc(imageAnimatorInfo, numFrames, time); // 200 is the default delay time
-        imageAnimator->SetTimeOfPause(time);
-        imageAnimator->SetRepeatTimes(1);
-        imageAnimator->SetReverse(true);
-        imageAnimator->SetVisible(true);
-    }
-    /* InitView:初始化界面*/
-    void TraingWinView ::InitView()
-    {
-        if (container_ == nullptr)
-        {
-            container_ = new UIViewGroup();
-            container_->SetPosition(0, 0, 466, 466);
-            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
-        }
-
-        // 初始化Lable
-        TraingModel::GetInstance()->InitLabel(label1_, 83, 50, 300, 35, "label1", "目标已达成", DEFAULT_VECTOR_FONT_FILENAME, 35);
-        container_->Add(label1_);
-        TraingModel::GetInstance()->InitLabel(label2_, 70, 215, 326, 97, "label2", "10,000", DEFAULT_VECTOR_FONT_FILENAME, 80);
-        label2_->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
-        container_->Add(label2_);
-        TraingModel::GetInstance()->InitLabel(label3_, 103, 307, 200, 35, "label3", "完成目标", DEFAULT_VECTOR_FONT_FILENAME, 30);
-        container_->Add(label3_);
-        TraingModel::GetInstance()->InitLabel(label4_, 233, 307, 160, 35, "label3", "100%", DEFAULT_VECTOR_FONT_FILENAME, 30);
-        // label4_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0x7f));
-        container_->Add(label4_);
-
-
-        // 初始化图片数组
-        const char *basePath = "/user/res/Training/training_GIF/win/";
-        const char *fileExtension = "bin";
-        const char **imagePaths = CreateImagePathsArray(basePath, fileExtension, 94);
-        InitImageAnimatorSource(imageAnimator, imagePaths, 94, 173, 100, 120, 120, "imageAnimator1", 10);
-        container_->Add(imageAnimator);
-        // FreeImagePathsArray(imagePaths, 94);    //删除数组,释放内存
-
-        // 初始化Button
-        TraingModel::GetInstance()->InitButton(button1_, 0, 366, 466, 100, BUTTONOK);
-        // Set additional property
-
-        button1_->SetImageSrc(BUTTONOK_IMAGE, BUTTONOK_IMAGE);
-        button1_->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingWinPresenter::GetInstance()));
-        container_->Add(button1_);
-    }
-
-    /* DeInit:删除组件*/
-    void TraingWinView::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 TraingWinView::PreLoad(void)
-    {
-        if (!viewiInitStatus)
-        {
-            InitView();
-            imageAnimator->Start();
-            viewiInitStatus = true;
-        }
-    }
-    void TraingWinView::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 *>(TraingWinPresenter::GetInstance());
-        if (draglistener == nullptr)
-        {
-            return;
-        }
-        container_->SetOnDragListener(draglistener);
-
-        container_->SetTouchable(true);
-        container_->SetDraggable(true);
-
-        PreLoad();
-        RootView::GetInstance()->Add(container_);
-    }
-
-    void TraingWinView::OnSetUpView()
-    {
-
-        View<TraingWinPresenter>::OnSetUpView();
-        Draw();
-    }
-
-    void TraingWinView::OnTearDownView()
-    {
-
-        View<TraingWinPresenter>::OnTearDownView();
-        return;
-    }
-
-    void TraingWinView::OnStop()
-    {
-        View<TraingWinPresenter>::OnStop();
-        imageAnimator->Stop();
-        RootView::GetInstance()->RemoveAll();
-        return;
-    }
-}
index 4f4b424..41f557c 100644 (file)
@@ -299,11 +299,11 @@ namespace OHOS
             if (TraingCardView::GetInstance()->RefreshEndView())\r
             {\r
                 // 进行存储操作?\r
-                NativeAbility::GetInstance().EnterSlice(VIEW_TRAININGWIN);\r
+                NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGENDDATA);\r
             }\r
             else\r
             {\r
-                NativeAbility::GetInstance().Back();\r
+                NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGMORE);\r
             }\r
         }\r
         // 返回按键\r
@@ -330,8 +330,8 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Invalid sport command");\r
             return false;\r
         }\r
-        uapi_set_screen_on_api();                                   // 亮屏检测\r
-        NativeAbility::GetInstance().EnterSlice(VIEW_TRAININGCRAD); // 切换Slice\r
+        uapi_set_screen_on_api();                                    // 亮屏检测\r
+        NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCRAD); // 切换Slice\r
 \r
         switch (cmd->sportType)\r
         {\r