增加训练卡片
authorCaisking <3449750381@qq.com>
Tue, 16 Jan 2024 08:17:36 +0000 (16:17 +0800)
committerCaisking <3449750381@qq.com>
Tue, 16 Jan 2024 08:17:36 +0000 (16:17 +0800)
18 files changed:
code/sdk/application/wearable/nativeapp/CMakeLists.txt
code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h
code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/nativeapp/nativeui/UIInitializer/UIInitializer.cpp
code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp
code/sdk/application/wearable/nativeapp/nativeui/dial/src/Digital_clockView.cpp
code/sdk/application/wearable/nativeapp/nativeui/main/include/MainViewSample.h
code/sdk/application/wearable/nativeapp/nativeui/main/src/MainViewSample.cpp
code/sdk/application/wearable/nativeapp/nativeui/screensetting/include/ScreenModels.h
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingPresenter.h [deleted file]
code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingView.h
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEnddataPresenter.cpp
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingEndnote2Presenter.cpp
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSPresenter.cpp
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSlackPresenter.cpp
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingMorePresenter.cpp
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingPresenter.cpp [deleted file]
code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingView.cpp

index dc557da..c1a97ca 100755 (executable)
@@ -46,6 +46,8 @@ set(PRIVATE_HEADER
     ${CMAKE_CURRENT_SOURCE_DIR}/../service/smart_voice/voice_engine_hal/interfaces/innerkits/native_c/include\r
     ${CMAKE_CURRENT_SOURCE_DIR}/../ohos_deps\r
     ${CMAKE_CURRENT_SOURCE_DIR}/../../battery\r
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../../drivers/drivers/driver/rtc_unified\r
+    ${CMAKE_CURRENT_SOURCE_DIR}/../../../kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/compat/linux/include/uapi/linux/\r
    \r
     ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits\r
     ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include\r
@@ -250,7 +252,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/heartrate/src/HeartRemindPresenter.cpp\r
 \r
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingView.cpp\r
-    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingPresenter.cpp\r
+\r
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingMoreView.cpp\r
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingMorePresenter.cpp\r
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingLimitView.cpp\r
index 2dc381c..159a0fa 100755 (executable)
@@ -77,7 +77,7 @@ typedef enum : uint16_t
 \r
     VIEW_HEARTRATEREMIND, // 心率提醒\r
 \r
-    VIEW_TRAINING,          // 训练\r
+    //VIEW_TRAINING,          // 训练\r
     VIEW_TRAININGMORE,      // 更多训练\r
     VIEW_TRAININGLIMIT,     // 极限运动子列表\r
     VIEW_TRAININGNOMAL,     // 正常训练开始界面(除骑行,健走,跑步外)\r
index d91b014..1206c63 100755 (executable)
 \r
 #include "heartrate/include/HeartRemindPresenter.h"\r
 #include "heartrate/include/HeartRemindView.h"\r
-#include "traing/include/TraingPresenter.h"\r
+\r
 #include "traing/include/TraingView.h"\r
 #include "traing/include/TraingMorePresenter.h"\r
 #include "traing/include/TraingMoreView.h"\r
@@ -294,7 +294,7 @@ static const AppViewMapper SLICE_MAPPER[] = {
  \r
     {VIEW_HEARTRATEREMIND, &NativeLauncher::InitHeartRemindSlice}, \r
 \r
-    {VIEW_TRAINING, &NativeLauncher::InitTraingSlice},                          //训练\r
+    //{VIEW_TRAINING, &NativeLauncher::InitTraingSlice},                          //训练\r
     {VIEW_TRAININGMORE, &NativeLauncher::InitTraingMoreSlice},                  //更多训练\r
     {VIEW_TRAININGLIMIT, &NativeLauncher::InitTraingLimitSlice},                //极限训练\r
     {VIEW_TRAININGNOMAL, &NativeLauncher::InitTraingNomalSlice},                //正常训练初始界面\r
@@ -900,11 +900,11 @@ void NativeLauncher::InitHeartRemindSlice(void)
 }\r
 \r
 //体能训练\r
-void NativeLauncher::InitTraingSlice(void)\r
-{\r
-    SliceProxy *traingview = new AbilitySliceProxy<TraingView, TraingPresenter>;\r
-    NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAINING, traingview);\r
-}\r
+// void NativeLauncher::InitTraingSlice(void)\r
+// {\r
+//     SliceProxy *traingview = new AbilitySliceProxy<TraingView, TraingPresenter>;\r
+//     NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAINING, traingview);\r
+// }\r
 void NativeLauncher::InitTraingMoreSlice(void)\r
 {\r
     SliceProxy *traingmoreview = new AbilitySliceProxy<TraingMoreView, TraingMorePresenter>;\r
index a81a6e0..df94f14 100644 (file)
@@ -35,7 +35,7 @@ namespace OHOS
         label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
         label->SetRollSpeed(0);
         // 设置标签可见
-        label->SetVisible(true);
+        //label->SetVisible(true);
     }
 
     /**
index ea03f2a..96cdfd3 100755 (executable)
@@ -35,7 +35,7 @@ namespace OHOS
     {VIEW_MAIN_COUNTDOWN, PNG_APPLIST_COUNTDOWN_IMAGE, PNG_APPLIST_COUNTDOWN_IMAGE, "计时器", nullptr},\r
     {VIEW_BLOODOXY_SAMPLE, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_SPO2_IMAGE, "血氧饱和度", nullptr},\r
     {VIEW_INDOORWALK, PNG_APPLIST_WALK_IMAGE, PNG_APPLIST_WALK_IMAGE, "室内步行", nullptr},\r
-    {VIEW_TRAINING, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_TRAINING_IMAGE, "体能训练", nullptr},\r
+    //{VIEW_TRAINING, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_TRAINING_IMAGE, "体能训练", nullptr},\r
     //{VIEW_TRAINING_RECORD, PNG_APPLIST_TRAINING_RECORD_IMAGE, PNG_APPLIST_TRAINING_RECORD_IMAGE, "训练记录", nullptr},\r
     {VIEW_OFFLINEVOICE, PNG_APPLIST_VOCASSIST_IMAGE, PNG_APPLIST_VOCASSIST_IMAGE, "语音助手", nullptr},\r
     {VIEW_BLOODPRESSURE, PNG_APPLIST_BLOODPRESSURE_IMAGE, PNG_APPLIST_BLOODPRESSURE_IMAGE, "睡眠监测", nullptr},\r
index 6b24e8a..43234bb 100644 (file)
 #include <regex>
 #include <iomanip>   // 用于格式化输出
 #include <stdexcept> //异常处理
+#include "timer.h"
+#include "uapi/linux/rtc.h"
+#include <iostream>
+#include <sstream>
 
 #include "MainViewSample.h"
 
 #define PRINT_DEBUG_INFO printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);
+extern "C"
+{
+    int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time);
+}
 
 namespace OHOS
 {
@@ -250,7 +258,25 @@ namespace OHOS
             Add(backgroundAnimator);
             // backgroundAnimator->SetVisible(true);
         }
-        stringtime = "11:54";
+
+        /* -------------------------------------------------------------------------- */
+        struct tm local_time;
+        time_t seconds;
+        seconds = time(NULL);
+        if (localtime_r(&seconds, &local_time) == NULL)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Digital_clockView::Digital_clockView get localtime error!");
+            return false;
+        }
+        std::ostringstream ostrHour, ostMin;
+        ostrHour << local_time.tm_hour;
+        ostMin << local_time.tm_min;
+        std::string weekStr = ostrHour.str() + ":" + ostMin.str();
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "time = %s!", weekStr.c_str());
+        printf("weekStr:%s\n",weekStr.c_str());
+        /* -------------------------------------------------------------------------- */
+        stringtime = "11:35";
+
         // updateClockTime(stringtime);
         cJSON *digits = cJSON_GetObjectItem(cjson_json, "digits");
         std::string playformat = cJSON_GetObjectItem(digits, "playformat")->valuestring;
index e975361..24c3f76 100755 (executable)
@@ -1,12 +1,12 @@
-/*** \r
+/***\r
  * @Author: Caisking 3449750381@qq.com\r
  * @Date: 2023-12-12 16:55:29\r
  * @LastEditors: Caisking 3449750381@qq.com\r
- * @LastEditTime: 2024-01-15 17:19:52\r
+ * @LastEditTime: 2024-01-16 15:37:18\r
  * @FilePath: /1.FD230/FD230/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainViewSample.h\r
- * @Description: \r
+ * @Description:\r
  * @\r
- * @Copyright (c) 2024 by Caisking , All Rights Reserved. \r
+ * @Copyright (c) 2024 by Caisking , All Rights Reserved.\r
  */\r
 /*\r
  * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.\r
 #include "components/ui_cross_view.h"\r
 #include "dial/include/Digital_clockView.h"\r
 #include "blood/include/BloodView.h"\r
-namespace OHOS {\r
-class MainPresenterSample;\r
-class MainViewSample : public View<MainPresenterSample> {\r
-public:\r
-    MainViewSample();\r
-    virtual ~MainViewSample();\r
-    static MainViewSample *GetInstance(void);\r
-    void OnStart() override;\r
-    void OnSetUpView() override;\r
-    void OnTearDownView() override;\r
-    void OnStop() override;\r
-    UICardPage *InitWatchFacePage(void);\r
-    UICardPage *InitHeartRatePage(void);\r
-    UICardPage *InitActivityPage(void);\r
-    UICardPage *InitCompassPage(void);\r
-    UICardPage *InitMusicPlayerPage(void);\r
-    UICardPage *InitNewDialPage(void);\r
-    UICardPage *InitBloodOxygenPage(void);\r
-     \r
-    void AnimatorStart(int pageIndex);\r
-    void AnimatorStop(void);\r
-    uint16_t GetHorCurrentPage() const\r
+#include "traing/include/TraingView.h"\r
+namespace OHOS\r
+{\r
+    class MainPresenterSample;\r
+    class MainViewSample : public View<MainPresenterSample>\r
     {\r
-        return mainSwipeGroup->GetCurrentPageId(UISwipeView::HORIZONTAL); // 0: horizontal; 1: vertical\r
-    }\r
+    public:\r
+        MainViewSample();\r
+        virtual ~MainViewSample();\r
+        static MainViewSample *GetInstance(void);\r
+        void OnStart() override;\r
+        void OnSetUpView() override;\r
+        void OnTearDownView() override;\r
+        void OnStop() override;\r
+        UICardPage *InitWatchFacePage(void);\r
+        UICardPage *InitHeartRatePage(void);\r
+        UICardPage *InitActivityPage(void);\r
+        UICardPage *InitCompassPage(void);\r
+        UICardPage *InitMusicPlayerPage(void);\r
+        UICardPage *InitNewDialPage(void);\r
+        UICardPage *InitBloodOxygenPage(void);\r
+        UICardPage *InitTrainingPage(void);\r
 \r
-    UIView* GetMainViewGroup(void) const\r
-    {\r
-        return mainSwipeGroup;\r
-    }\r
+        void AnimatorStart(int pageIndex);\r
+        void AnimatorStop(void);\r
+        uint16_t GetHorCurrentPage() const\r
+        {\r
+            return mainSwipeGroup->GetCurrentPageId(UISwipeView::HORIZONTAL); // 0: horizontal; 1: vertical\r
+        }\r
+\r
+        UIView *GetMainViewGroup(void) const\r
+        {\r
+            return mainSwipeGroup;\r
+        }\r
+\r
+        bool IsMainView(void);\r
+        void SetDragFg(bool continFg);\r
+        bool GetDragFg(void);\r
+\r
+    private:\r
+        int16_t maxPage{0};\r
+        bool continuDragFg{false};\r
+        PullUpDownView *dropDownView{nullptr};\r
+        UICardPage *messageView{nullptr};\r
+        UILabel *messageLable{nullptr};\r
+\r
+        /* -------------------------------------------------------------------------- */\r
+        Digital_clockView *mainClockView{nullptr};\r
+        ActivityWeekView *activityWeekView{nullptr};\r
+        PlayersView *playersView{nullptr};\r
+        /* -------------------------------------------------------------------------- */\r
 \r
-    bool IsMainView(void);\r
-    void SetDragFg(bool continFg);\r
-    bool GetDragFg(void);\r
-  \r
-private:\r
-   \r
-    int16_t maxPage{0};\r
-    bool continuDragFg{false};\r
-    PullUpDownView *dropDownView{nullptr};\r
-    UICardPage *messageView{nullptr};\r
-    UILabel *messageLable{nullptr};\r
-    \r
-    /* -------------------------------------------------------------------------- */\r
-    Digital_clockView *mainClockView{nullptr};\r
-    ActivityWeekView *activityWeekView{nullptr};\r
-    PlayersView *playersView{nullptr};\r
-    /* -------------------------------------------------------------------------- */\r
+        CompassControlView *compassControlView{nullptr};\r
+        HeartRateView *heartRateView{nullptr};\r
+        Digital_clockView *dialView{nullptr};\r
+        BloodView *bloodView{nullptr};\r
+        TraingView *traingView{nullptr};\r
 \r
-    CompassControlView *compassControlView{nullptr};\r
-    HeartRateView *heartRateView{nullptr};\r
-    Digital_clockView*dialView{nullptr};\r
-    BloodView*bloodView{nullptr};\r
-    UICardPage *recordCard[MAX_CARD]{nullptr};\r
-    bool pageStatus[MAX_CARD]{false};\r
-    UICrossView *mainSwipeGroup{nullptr};\r
-    ZoomEffect* callback{nullptr};\r
+        /* -------------------------------------------------------------------------- */\r
+        UICardPage *recordCard[MAX_CARD]{nullptr};\r
+        bool pageStatus[MAX_CARD]{false};\r
+        UICrossView *mainSwipeGroup{nullptr};\r
+        ZoomEffect *callback{nullptr};\r
 \r
-    bool HorizontalViewInit(void);\r
-    void VerticalViewInit(void);\r
-    void VertViewLoad(void);\r
-    void HorViewLoad(void);\r
-    UICardPage *CreatePage(int32_t cardId);\r
-};\r
+        bool HorizontalViewInit(void);\r
+        void VerticalViewInit(void);\r
+        void VertViewLoad(void);\r
+        void HorViewLoad(void);\r
+        UICardPage *CreatePage(int32_t cardId);\r
+    };\r
 } // namespace OHOS\r
 #endif // MAIN_VIEW_SAMPLE_H\r
index e5b1fae..26991d9 100755 (executable)
@@ -40,6 +40,7 @@ namespace OHOS
         {HEART_RATE, &MainViewSample::InitHeartRatePage},\r
         {COMPASS, &MainViewSample::InitCompassPage},\r
         {BloodOxygen, &MainViewSample::InitBloodOxygenPage},\r
+        {TRAINING, &MainViewSample::InitTrainingPage},\r
     };\r
 \r
     MainViewSample::MainViewSample()\r
@@ -362,7 +363,18 @@ namespace OHOS
         }\r
         return bloodView;\r
     }\r
-\r
+    // 主界面训练卡片\r
+    UICardPage *MainViewSample::InitTrainingPage(void)\r
+    {\r
+        traingView = new TraingView();\r
+        if (traingView == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "traingView new fail");\r
+            return nullptr;\r
+        }\r
+        return traingView;\r
+    }\r
+    /* -------------------------------------------------------------------------- */\r
     UICardPage *MainViewSample::CreatePage(int32_t StreamId)\r
     {\r
         uint16_t i;\r
@@ -372,7 +384,7 @@ namespace OHOS
         for (i = 0; i < sizeof(PageMapper) / sizeof(PageMapper[0]); i++)\r
         {\r
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::CreatePage PageMapper[i].id=%d, cardId=%d, StreamId=%d", PageMapper[i].id, cardId, StreamId);\r
-            //printf("MainViewSample::CreatePage PageMapper[i].id=%d, cardId=%d, StreamId=%d\n", PageMapper[i].id, cardId, StreamId);\r
+            printf("MainViewSample::CreatePage PageMapper[i].id=%d, cardId=%d, StreamId=%d\n", PageMapper[i].id, cardId, StreamId);\r
             if (PageMapper[i].id == cardId)\r
             {\r
                 view = (this->*(PageMapper[i].func))();\r
index 50063c5..51f5392 100755 (executable)
@@ -1,12 +1,12 @@
-/*** \r
+/***\r
  * @Author: Caisking 3449750381@qq.com\r
  * @Date: 2023-12-15 14:33:22\r
  * @LastEditors: Caisking 3449750381@qq.com\r
- * @LastEditTime: 2024-01-15 19:34:47\r
+ * @LastEditTime: 2024-01-16 15:56:24\r
  * @FilePath: /1.FD230/FD230/code/sdk/application/wearable/nativeapp/nativeui/screensetting/include/ScreenModels.h\r
- * @Description: \r
+ * @Description:\r
  * @\r
- * @Copyright (c) 2024 by Caisking , All Rights Reserved. \r
+ * @Copyright (c) 2024 by Caisking , All Rights Reserved.\r
  */\r
 \r
 #ifndef SCREEN_MODEL_H\r
@@ -21,6 +21,7 @@ namespace OHOS
     {\r
         NEW_DAIL = 0,\r
         HEART_RATE,\r
+        TRAINING,\r
         COMPASS,\r
         BloodOxygen,\r
         MAX_CARD,\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingPresenter.h
deleted file mode 100755 (executable)
index 042eed1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _Traing_PRESENTER_H
-#define _Traing_PRESENTER_H
-
-#include "Presenter.h"
-#include "TraingView.h"
-
-namespace OHOS
-{
-    class TraingView;
-
-    class TraingPresenter : public Presenter<TraingView>,
-                                 public UIView::OnClickListener,
-                                 public UIView::OnDragListener
-    {
-    public:
-        TraingPresenter();
-        virtual ~TraingPresenter();
-
-        void OnStart() override;
-        void OnPause() override;
-        void OnResume() override;
-        void OnStop() override;
-
-        static TraingPresenter *GetInstance();
-
-    private:
-        // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
-        bool OnClick(UIView &view, const ClickEvent &event) override;
-        bool OnDrag(UIView &view, const DragEvent &event) override;
-    };
-} // namespace OHOS
-
-#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
index c4c1150..bc624e9 100755 (executable)
@@ -1,3 +1,13 @@
+/***
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2023-12-12 16:55:27
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-01-16 14:43:12
+ * @FilePath: /1.FD230/FD230/code/sdk/application/wearable/nativeapp/nativeui/traing/include/TraingView.h
+ * @Description:
+ * @
+ * @Copyright (c) 2024 by Caisking , All Rights Reserved.
+ */
 #ifndef _Traing_VIEW_H
 #define _Traing_VIEW_H
 
 #include "ohos_types.h"
 #include "components/ui_card_page.h"
 
-#include "TraingPresenter.h"
 namespace OHOS
 {
-#define BUTTON1 "button1" // 按键1
-#define BUTTON2 "button2" // 按键2
-#define BUTTON3 "button3" // 按键3
+#define BUTTON1 "button1"    // 按键1
+#define BUTTON2 "button2"    // 按键2
+#define BUTTON3 "button3"    // 按键3
 #define BUTTONMORE "button4" // 按键 更多
 
-    class TraingPresenter;
-    class TraingView : public View<TraingPresenter>
+    class TraingView : public UICardPage
     {
 
     public:
@@ -32,32 +40,32 @@ namespace OHOS
         virtual ~TraingView();
         static TraingView *GetInstance(void);
 
-        void OnStart() override;
-        void OnSetUpView() override;
-        void OnTearDownView() override;
-        void OnStop() override;
-        void Init();
+        bool InitView();
         void DeInit();
 
-        UIView *GetView();
+        bool AddButton();
+        bool InitImage();
+        bool InitLable();
+
+        void PreLoad(void) override;
+        void UnLoad(void) override;
 
     private:
         UIView::OnDragListener *draglistener{nullptr};
         TraingView(TraingView &&) = delete;
         TraingView &operator=(TraingView &&) = delete;
 
-        UIViewGroup *container_ = nullptr;
-        UILabel *label1_ = nullptr;
-        UIButton *button3_ = nullptr;
-        UIButton *button4_ = nullptr;
-        UIButton *button1_ = nullptr;
-        UIButton *button2_ = nullptr;
-        UIImageView *image1_ = nullptr;
-        UILabel *label2_ = nullptr;
-        UIImageView *image3_ = nullptr;
-        UILabel *label3_ = nullptr;
-        UIImageView *image5_ = nullptr;
-        UILabel *label4_ = nullptr;
+        UILabelButtonExt *Button1 = nullptr;
+        UILabelButtonExt *Button2 = nullptr;
+        UILabelButtonExt *Button3 = nullptr;
+        UILabelButtonExt *ButtonMore = nullptr;
+
+        UILabel *titleLabel = nullptr;
+        UIImageView *image1 = nullptr;
+        UIImageView *image2 = nullptr;
+        UIImageView *image3 = nullptr;
+        UIImageView *imagemore = nullptr;
+        bool viewiInitStatus{false};
     };
 } // namespace OHOS
 #endif // Traing_PRESENTER_H
index e1fd4f5..f469d6d 100755 (executable)
@@ -72,7 +72,7 @@ namespace OHOS
         // 根据控件id查找是哪个控件触发了点击回调
         if (strcmp(view.GetViewId(), BUTTONBACK) == 0)
         {
-            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);
+            //NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);
         }
         return true;
     }
index 7fd64f6..ae8c859 100644 (file)
@@ -76,7 +76,7 @@ namespace OHOS
         }
         if (strcmp(view.GetViewId(), BUTTONYES) == 0)
         {
-            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);
+            //NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);
         }
         return true;
     }
index c436678..8bb2633 100755 (executable)
@@ -62,7 +62,7 @@ namespace OHOS
             (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))
         {
             uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
-                       NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);
+                       //NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);
         }
         UNUSED(view);
         return true;
index 624a246..8887c53 100755 (executable)
@@ -1,3 +1,13 @@
+/*** 
+ * @Author: Caisking 3449750381@qq.com
+ * @Date: 2023-12-12 16:55:28
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-01-16 15:44:47
+ * @FilePath: /1.FD230/FD230/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingGPSlackPresenter.cpp
+ * @Description: 
+ * @
+ * @Copyright (c) 2024 by Caisking , All Rights Reserved. 
+ */
 #include "AppViewIDs.h"
 #include "NativeAbility.h"
 
@@ -62,7 +72,7 @@ namespace OHOS
             (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))
         {
             uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
-           NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);
+           //NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);
         }
         UNUSED(view);
         return true;
index 5b6f363..44119bf 100755 (executable)
@@ -61,7 +61,7 @@ namespace OHOS
         if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
             (event.GetDeltaX() > 40) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
         {\r
-            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);\r
+            //NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING);\r
         }\r
         UNUSED(view);\r
         return true;\r
diff --git a/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/traing/src/TraingPresenter.cpp
deleted file mode 100755 (executable)
index f090fc8..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#include "AppViewIDs.h"
-#include "NativeAbility.h"
-
-#include <iostream>
-#include <chrono>
-#include <thread>
-#include "traing/include/TraingPresenter.h"
-// #include "TraingView.h"
-
-namespace OHOS
-{
-
-    // 当前Presenter属性实例化的内存指针
-    static TraingPresenter *g_pTraingPresenter = nullptr;
-
-    TraingPresenter::TraingPresenter()
-    {
-
-        g_pTraingPresenter = this;
-    }
-
-    TraingPresenter::~TraingPresenter()
-    {
-
-        g_pTraingPresenter = nullptr;
-    }
-
-    TraingPresenter *TraingPresenter::GetInstance()
-    {
-
-        return g_pTraingPresenter;
-    }
-
-    void TraingPresenter::OnStart()
-    {
-
-        Presenter<TraingView>::OnStart();
-    }
-
-    void TraingPresenter::OnPause(void)
-    {
-
-        Presenter<TraingView>::OnPause();
-    }
-
-    void TraingPresenter::OnResume(void)
-    {
-
-        Presenter<TraingView>::OnResume();
-    }
-
-    void TraingPresenter::OnStop(void)
-    {
-
-        Presenter<TraingView>::OnStop();
-    }
-
-    bool TraingPresenter::OnDrag(UIView &view, const DragEvent &event)
-    {
-
-        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&
-            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))
-        {
-            NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST);
-        }
-        UNUSED(view);
-        return true;
-    }
-
-    bool TraingPresenter::OnClick(UIView &view, const ClickEvent &event)
-    {
-        // 根据控件id查找是哪个控件触发了点击回调
-        if (strcmp(view.GetViewId(), BUTTONMORE) == 0)
-        {
-            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGMORE);
-        }
-        if (strcmp(view.GetViewId(), BUTTON1) == 0)
-        {
-            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGGPS);
-        }
-        if (strcmp(view.GetViewId(), BUTTON2) == 0)
-        {
-            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGGPSLACK);
-        }
-        if (strcmp(view.GetViewId(), BUTTON3) == 0)
-        {
-            NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGGPS);
-        }
-        return true;
-    }
-}
index d1a38ef..3d43b9f 100755 (executable)
@@ -6,14 +6,15 @@
 #include "ui_resource_image.h"\r
 #include <ui_scroll_view.h>\r
 #include "components/ui_button.h"\r
-#include "UIInitializer.h"\r
+#include "components/ui_view_group.h"\r
+\r
 namespace OHOS\r
 {\r
     static TraingView *g_pTraingView{nullptr};\r
 \r
     TraingView::TraingView()\r
     {\r
-\r
+        SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);\r
         g_pTraingView = this;\r
     }\r
 \r
@@ -25,409 +26,258 @@ namespace OHOS
 \r
     TraingView *TraingView::GetInstance()\r
     {\r
-\r
         return g_pTraingView;\r
     }\r
-\r
-    void TraingView::Init()\r
+    bool TraingView::AddButton()\r
     {\r
-        if (container_ == nullptr)\r
+        std::string traing1 = "健走";\r
+        std::string traing2 = "骑行";\r
+        std::string traing3 = "跑步";\r
+        std::string traingmore = "更多";\r
+        /* -------------------------------------------------------------------------- */\r
+        if (Button1 == nullptr)\r
         {\r
-            container_ = new UIViewGroup();\r
-            container_->SetPosition(0, 0, 466, 466);\r
-            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
+            Button1 = new UILabelButtonExt();\r
         }\r
-\r
-        /* Add Label to App\r
-        if (label1_ == nullptr)\r
+        Button1->SetPosition(86, 118); // widget's left position and top position\r
+        Button1->Resize(140, 140);     // widget's width and height\r
+        Button1->SetViewId(BUTTON1);   // Set style\r
+\r
+        const char *labelButton1defaultImgSrc = PNG_TRAING_BUTTONGRONG2_IMAGE;\r
+        char *labelButton1triggeredImgSrc = nullptr;\r
+        Button1->SetImageSrc(labelButton1defaultImgSrc, labelButton1triggeredImgSrc);\r
+        Button1->SetText(traing1.c_str());\r
+        Button1->SetLabelPosition(0, 70);\r
+        Button1->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+        Button1->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff19ff41, UIButton::PRESSED);\r
+        Button1->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // UIView::OnClickListener *labelButton1Click = static_cast<UIView::OnClickListener *>(new Labelbutton1OnClickListener());\r
+        // Button1->SetOnClickListener(labelButton1Click);\r
+        Add(Button1);\r
+        /* -------------------------------------------------------------------------- */\r
+        if (Button2 == nullptr)\r
         {\r
-            label1_ = new UILabel();\r
+            Button2 = new UILabelButtonExt();\r
         }\r
-        label1_->SetPosition(173, 52); // widget's left position and top position\r
-        label1_->Resize(200, 60);      // widget's width and height\r
-        label1_->SetViewId("label1");  // Set style\r
-        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
+        Button2->SetPosition(236, 118); // widget's left position and top position\r
+        Button2->Resize(140, 140);      // widget's width and height\r
+        Button2->SetViewId(BUTTON2);    // Set style\r
 \r
         // Set additional property\r
-        label1_->SetText("快速训练");\r
-        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label1_->SetRollSpeed(0);\r
-        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-\r
-        // Add to rootView\r
-        container_->Add(label1_);\r
-        label1_->SetVisible(true);\r
-        */\r
-\r
-        // 创建一个 ComponentConfig 结构体实例\r
-        UILabelConfig labelConfig = {173, 52, 200, 60, "label1", "快速训练", DEFAULT_VECTOR_FONT_FILENAME, 30};\r
-\r
-        // 使用 UIInitializer 类中的初始化函数来初始化标签\r
-        UIInitializer::InitLabel(label1_, labelConfig);\r
-\r
-        // Add Button to App\r
-        if (button3_ == nullptr)\r
+        const char *labelButton2defaultImgSrc = PNG_TRAING_BUTTONGRONG_IMAGE;\r
+        char *labelButton2triggeredImgSrc = nullptr;\r
+        Button2->SetImageSrc(labelButton2defaultImgSrc, labelButton2triggeredImgSrc);\r
+        Button2->SetText(traing2.c_str());\r
+        Button2->SetLabelPosition(0, 70);\r
+        Button2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+        Button2->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff19ff41, UIButton::PRESSED);\r
+        Button2->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // UIView::OnClickListener *labelButton2Click = static_cast<UIView::OnClickListener *>(new Labelbutton1OnClickListener());\r
+        // Button2->SetOnClickListener(labelButton2Click);\r
+        Add(Button2);\r
+        /* -------------------------------------------------------------------------- */\r
+        if (Button3 == nullptr)\r
         {\r
-            button3_ = new UIButton();\r
+            Button3 = new UILabelButtonExt();\r
         }\r
-        button3_->SetPosition(236, 268); // widget's left position and top position\r
-        button3_->Resize(140, 140);      // widget's width and height\r
-        button3_->SetViewId(BUTTONMORE); // Set style\r
-        button3_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
-        button3_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
+        Button3->SetPosition(86, 268); // widget's left position and top position\r
+        Button3->Resize(140, 140);     // widget's width and height\r
+        Button3->SetViewId(BUTTON3);   // Set style\r
+        Button3->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
+        Button3->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
         // Set additional property\r
-#ifdef _WIN32\r
-        char *button3defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Training/More.bin";\r
-#else\r
-        const char *button3defaultImgSrc = PNG_TRAING_BOUTTONMORE_IMAGE;\r
-#endif\r
+        const char *button3defaultImgSrc = PNG_TRAING_BUTTONGRONG_IMAGE;\r
         char *button3triggeredImgSrc = nullptr;\r
-        button3_->SetImageSrc(button3defaultImgSrc, button3triggeredImgSrc);\r
-        button3_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff33df1c, UIButton::PRESSED);\r
-        button3_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
-        button3_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button3Click = static_cast<UIView::OnClickListener *>(TraingPresenter::GetInstance());\r
-        button3_->SetOnClickListener(button3Click);\r
-        // Add to rootView\r
-        container_->Add(button3_);\r
-        button3_->SetVisible(true);\r
+        Button3->SetImageSrc(button3defaultImgSrc, button3triggeredImgSrc);\r
+        Button3->SetText(traing3.c_str());\r
+        Button3->SetLabelPosition(0, 70);\r
+        Button3->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+        Button3->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff19ff41, UIButton::PRESSED);\r
+        Button3->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(TraingPresenter::GetInstance());\r
+        // Button3->SetOnClickListener(button1Click);\r
+        Add(Button3);\r
+        /* -------------------------------------------------------------------------- */\r
 \r
         // Add Button to App\r
-        if (button4_ == nullptr)\r
+        if (ButtonMore == nullptr)\r
         {\r
-            button4_ = new UIButton();\r
+            ButtonMore = new UILabelButtonExt();\r
         }\r
-        button4_->SetPosition(86, 118); // widget's left position and top position\r
-        button4_->Resize(140, 140);     // widget's width and height\r
-        button4_->SetViewId(BUTTON2);   // Set style\r
-        button4_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
-        button4_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
+        ButtonMore->SetPosition(236, 268); // widget's left position and top position\r
+        ButtonMore->Resize(140, 140);      // widget's width and height\r
+        ButtonMore->SetViewId(BUTTONMORE); // Set style\r
+        ButtonMore->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
+        ButtonMore->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
 \r
         // Set additional property\r
-#ifdef _WIN32\r
-        char *button4defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Training/Buttonground2.bin";\r
-#else\r
-        const char *button4defaultImgSrc = PNG_TRAING_BUTTONGRONG2_IMAGE;\r
-#endif\r
+        const char *button4defaultImgSrc = PNG_TRAING_BOUTTONMORE_IMAGE;\r
         char *button4triggeredImgSrc = nullptr;\r
-        button4_->SetImageSrc(button4defaultImgSrc, button4triggeredImgSrc);\r
-        button4_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff33df1c, UIButton::PRESSED);\r
-        button4_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
-        button4_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button4Click = static_cast<UIView::OnClickListener *>(TraingPresenter::GetInstance());\r
-        button4_->SetOnClickListener(button4Click);\r
-        // Add to rootView\r
-        container_->Add(button4_);\r
-        button4_->SetVisible(true);\r
-\r
-        // Add Button to App\r
-        if (button1_ == nullptr)\r
-        {\r
-            button1_ = new UIButton();\r
-        }\r
-        button1_->SetPosition(86, 268); // widget's left position and top position\r
-        button1_->Resize(140, 140);     // widget's width and height\r
-        button1_->SetViewId(BUTTON3);   // Set style\r
-        button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
-        button1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button1defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Training/Bouttonground.bin";\r
-#else\r
-        const char *button1defaultImgSrc = PNG_TRAING_BUTTONGRONG_IMAGE;\r
-#endif\r
-        char *button1triggeredImgSrc = nullptr;\r
-        button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);\r
-        button1_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff33df1c, UIButton::PRESSED);\r
-        button1_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
-        button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(TraingPresenter::GetInstance());\r
-        button1_->SetOnClickListener(button1Click);\r
-        // Add to rootView\r
-        container_->Add(button1_);\r
-        button1_->SetVisible(true);\r
-\r
-        // Add Button to App\r
-        if (button2_ == nullptr)\r
+        ButtonMore->SetImageSrc(button4defaultImgSrc, button4triggeredImgSrc);\r
+        //ButtonMore->SetText(traingmore.c_str());\r
+        ButtonMore->SetLabelPosition(0, 70);\r
+        ButtonMore->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+        ButtonMore->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff19ff41, UIButton::PRESSED);\r
+        ButtonMore->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
+\r
+        // UIView::OnClickListener *button4Click = static_cast<UIView::OnClickListener *>(TraingPresenter::GetInstance());\r
+        // ButtonMore->SetOnClickListener(button4Click);\r
+        Add(ButtonMore);\r
+\r
+        return true;\r
+    }\r
+    bool TraingView::InitLable()\r
+    {\r
+        // 检查标签指针是否为空\r
+        if (titleLabel == nullptr)\r
         {\r
-            button2_ = new UIButton();\r
+            titleLabel = new UILabel();\r
         }\r
-        button2_->SetPosition(236, 118); // widget's left position and top position\r
-        button2_->Resize(140, 140);      // widget's width and height\r
-        button2_->SetViewId(BUTTON1);    // Set style\r
-        button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
-        button2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *button2defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Training/Bouttonground.bin";\r
-#else\r
-        const char *button2defaultImgSrc = PNG_TRAING_BUTTONGRONG_IMAGE;\r
-#endif\r
-        char *button2triggeredImgSrc = nullptr;\r
-        button2_->SetImageSrc(button2defaultImgSrc, button2triggeredImgSrc);\r
-        button2_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff33df1c, UIButton::PRESSED);\r
-        button2_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
-        button2_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button2Click = static_cast<UIView::OnClickListener *>(TraingPresenter::GetInstance());\r
-        button2_->SetOnClickListener(button2Click);\r
-        // Add to rootView\r
-        container_->Add(button2_);\r
-        button2_->SetVisible(true);\r
-\r
+        // 设置标签的位置和大小\r
+        titleLabel->SetPosition(173, 52);\r
+        titleLabel->Resize(200, 60);\r
+        // 设置标签的视图 ID\r
+        titleLabel->SetViewId("titleLabel");\r
+        // 设置标签的样式\r
+        titleLabel->SetStyle(STYLE_TEXT_FONT, 30);\r
+        titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+        // 设置标签的文本和其他属性\r
+        titleLabel->SetText("快速训练");\r
+        titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
+        titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        titleLabel->SetRollSpeed(0);\r
+        Add(titleLabel);\r
+\r
+        return true;\r
+    }\r
+    bool TraingView::InitImage()\r
+    {\r
         // Add ImageView to App\r
-        if (image1_ == nullptr)\r
+        if (image1 == nullptr)\r
         {\r
-            image1_ = new UIImageView();\r
+            image1 = new UIImageView();\r
         }\r
-        image1_->SetPosition(276, 148); // widget's left position and top position\r
-        image1_->Resize(100, 100);      // widget's width and height\r
-        image1_->SetViewId("image2");   // Set style\r
-\r
+        image1->SetPosition(126, 298); // widget's left position and top position\r
+        image1->Resize(100, 100);      // widget's width and height\r
+        image1->SetViewId("image3");   // Set style\r
         // Set additional property\r
-#ifdef _WIN32\r
-        char *image1imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Training/riding-big2.bin";\r
-#else\r
-        const char *image1imagesPath = PNG_TRAING_RIDINGBIG_IMAGE;\r
-#endif\r
-        image1_->SetSrc(image1imagesPath);\r
-\r
+        const char *image1imagesPath = PNG_TRAING_WALKINGBIG_IMAGE;\r
+        image1->SetSrc(image1imagesPath);\r
         // Add to rootView\r
-        container_->Add(image1_);\r
-        image1_->SetVisible(true);\r
+        Add(image1);\r
 \r
-        // Add Label to App\r
-        if (label2_ == nullptr)\r
+        /* -------------------------------------------------------------------------- */\r
+        // Add ImageView to App\r
+        if (image2 == nullptr)\r
         {\r
-            label2_ = new UILabel();\r
+            image2 = new UIImageView();\r
         }\r
-        label2_->SetPosition(286, 210); // widget's left position and top position\r
-        label2_->Resize(200, 60);       // widget's width and height\r
-        label2_->SetViewId("label2");   // Set style\r
-        label2_->SetStyle(STYLE_TEXT_FONT, 20);\r
+        image2->SetPosition(276, 148); // widget's left position and top position\r
+        image2->Resize(100, 100);      // widget's width and height\r
+        image2->SetViewId("image2");   // Set style\r
 \r
         // Set additional property\r
-        label2_->SetText("骑行");\r
-        label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label2_->SetRollSpeed(0);\r
-        label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+        const char *image2imagesPath = PNG_TRAING_RIDINGBIG_IMAGE;\r
+        image2->SetSrc(image2imagesPath);\r
 \r
         // Add to rootView\r
-        container_->Add(label2_);\r
-        label2_->SetVisible(true);\r
+        Add(image2);\r
 \r
+        /* -------------------------------------------------------------------------- */\r
         // Add ImageView to App\r
-        if (image3_ == nullptr)\r
+        if (image3 == nullptr)\r
         {\r
-            image3_ = new UIImageView();\r
+            image3 = new UIImageView();\r
         }\r
-        image3_->SetPosition(126, 298); // widget's left position and top position\r
-        image3_->Resize(100, 100);      // widget's width and height\r
-        image3_->SetViewId("image3");   // Set style\r
+        image3->SetPosition(126, 148); // widget's left position and top position\r
+        image3->Resize(100, 100);      // widget's width and height\r
+        image3->SetViewId("image1");   // Set style\r
 \r
         // Set additional property\r
-#ifdef _WIN32\r
-        char *image3imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Training/running-big.bin";\r
-#else\r
         const char *image3imagesPath = PNG_TRAING_RUNNINGBIG_IMAGE;\r
-#endif\r
-        image3_->SetSrc(image3imagesPath);\r
+        image3->SetSrc(image3imagesPath);\r
 \r
         // Add to rootView\r
-        container_->Add(image3_);\r
-        image3_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label3_ == nullptr)\r
-        {\r
-            label3_ = new UILabel();\r
-        }\r
-        label3_->SetPosition(135, 210); // widget's left position and top position\r
-        label3_->Resize(200, 60);       // widget's width and height\r
-        label3_->SetViewId("label3");   // Set style\r
-        label3_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
-        // Set additional property\r
-        label3_->SetText("健走");\r
-        label3_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label3_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label3_->SetRollSpeed(0);\r
-        label3_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
+        Add(image3);\r
 \r
-        // Add to rootView\r
-        container_->Add(label3_);\r
-        label3_->SetVisible(true);\r
+        return true;\r
+    }\r
 \r
-        // Add ImageView to App\r
-        if (image5_ == nullptr)\r
+    bool TraingView::InitView()\r
+    {\r
+        printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+        if (!InitLable())\r
         {\r
-            image5_ = new UIImageView();\r
-        }\r
-        image5_->SetPosition(126, 148); // widget's left position and top position\r
-        image5_->Resize(100, 100);      // widget's width and height\r
-        image5_->SetViewId("image1");   // Set style\r
-\r
-        // Set additional property\r
-#ifdef _WIN32\r
-        char *image5imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Training/walking-big.bin";\r
-#else\r
-        const char *image5imagesPath = PNG_TRAING_WALKINGBIG_IMAGE;\r
-#endif\r
-        image5_->SetSrc(image5imagesPath);\r
-\r
-        // Add to rootView\r
-        container_->Add(image5_);\r
-        image5_->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label4_ == nullptr)\r
+            printf("InitLable error!\n");\r
+        };\r
+        if (!AddButton())\r
         {\r
-            label4_ = new UILabel();\r
-        }\r
-        label4_->SetPosition(131, 365); // widget's left position and top position\r
-        label4_->Resize(200, 60);       // widget's width and height\r
-        label4_->SetViewId("label4");   // Set style\r
-        label4_->SetStyle(STYLE_TEXT_FONT, 20);\r
-\r
-        // Set additional property\r
-        label4_->SetText("跑步");\r
-        label4_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label4_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label4_->SetRollSpeed(0);\r
-        label4_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);\r
-\r
-        // Add to rootView\r
-        container_->Add(label4_);\r
-        label4_->SetVisible(true);\r
+            printf("AddButton error!\n");\r
+        };\r
+        if (!InitImage())\r
+        {\r
+            printf("InitImage error!\n");\r
+        };\r
+        SetCoverable(true);\r
+        return true;\r
     }\r
 \r
     void TraingView::DeInit()\r
     {\r
-        if (label1_ != nullptr)\r
-        {\r
-            delete label1_;\r
-            label1_ = nullptr;\r
-        }\r
-        if (button3_ != nullptr)\r
-        {\r
-            delete button3_;\r
-            button3_ = nullptr;\r
-        }\r
-        if (button4_ != nullptr)\r
+        if (titleLabel != nullptr)\r
         {\r
-            delete button4_;\r
-            button4_ = nullptr;\r
+            delete titleLabel;\r
+            titleLabel = nullptr;\r
         }\r
-        if (button1_ != nullptr)\r
+        if (ButtonMore != nullptr)\r
         {\r
-            delete button1_;\r
-            button1_ = nullptr;\r
+            delete ButtonMore;\r
+            ButtonMore = nullptr;\r
         }\r
-        if (button2_ != nullptr)\r
+        if (Button1 != nullptr)\r
         {\r
-            delete button2_;\r
-            button2_ = nullptr;\r
+            delete Button1;\r
+            Button1 = nullptr;\r
         }\r
-        if (image1_ != nullptr)\r
+        if (Button3 != nullptr)\r
         {\r
-            delete image1_;\r
-            image1_ = nullptr;\r
+            delete Button3;\r
+            Button3 = nullptr;\r
         }\r
-        if (label2_ != nullptr)\r
+        if (Button2 != nullptr)\r
         {\r
-            delete label2_;\r
-            label2_ = nullptr;\r
+            delete Button2;\r
+            Button2 = nullptr;\r
         }\r
-        if (image3_ != nullptr)\r
+        if (image2 != nullptr)\r
         {\r
-            delete image3_;\r
-            image3_ = nullptr;\r
+            delete image2;\r
+            image2 = nullptr;\r
         }\r
-        if (label3_ != nullptr)\r
+        if (image1 != nullptr)\r
         {\r
-            delete label3_;\r
-            label3_ = nullptr;\r
+            delete image1;\r
+            image1 = nullptr;\r
         }\r
-        if (image5_ != nullptr)\r
+        if (image3 != nullptr)\r
         {\r
-            delete image5_;\r
-            image5_ = nullptr;\r
-        }\r
-        if (label4_ != nullptr)\r
-        {\r
-            delete label4_;\r
-            label4_ = nullptr;\r
-        }\r
-        if (container_ != nullptr)\r
-        {\r
-            container_->RemoveAll();\r
-            delete container_;\r
-            container_ = nullptr;\r
+            delete image3;\r
+            image3 = nullptr;\r
         }\r
     }\r
-\r
-    UIView *TraingView::GetView()\r
+    void TraingView::PreLoad(void)\r
     {\r
-        Init();\r
-        return container_;\r
-    }\r
-\r
-    void TraingView::OnStart()\r
-    {\r
-        container_ = new UIViewGroup();\r
-        if (container_ == nullptr)\r
-        {\r
-            return;\r
-        }\r
-        container_->SetPosition(0, 0);\r
-        container_->SetWidth(Screen::GetInstance().GetWidth());\r
-        container_->SetHeight(Screen::GetInstance().GetHeight());\r
-\r
-        // 创建 draglistener 实例并设置为拖动监听器\r
-        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingPresenter::GetInstance());\r
-        if (draglistener == nullptr)\r
+        printf("Function: %s, Line: %d\n", __PRETTY_FUNCTION__, __LINE__);\r
+        if (InitView())\r
         {\r
-            return;\r
+            viewiInitStatus = true;\r
         }\r
-        container_->SetOnDragListener(draglistener);\r
-\r
-        container_->SetTouchable(true);\r
-        container_->SetDraggable(true);\r
-\r
-        GetView();\r
-        RootView::GetInstance()->Add(container_);\r
-    }\r
-\r
-    void TraingView::OnSetUpView()\r
-    {\r
-\r
-        View<TraingPresenter>::OnSetUpView();\r
-        Draw();\r
-    }\r
-\r
-    void TraingView::OnTearDownView()\r
-    {\r
-\r
-        View<TraingPresenter>::OnTearDownView();\r
-        return;\r
     }\r
 \r
-    void TraingView::OnStop()\r
+    void TraingView::UnLoad(void)\r
     {\r
-        View<TraingPresenter>::OnStop();\r
-        RootView::GetInstance()->RemoveAll();\r
-        return;\r
     }\r
 }\r