272:压力slice添加压力错误页面
authorluozheng <1732036298@qq.com>
Tue, 21 Oct 2025 11:56:06 +0000 (19:56 +0800)
committerluozheng <1732036298@qq.com>
Tue, 21 Oct 2025 11:56:06 +0000 (19:56 +0800)
code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestFailView.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestMainView.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestModel.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestPresenter.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/include/stressTestingView.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestFailView.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestMainView.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestModel.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestPresenter.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/stress/src/stressTestingView.cpp

index e69de29..e123fa8 100644 (file)
@@ -0,0 +1,42 @@
+#ifndef STRESS_TEST_FAIL_VIEW_H
+#define STRESS_TEST_FAIL_VIEW_H
+
+#include "components/ui_view_group.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_label_button_ext.h"
+#include "components/ui_image_view.h"
+#include "components/ui_scroll_view.h"
+
+namespace OHOS
+{
+    static constexpr const char *STRESS_TEST_FAIL_VIEW_ID = "STRESS_TEST_FAIL_VIEW_ID";//压力测试失败视图ID
+    static constexpr const char *STOP_TEST_BUTTON_ID = "STOP_TEST_BUTTON_ID";//停止检测按钮ID
+    static constexpr const char *RETRY_TEST_BUTTON_ID = "RETRY_TEST_BUTTON_ID";//重试检测按钮ID
+    static constexpr const char *STOP_BUTTON_ID = "STOP_BUTTON_ID";//停止按钮ID
+    static constexpr const char *RETRY_BUTTON_ID = "RETRY_BUTTON_ID";//重试按钮ID
+
+    class StressTestFailView
+    {
+        public:
+            StressTestFailView();
+            ~StressTestFailView();
+            void ClearAll(void);
+            UIViewGroup *CreateStressTestFailView(void);
+        private:
+            UIViewGroup * CreateStressTestFailView1(void);
+            UIViewGroup * CreateStressTestFailView2(void);
+            UIViewGroup *group{nullptr};
+            UILabelExt *titleLabel{nullptr};
+            UIImageView *imageView{nullptr};
+            UIScrollView *scrollView{nullptr};
+            //错误1相关组件
+            UILabelExt *error1DescriptionLabel{nullptr};
+            UILabelButtonExt *stopTestButton{nullptr};//停止检测
+            UILabelButtonExt *retryTestButton{nullptr};//重试检测
+            //错误2相关组件
+            UILabelExt *error2DescriptionLabel{nullptr};
+            UILabelButtonExt *stopButton{nullptr};//停止
+            UILabelButtonExt *retryButton{nullptr};//重试
+        };
+}
+#endif // STRESS_TEST_FAIL_VIEW_H
\ No newline at end of file
index f937d3d..b350915 100644 (file)
@@ -5,6 +5,8 @@
 #include "stress/include/stressTestPresenter.h"
 #include "components/ui_view_group.h"
 #include "stress/include/stressTestStandbyView.h"
+#include "stress/include/stressTestingView.h"
+#include "stress/include/stressTestFailView.h"
 namespace OHOS
 {
     typedef enum
@@ -34,9 +36,9 @@ namespace OHOS
         void OnStart() override;
     private:
         StressTestStandbyView *standbyView{nullptr};
-        // StressTestView stressTestView{nullptr};
+        StressTestingView *stressTestingView{nullptr};
         // StressTestResultView stressTestResultView{nullptr};
-        // StressTestFailView stressTestFailView{nullptr};
+        StressTestFailView *stressTestFailView{nullptr};
 
     private:
         void ClearAll(void);
index 157f9bd..98ee175 100644 (file)
@@ -4,18 +4,29 @@
 #include <inttypes.h>
 namespace OHOS
 {
+    enum FailType :uint8_t
+    {
+        FAIL_TYPE_NOT_WORN = 0,//未佩戴
+        FAIL_TYPE_INVALID_DATA,//数据无效
+        FAIL_TYPE_OTHER,//其他错误
+    };
+
     class StressTestModel
     {
     public:
         static StressTestModel &GetInstance(void);
         uint8_t GetCurrentView(void);
         void SetCurrentView(uint8_t view);
+        uint8_t GetCurrentFailType(void);
+        void SetCurrentFailType(uint8_t failType);
+        
     private:
         StressTestModel();
         ~StressTestModel();
         StressTestModel(const StressTestModel &) = delete;
         StressTestModel &operator=(const StressTestModel &) = delete;
         uint8_t currentView{0};
+        uint8_t currentFailType{FAIL_TYPE_NOT_WORN};//当前错误类型
     };
 }
 
index b6ebf81..6a364da 100644 (file)
@@ -21,6 +21,8 @@ namespace OHOS
 
         void OnStart() override;
 
+        uint8_t GetCurrentFailType(void);
+
     private:
         bool OnClick(UIView &view, const ClickEvent &event) override;
         bool OnDrag(UIView &view, const DragEvent &event) override;
index e69de29..cdb2a88 100644 (file)
@@ -0,0 +1,25 @@
+#ifndef STRESS_TESTING_VIEW_H
+#define STRESS_TESTING_VIEW_H
+
+#include "components/ui_view_group.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label_button_ext.h"
+namespace OHOS
+{
+    static constexpr const char *STRESSTESTINGVIEW_ID = "STRESSTESTINGVIEW_ID";
+    static constexpr const char *CANCEL_BUTTON_ID = "CANCEL_BUTTON_ID";
+    class StressTestingView 
+    {
+    public:
+        StressTestingView();
+        ~StressTestingView();
+        void ClearAll(void);
+        UIViewGroup * CreateStressTestingView(void);
+    private:
+        UIViewGroup *group{nullptr};
+        UILabelExt *titleLabel{nullptr};
+        UILabelButtonExt *cancelButton{nullptr};
+    };
+}
+#endif
\ No newline at end of file
index e69de29..4ba5779 100644 (file)
@@ -0,0 +1,280 @@
+#include "stress/include/stressTestFailView.h"
+#include "stress/include/stressTestPresenter.h"
+#include "stress/include/stressTestModel.h"
+#include "UiConfig.h"
+
+
+namespace OHOS
+{
+    StressTestFailView::StressTestFailView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestFailView::StressTestFailView");
+    }
+
+    StressTestFailView::~StressTestFailView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestFailView::~StressTestFailView");
+        ClearAll();
+    }
+
+    void StressTestFailView::ClearAll(void)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestFailView::ClearAll");
+    }
+
+    UIViewGroup *StressTestFailView::CreateStressTestFailView1(void)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestFailView::CreateStressTestFailView1");
+        if (group == nullptr)
+        {
+            group = new UIViewGroup();
+            if (group == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail!!");
+                return nullptr;
+            }
+            group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+            group->SetViewId(STRESS_TEST_FAIL_VIEW_ID);
+            group->SetTouchable(true);
+            group->SetDraggable(true);
+            group->SetOnDragListener((UIView::OnDragListener *)OHOS::StressTestPresenter::GetInstance());
+        }
+        if(scrollView == nullptr)
+        {
+            scrollView = new UIScrollView();
+            if (scrollView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "scrollView new fail!!");
+                return nullptr;
+            }
+            scrollView->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+            scrollView->SetTouchable(true);
+            scrollView->SetDraggable(true);
+            group->Add(scrollView);
+        }
+        if (titleLabel == nullptr)
+        {
+            titleLabel = new UILabelExt();
+            if (titleLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel new fail!!");
+                return nullptr;
+            }
+            titleLabel->SetPosition(83, 50,300,35);
+            titleLabel->SetText("检测不到结果");
+            titleLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            titleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            scrollView->Add(titleLabel);
+        }
+        if(imageView == nullptr)
+        {
+            imageView = new UIImageView();
+            if (imageView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "imageView new fail!!");
+                return nullptr;
+            }
+            imageView->SetPosition(193, 111, 80, 80);
+            imageView->SetSrc(PNG_ATTENTION_IMAGE);
+            scrollView->Add(imageView);
+        }
+        if(error1DescriptionLabel == nullptr)
+        {
+            error1DescriptionLabel = new UILabelExt();
+            if (error1DescriptionLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "error1DescriptionLabel new fail!!");
+                return nullptr;
+            }
+            error1DescriptionLabel->SetPosition(33, 208, 400, 105);
+            error1DescriptionLabel->SetText("请确认已带上手表,并保持静止,准备好后点击下方按钮进行重新检测");
+            error1DescriptionLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            error1DescriptionLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            error1DescriptionLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+            error1DescriptionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            error1DescriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            error1DescriptionLabel->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff));
+            scrollView->Add(error1DescriptionLabel);
+        }
+        if(retryTestButton == nullptr)
+        {
+            retryTestButton = new UILabelButtonExt();
+            if (retryTestButton == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "retryTestButton new fail!!");
+                return nullptr;
+            }
+            retryTestButton->SetPosition(118, 334,230,80);
+            retryTestButton->SetText("重试检测");
+            retryTestButton->SetAlign(TEXT_ALIGNMENT_CENTER);
+            retryTestButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            retryTestButton->SetViewId(RETRY_TEST_BUTTON_ID);
+            retryTestButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff0d62ff);
+            retryTestButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+            retryTestButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            retryTestButton->SetOnClickListener((UIView::OnClickListener *)OHOS::StressTestPresenter::GetInstance());
+            scrollView->Add(retryTestButton);
+
+        }
+        if(stopTestButton == nullptr)
+        {
+            stopTestButton = new UILabelButtonExt();
+            if (stopTestButton == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "stopTestButton new fail!!");
+                return nullptr;
+            }
+            stopTestButton->SetPosition(118, 434,230,80);
+            stopTestButton->SetText("停止检测");
+            stopTestButton->SetAlign(TEXT_ALIGNMENT_CENTER);
+            stopTestButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            stopTestButton->SetViewId(STOP_TEST_BUTTON_ID);
+            stopTestButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+            stopTestButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+            stopTestButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            stopTestButton->SetOnClickListener((UIView::OnClickListener *)OHOS::StressTestPresenter::GetInstance());
+            scrollView->Add(stopTestButton);
+        }
+
+        return group;
+    }
+
+    UIViewGroup *StressTestFailView::CreateStressTestFailView2(void)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestFailView::CreateStressTestFailView2");
+        if (group == nullptr)
+        {
+            group = new UIViewGroup();
+            if (group == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group new fail!!");
+                return nullptr;
+            }
+            group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+            group->SetViewId(STRESS_TEST_FAIL_VIEW_ID);
+            group->SetTouchable(true);
+            group->SetDraggable(true);
+            group->SetOnDragListener((UIView::OnDragListener *)OHOS::StressTestPresenter::GetInstance());
+        }
+        if(scrollView == nullptr)
+        {
+            scrollView = new UIScrollView();
+            if (scrollView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "scrollView new fail!!");
+                return nullptr;
+            }
+            scrollView->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+            scrollView->SetTouchable(true);
+            scrollView->SetDraggable(true);
+            group->Add(scrollView);
+        }
+        if (titleLabel == nullptr)
+        {
+            titleLabel = new UILabelExt();
+            if (titleLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel new fail!!");
+                return nullptr;
+            }
+            titleLabel->SetPosition(83, 50,300,35);
+            titleLabel->SetText("检测不到结果");
+            titleLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            titleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            scrollView->Add(titleLabel);
+        }
+        if(imageView == nullptr)
+        {
+            imageView = new UIImageView();
+            if (imageView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "imageView new fail!!");
+                return nullptr;
+            }
+            imageView->SetPosition(193, 111, 80, 80);
+            imageView->SetSrc(PNG_ATTENTION_IMAGE);
+            scrollView->Add(imageView);
+        }
+        if(error1DescriptionLabel == nullptr)
+        {
+            error1DescriptionLabel = new UILabelExt();
+            if (error1DescriptionLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "error1DescriptionLabel new fail!!");
+                return nullptr;
+            }
+            error1DescriptionLabel->SetPosition(53, 230, 360, 70);
+            error1DescriptionLabel->SetText("请确认已带上手表,并保持静止");
+            error1DescriptionLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            error1DescriptionLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            error1DescriptionLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+            error1DescriptionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            error1DescriptionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            error1DescriptionLabel->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff));
+            scrollView->Add(error1DescriptionLabel);
+        }
+        if(retryButton == nullptr)
+        {
+            retryButton = new UILabelButtonExt();
+            if (retryButton == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "retryButton new fail!!");
+                return nullptr;
+            }
+            retryButton->SetPosition(238, 328,170,90);
+            retryButton->SetText("重测");
+            retryButton->SetAlign(TEXT_ALIGNMENT_CENTER);
+            retryButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            retryButton->SetViewId(RETRY_BUTTON_ID);
+            retryButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff0d62ff);
+            retryButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+            retryButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            retryButton->SetOnClickListener((UIView::OnClickListener *)OHOS::StressTestPresenter::GetInstance());
+            scrollView->Add(retryButton);
+
+        }
+        if(stopButton == nullptr)
+        {
+            stopButton = new UILabelButtonExt();
+            if (stopButton == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "stopButton new fail!!");
+                return nullptr;
+            }
+            stopButton->SetPosition(58, 328,170,90);
+            stopButton->SetText("停止");
+            stopButton->SetAlign(TEXT_ALIGNMENT_CENTER);
+            stopButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            stopButton->SetViewId(STOP_BUTTON_ID);
+            stopButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+            stopButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+            stopButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            stopButton->SetOnClickListener((UIView::OnClickListener *)OHOS::StressTestPresenter::GetInstance());
+            scrollView->Add(stopButton);
+        }
+
+        return group;
+    }
+
+    UIViewGroup *StressTestFailView::CreateStressTestFailView(void)
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestFailView::CreateStressTestFailView");
+        if (StressTestPresenter::GetInstance()->GetCurrentFailType() == FAIL_TYPE_NOT_WORN)
+        {
+            return CreateStressTestFailView1();
+        }
+        else if (StressTestPresenter::GetInstance()->GetCurrentFailType() == FAIL_TYPE_INVALID_DATA)
+        {
+            return CreateStressTestFailView2();
+        }
+        return nullptr;
+    }
+}
\ No newline at end of file
index ca1ba0b..c3bf130 100644 (file)
@@ -37,6 +37,16 @@ namespace OHOS
             delete standbyView;
             standbyView = nullptr;
         }
+        if (stressTestingView != nullptr)
+        {
+            delete stressTestingView;
+            stressTestingView = nullptr;
+        }
+        if (stressTestFailView != nullptr)
+        {
+            delete stressTestFailView;
+            stressTestFailView = nullptr;
+        }
         for (int i = 0; i < MAX_STRESSTESTMAINVIEW; i++)
         {
             if (group[i] != nullptr)
@@ -70,6 +80,18 @@ namespace OHOS
 
     bool StressTestMainView::ChangeStressTestView(int16_t thisView)
     {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestMainView::ChangeStressTestView %d", thisView);
+        if (group[thisView] == nullptr)
+        {
+            stressTestingView = new StressTestingView();
+            if (stressTestingView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestMainView:: new stressTestingView fail", thisView);
+                return false;
+            }
+            group[thisView] = stressTestingView->CreateStressTestingView();
+            AddViewToRootContainer(group[thisView]);
+        }
         return true;
     }
 
@@ -80,6 +102,17 @@ namespace OHOS
 
     bool StressTestMainView::ChangeStressTestFailView(int16_t thisView)
     {
+        if (group[thisView] == nullptr)
+        {
+            stressTestFailView = new StressTestFailView();
+            if (stressTestFailView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestMainView:: new stressTestFailView fail", thisView);
+                return false;
+            }
+            group[thisView] = stressTestFailView->CreateStressTestFailView();
+            AddViewToRootContainer(group[thisView]);
+        }
         return true;
     }
 
index 653c137..262a698 100644 (file)
@@ -20,4 +20,14 @@ namespace OHOS
     {
         currentView = view;
     }
+
+    uint8_t StressTestModel::GetCurrentFailType(void)
+    {
+        return currentFailType;
+    }
+
+    void StressTestModel::SetCurrentFailType(uint8_t failType)
+    {
+        currentFailType = failType;
+    }
 }
index dfb6768..d2a6609 100644 (file)
@@ -5,6 +5,7 @@
 #include "UiConfig.h"
 #include "stress/include/stressTestPresenter.h"
 #include "stress/include/stressTestMainView.h"
+#include "stress/include/stressTestModel.h"
 #include "ui_resource_string.h"
 #include "NativeRegisterManager.h"
 
@@ -47,6 +48,27 @@ namespace OHOS
         if (view.GetViewId() == START_TEST_BUTTON_ID)
         {
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestPresenter::OnClick start test");
+            view_->ChangeView(StressTestModel::GetInstance().GetCurrentView(), STRESSTESTVIEW);
+        }
+        else if(view.GetViewId() == CANCEL_BUTTON_ID)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestPresenter::OnClick cancel test");
+        }
+        else if(view.GetViewId() == STOP_TEST_BUTTON_ID)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestPresenter::OnClick stop test");
+        }
+        else if(view.GetViewId() == RETRY_TEST_BUTTON_ID)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestPresenter::OnClick retry test");
+        }
+        else if(view.GetViewId() == STOP_BUTTON_ID)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestPresenter::OnClick stop");
+        }
+        else if(view.GetViewId() == RETRY_BUTTON_ID)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestPresenter::OnClick retry");
         }
         return true;
     }
@@ -67,10 +89,14 @@ namespace OHOS
         UNUSED(view);
         if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && StressTestPresenter::X_DRAG_FLAG)
         {
+            StressTestPresenter::X_DRAG_FLAG = false;
             if (view.GetViewId() == STRESSTESTSTANDBYVIEW_ID)
             {
                 NativeAbility::GetInstance().Back();
-                StressTestPresenter::X_DRAG_FLAG = false;
+            }
+            else if(view.GetViewId() == STRESSTESTINGVIEW_ID)
+            {
+               view_->ChangeView(StressTestModel::GetInstance().GetCurrentView(), STRESSTESTIDLEVIEW);
             }
         }
         return true;
@@ -89,4 +115,9 @@ namespace OHOS
         }
         return true;
     }
+
+    uint8_t StressTestPresenter::GetCurrentFailType(void)
+    {
+        return StressTestModel::GetInstance().GetCurrentFailType();
+    }
 }
\ No newline at end of file
index e69de29..1619671 100644 (file)
@@ -0,0 +1,93 @@
+#include "stress/include/stressTestingView.h"
+#include "stress/include/stressTestPresenter.h"
+
+namespace OHOS
+{
+    StressTestingView::StressTestingView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestingView::StressTestingView");
+    }
+
+    StressTestingView::~StressTestingView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestingView::~StressTestingView");
+        ClearAll();
+    }
+
+    void StressTestingView::ClearAll(void)
+    {
+        if (group != nullptr)
+        {
+            group->RemoveAll();
+            delete group;
+            group = nullptr;
+        }
+        if (titleLabel != nullptr)
+        {
+            delete titleLabel;
+            titleLabel = nullptr;
+        }
+        if (cancelButton != nullptr)
+        {
+            delete cancelButton;
+            cancelButton = nullptr;
+        }
+    }
+
+    UIViewGroup *StressTestingView::CreateStressTestingView(void)
+    {
+        if (group == nullptr)
+        {
+            group = new UIViewGroup();
+            if (group == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestingView::CreateStressTestingView new group fail!!");
+                return nullptr;
+            }
+            group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+            group->SetViewId(STRESSTESTINGVIEW_ID);
+            group->SetTouchable(true);
+            group->SetDraggable(true);
+            group->SetOnDragListener((UIView::OnDragListener *)OHOS::StressTestPresenter::GetInstance());
+        }
+        if (titleLabel == nullptr)
+        {
+            titleLabel = new UILabelExt();
+            if (titleLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestingView::CreateStressTestingView new titleLabel fail!!");
+                return nullptr;
+            }
+            titleLabel->SetPosition(83, 50,300,35);
+            titleLabel->SetText("压力");
+            titleLabel->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            titleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            group->Add(titleLabel);
+        }
+        if (cancelButton == nullptr)
+        {
+            cancelButton = new UILabelButtonExt();
+            if (cancelButton == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StressTestingView::CreateStressTestingView new cancelButton fail!!");
+                return nullptr;
+            }
+            cancelButton->SetPosition(93, 330,280,90);
+            cancelButton->SetText("取消检测");
+            cancelButton->SetAlign(TEXT_ALIGNMENT_CENTER);
+            cancelButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            cancelButton->SetViewId(CANCEL_BUTTON_ID);
+            cancelButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff0d62ff);
+            cancelButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+            cancelButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            cancelButton->SetOnClickListener((UIView::OnClickListener *)OHOS::StressTestPresenter::GetInstance());
+            group->Add(cancelButton);
+        }
+
+        return group;
+    }
+}
\ No newline at end of file