辅助功能视图修改
authorluozheng <1732036298@qq.com>
Tue, 27 Feb 2024 07:36:26 +0000 (15:36 +0800)
committerluozheng <1732036298@qq.com>
Tue, 27 Feb 2024 07:36:26 +0000 (15:36 +0800)
code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/SecondaryFunctionPresenter.h
code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/include/SecondaryFunctionView.h
code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/secondaryfunction/src/SecondaryFunctionView.cpp

index 9e110bf..47e3673 100644 (file)
@@ -7,8 +7,10 @@
 \r
 namespace OHOS\r
 {\r
-    class SecondaryFunctionView;\r
 \r
+    static const char *SECONDARY_FUNCTION_QUICK_ACCESS_BUTTON = "SECONDARY_FUNCTION_QUICK_ACCESS_BUTTON";   // 快速访问\r
+    static const char *SECONDARY_FUNCTION_FAST_TRAINING_BUTTON = "SECONDARY_FUNCTION_FAST_TRAINING_BUTTON"; // 快速训练\r
+    class SecondaryFunctionView;\r
     class SecondaryFunctionPresenter : public Presenter<SecondaryFunctionView>,\r
                                        public UIView::OnClickListener,\r
                                        public UIView::OnDragListener\r
@@ -28,6 +30,7 @@ namespace OHOS
         // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;\r
         bool OnClick(UIView &view, const ClickEvent &event) override;\r
         bool OnDrag(UIView &view, const DragEvent &event) override;\r
+        bool OnDragEnd(UIView &view, const DragEvent &event) override;\r
     };\r
 } // namespace OHOS\r
 #endif
\ No newline at end of file
index 5fe1c76..7fd4473 100644 (file)
@@ -3,20 +3,37 @@
 /*辅助功能*/\r
 #include "BaseView.h"\r
 #include "View.h"\r
-\r
-#include "components/ui_view_group.h"\r
+#include "components/ui_scroll_view.h"\r
 #include "components/ui_label.h"\r
-#include "components/ui_button.h"\r
 #include "components/ui_image_view.h"\r
+#include "components/ui_button.h"\r
+#include "wearable_log.h"\r
 namespace OHOS\r
 {\r
-    static const char * SECONDARY_FUNCTION_BUTTON1ID = "SECONDARY_FUNCTION_BUTTON1";\r
-    static const char * SECONDARY_FUNCTION_BUTTON2ID = "SECONDARY_FUNCTION_BUTTON2";\r
     class SecondaryFunctionPresenter;\r
     class SecondaryFunctionView : public View<SecondaryFunctionPresenter>\r
     {\r
 \r
     public:\r
+        struct ImageConfig\r
+        {\r
+            int16_t x;\r
+            int16_t y;\r
+            int16_t w;\r
+            int16_t h;\r
+            const char *ImageSrc;\r
+        };\r
+        struct LabelConfig\r
+        {\r
+            int16_t left;\r
+            int16_t top;\r
+            int16_t width;\r
+            int16_t height;\r
+            int16_t fontSize;      // 字体大小\r
+            int16_t lineHeigh;     // 行高\r
+            const char *text;      // 文本\r
+            uint8_t lineBreakMode; // 断行模式。\r
+        };\r
         SecondaryFunctionView();\r
         virtual ~SecondaryFunctionView();\r
         static SecondaryFunctionView *GetInstance(void);\r
@@ -27,18 +44,22 @@ namespace OHOS
         void OnStop() override;\r
 \r
     private:\r
-        void InitView(void);\r
-        void DeInitView(void);\r
-\r
-    private:\r
-        UIViewGroup *container_ = nullptr;\r
-        UILabel *label1_ = nullptr;\r
-        UIButton *SECONDARY_FUNCTION_BUTTON1 = nullptr;\r
-        UIImageView *image3_ = nullptr;\r
-        UILabel *label2_ = nullptr;\r
-        UIButton *SECONDARY_FUNCTION_BUTTON2 = nullptr;\r
-        UIImageView *image4_ = nullptr;\r
-        UILabel *label4_ = nullptr;\r
+        void SecondaryFunctionViewInit(void);\r
+        void ClearAll();\r
+        bool SecondaryFunctionScrollViewInit(void);\r
+        bool SecondaryFunctionScrollButtonInit(void);\r
+        bool SecondaryFunctionScrollLabelInit(void);\r
+        bool SecondaryFunctionScrollImageInit(void);\r
+        UIImageView *SetUpImageView(ImageConfig &imageconfig); // 设置图片\r
+        UILabel *SetUpLabel(LabelConfig &labelconfig);         // 设置标签\r
+        UIScrollView *SecondaryFunctionScrollView{nullptr};\r
+        UILabel *SecondaryFunctionScrollTitleLabel{nullptr}; // 标题\r
+        UILabel *QuickAccessLabel{nullptr};                  // 快速访问\r
+        UILabel *FastTrainingLabel{nullptr};                 // 快速训练\r
+        UIButton *QuickAccessButton{nullptr};\r
+        UIButton *FastTrainingButton{nullptr};\r
+        UIImageView *Image[2]{nullptr};\r
+        bool initViewStatus{false};\r
     };\r
 } // namespace OHOS\r
 #endif
\ No newline at end of file
index 5a36922..fe06f7d 100644 (file)
@@ -1,7 +1,6 @@
 \r
 #include "AppViewIDs.h"\r
 #include "NativeAbility.h"\r
-\r
 #include "secondaryfunction/include/SecondaryFunctionPresenter.h"\r
 \r
 namespace OHOS\r
@@ -55,31 +54,30 @@ namespace OHOS
     bool SecondaryFunctionPresenter::OnDrag(UIView &view, const DragEvent &event)\r
     {\r
         UNUSED(view);\r
-        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT &&\r
-            (event.GetDeltaX() > 20) && (event.GetDeltaX() > (2 * MATH_ABS(event.GetDeltaY()))))\r
+        UNUSED(event);\r
+        return false;\r
+    }\r
+\r
+    bool SecondaryFunctionPresenter::OnDragEnd(UIView &view, const DragEvent &event)\r
+    {\r
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT)\r
         {\r
             NativeAbility::GetInstance().ChangeSlice(VIEW_SETTING);\r
-            return true;\r
         }\r
-        return false;\r
+        return true;\r
     }\r
 \r
     bool SecondaryFunctionPresenter::OnClick(UIView &view, const ClickEvent &event)\r
     {\r
-\r
-        // 根据控件id查找是哪个控件触发了点击回调\r
-        if (strcmp(view.GetViewId(), SECONDARY_FUNCTION_BUTTON1ID) == 0)\r
+        UNUSED(event);\r
+        if (strcmp(view.GetViewId(), SECONDARY_FUNCTION_QUICK_ACCESS_BUTTON) == 0)\r
         {\r
-            \r
             NativeAbility::GetInstance().ChangeSlice(VIEW_QUICK_ACCESS);\r
-            return true;\r
         }\r
-        else if (strcmp(view.GetViewId(), SECONDARY_FUNCTION_BUTTON2ID) == 0)\r
+        else if (strcmp(view.GetViewId(), SECONDARY_FUNCTION_FAST_TRAINING_BUTTON) == 0)\r
         {\r
-            \r
             NativeAbility::GetInstance().ChangeSlice(VIEW_FAST_TRAINING);\r
-            return true;\r
         }\r
-        return false;\r
+        return true;\r
     }\r
 }
\ No newline at end of file
index 7912a13..c09f821 100644 (file)
@@ -1,7 +1,6 @@
 #include "secondaryfunction/include/SecondaryFunctionView.h"\r
 #include "secondaryfunction/include/SecondaryFunctionPresenter.h"\r
-\r
-#include "UiConfig.h"\r
+#include "common/image_cache_manager.h"\r
 namespace OHOS\r
 {\r
 \r
@@ -9,213 +8,249 @@ namespace OHOS
 \r
     SecondaryFunctionView::SecondaryFunctionView()\r
     {\r
-\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SecondaryFunctionView::SecondaryFunctionView");\r
         g_pSecondaryFunctionView = this;\r
     }\r
 \r
     SecondaryFunctionView::~SecondaryFunctionView()\r
     {\r
-        DeInitView();\r
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " SecondaryFunctionView::~SecondaryFunctionView");\r
+        ClearAll();\r
         g_pSecondaryFunctionView = nullptr;\r
     }\r
 \r
     SecondaryFunctionView *SecondaryFunctionView::GetInstance()\r
     {\r
-\r
         return g_pSecondaryFunctionView;\r
     }\r
 \r
-    void SecondaryFunctionView::InitView(void)\r
+    void SecondaryFunctionView::ClearAll(void)\r
     {\r
-        if (container_ == nullptr)\r
+        if (initViewStatus == true)\r
         {\r
-            container_ = new UIViewGroup();\r
-            container_->SetPosition(0, 0, 466, 466);\r
-            container_->SetStyle(STYLE_BACKGROUND_OPA, 0);\r
-            UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SecondaryFunctionPresenter::GetInstance());\r
-            if (draglistener == nullptr)\r
+            SecondaryFunctionScrollView->RemoveAll();\r
+\r
+            delete SecondaryFunctionScrollTitleLabel;\r
+            SecondaryFunctionScrollTitleLabel = nullptr;\r
+\r
+            delete QuickAccessLabel;\r
+            QuickAccessLabel = nullptr;\r
+\r
+            delete FastTrainingLabel;\r
+            FastTrainingLabel = nullptr;\r
+\r
+            delete QuickAccessButton;\r
+            QuickAccessButton = nullptr;\r
+\r
+            delete FastTrainingButton;\r
+            FastTrainingButton = nullptr;\r
+\r
+            for (int i = 0; i < 2; i++)\r
             {\r
-                return;\r
+                delete Image[i];\r
+                Image[i] = nullptr;\r
             }\r
-            container_->SetOnDragListener(draglistener);\r
-            container_->SetTouchable(true);\r
-            container_->SetDraggable(true);\r
-        }\r
-        // Add Label to App\r
-        if (label1_ == nullptr)\r
-        {\r
-            label1_ = new UILabel();\r
+\r
+            delete SecondaryFunctionScrollView;\r
+            SecondaryFunctionScrollView = nullptr;\r
         }\r
-        label1_->SetPosition(172, 52);\r
-        label1_->SetStyle(STYLE_TEXT_FONT, 30);\r
-        label1_->SetStyle(STYLE_LINE_HEIGHT, 35);\r
-        label1_->SetText("辅助功能");\r
-        label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
-        label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
-        label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-        container_->Add(label1_);\r
-        label1_->SetVisible(true);\r
-\r
-        // Add Button to App\r
-        if (SECONDARY_FUNCTION_BUTTON1 == nullptr)\r
+    }\r
+\r
+    // 设置图片\r
+    UIImageView *SecondaryFunctionView::SetUpImageView(ImageConfig &imageconfig)\r
+    {\r
+        UIImageView *Image = new UIImageView();\r
+        if (Image == nullptr)\r
         {\r
-            SECONDARY_FUNCTION_BUTTON1 = new UIButton();\r
+            return nullptr;\r
         }\r
-        SECONDARY_FUNCTION_BUTTON1->SetPosition(43, 120);\r
-        SECONDARY_FUNCTION_BUTTON1->Resize(380, 100);\r
-        SECONDARY_FUNCTION_BUTTON1->SetViewId(SECONDARY_FUNCTION_BUTTON1ID);\r
-        SECONDARY_FUNCTION_BUTTON1->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
-        SECONDARY_FUNCTION_BUTTON1->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-        SECONDARY_FUNCTION_BUTTON1->SetStyle(STYLE_BORDER_OPA, 0x00);\r
-        SECONDARY_FUNCTION_BUTTON1->SetStyle(STYLE_BORDER_COLOR, 0xffffffff);\r
-        SECONDARY_FUNCTION_BUTTON1->SetImageSrc(PNG_SETTING_BACKGROUND_IMAGE, nullptr);\r
-        SECONDARY_FUNCTION_BUTTON1->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xfffafafa, UIButton::PRESSED);\r
-        SECONDARY_FUNCTION_BUTTON1->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);\r
-        SECONDARY_FUNCTION_BUTTON1->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-        SECONDARY_FUNCTION_BUTTON1->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(SecondaryFunctionPresenter::GetInstance());\r
-        SECONDARY_FUNCTION_BUTTON1->SetOnClickListener(button1Click);\r
-        // Add to rootView\r
-        container_->Add(SECONDARY_FUNCTION_BUTTON1);\r
-        SECONDARY_FUNCTION_BUTTON1->SetVisible(true);\r
-\r
-        // Add Label to App\r
-        if (label2_ == nullptr)\r
+        Image->SetPosition(imageconfig.x, imageconfig.y, imageconfig.w, imageconfig.h);\r
+        Image->SetSrc(imageconfig.ImageSrc);\r
+        return Image;\r
+    }\r
+\r
+    // 设置标签\r
+    UILabel *SecondaryFunctionView::SetUpLabel(LabelConfig &labelconfig)\r
+    {\r
+        UILabel *label = new UILabel();\r
+        if (label == nullptr)\r
         {\r
-            label2_ = new UILabel();\r
+            return nullptr;\r
         }\r
-        label2_->SetPosition(90, 153);\r
-        label2_->SetStyle(STYLE_TEXT_FONT, 30);\r
-        label2_->SetStyle(STYLE_LINE_HEIGHT, 35);\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, 30);\r
-        // Add to rootView\r
-        container_->Add(label2_);\r
-        label2_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image3_ == nullptr)\r
+        label->SetPosition(labelconfig.left, labelconfig.top, labelconfig.width, labelconfig.height); // 位置大小\r
+        label->SetStyle(STYLE_TEXT_FONT, labelconfig.fontSize);                                       // 字体大小\r
+        label->SetStyle(STYLE_LINE_HEIGHT, labelconfig.lineHeigh);                                    // 字体行高\r
+        label->SetText(labelconfig.text);                                                             // 内容\r
+        label->SetLineBreakMode(labelconfig.lineBreakMode);                                           // 断行模式。\r
+        label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
+        label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelconfig.fontSize);\r
+        return label;\r
+    }\r
+\r
+    bool SecondaryFunctionView::SecondaryFunctionScrollViewInit(void)\r
+    {\r
+        SecondaryFunctionScrollView = new UIScrollView();\r
+        if (SecondaryFunctionScrollView == nullptr)\r
         {\r
-            image3_ = new UIImageView();\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView::SecondaryFunctionScrollView new fail!");\r
+            return false;\r
         }\r
-        image3_->SetPosition(369, 157);\r
-        image3_->SetSrc(PNG_SETTING_NEXT_IMAGE);\r
-        // Add to rootView\r
-        container_->Add(image3_);\r
-        image3_->SetVisible(true);\r
-\r
-        // Add Button to App\r
-        if (SECONDARY_FUNCTION_BUTTON2 == nullptr)\r
+        SecondaryFunctionScrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
+        UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(SecondaryFunctionPresenter::GetInstance());\r
+        if (draglistener == nullptr)\r
         {\r
-            SECONDARY_FUNCTION_BUTTON2 = new UIButton();\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView::draglistener can not be nullptr!");\r
+            return false;\r
         }\r
-        SECONDARY_FUNCTION_BUTTON2->SetPosition(43, 240);\r
-        SECONDARY_FUNCTION_BUTTON2->Resize(380, 100);\r
-        SECONDARY_FUNCTION_BUTTON2->SetViewId(SECONDARY_FUNCTION_BUTTON2ID);\r
-        SECONDARY_FUNCTION_BUTTON2->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);\r
-        SECONDARY_FUNCTION_BUTTON2->SetStyle(STYLE_BACKGROUND_OPA, 0x00);\r
-        SECONDARY_FUNCTION_BUTTON2->SetStyle(STYLE_BORDER_OPA, 0x00);\r
-        SECONDARY_FUNCTION_BUTTON2->SetStyle(STYLE_BORDER_COLOR, 0xffffffff);\r
-        SECONDARY_FUNCTION_BUTTON2->SetImageSrc(PNG_SETTING_BACKGROUND_IMAGE, nullptr);\r
-        SECONDARY_FUNCTION_BUTTON2->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);\r
-        SECONDARY_FUNCTION_BUTTON2->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);\r
-        // Add the CallBack about events\r
-        UIView::OnClickListener *button2Click = static_cast<UIView::OnClickListener *>(SecondaryFunctionPresenter::GetInstance());\r
-        SECONDARY_FUNCTION_BUTTON2->SetOnClickListener(button2Click);\r
-        // Add to rootView\r
-        container_->Add(SECONDARY_FUNCTION_BUTTON2);\r
-        SECONDARY_FUNCTION_BUTTON2->SetVisible(true);\r
-        // Add Label to App\r
-        if (label4_ == nullptr)\r
+        SecondaryFunctionScrollView->SetOnDragListener(draglistener);\r
+        SecondaryFunctionScrollView->SetTouchable(true);\r
+        SecondaryFunctionScrollView->SetDraggable(true);\r
+        return true;\r
+    }\r
+\r
+    bool SecondaryFunctionView::SecondaryFunctionScrollButtonInit(void)\r
+    {\r
+        QuickAccessButton = new UIButton();\r
+        if (QuickAccessButton == nullptr)\r
         {\r
-            label4_ = new UILabel();\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::QuickAccessButton new  fail!");\r
+            return false;\r
         }\r
-        label4_->SetPosition(90, 273);\r
-        label4_->SetStyle(STYLE_TEXT_FONT, 30);\r
-        label4_->SetStyle(STYLE_LINE_HEIGHT, 35);\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, 30);\r
-        // Add to rootView\r
-        container_->Add(label4_);\r
-        label4_->SetVisible(true);\r
-\r
-        // Add ImageView to App\r
-        if (image4_ == nullptr)\r
+        QuickAccessButton->SetPosition(43, 120, 380, 100);\r
+        QuickAccessButton->SetViewId(SECONDARY_FUNCTION_QUICK_ACCESS_BUTTON);\r
+        QuickAccessButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+        QuickAccessButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff4fc34c, UIButton::PRESSED);\r
+        QuickAccessButton->SetStyleForState(STYLE_BORDER_COLOR, 0xffffffff, UIButton::PRESSED);\r
+        QuickAccessButton->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);\r
+\r
+        FastTrainingButton = new UIButton();\r
+        if (FastTrainingButton == nullptr)\r
         {\r
-            image4_ = new UIImageView();\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " ClassicBlueToothView::FastTrainingButton new  fail!");\r
+            return false;\r
         }\r
-        image4_->SetPosition(369, 277);\r
-        image4_->SetSrc(PNG_SETTING_NEXT_IMAGE);\r
-        // Add to rootView\r
-        container_->Add(image4_);\r
-        image4_->SetVisible(true);\r
+        FastTrainingButton->SetPosition(43, 240, 380, 100);\r
+        FastTrainingButton->SetViewId(SECONDARY_FUNCTION_FAST_TRAINING_BUTTON);\r
+        FastTrainingButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);\r
+        FastTrainingButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff4fc34c, UIButton::PRESSED);\r
+        FastTrainingButton->SetStyleForState(STYLE_BORDER_COLOR, 0xffffffff, UIButton::PRESSED);\r
+        FastTrainingButton->SetStyleForState(STYLE_BORDER_OPA, 0x00, UIButton::PRESSED);\r
+\r
+        UIView::OnClickListener *clickListener = static_cast<UIView::OnClickListener *>(SecondaryFunctionPresenter::GetInstance());\r
+        QuickAccessButton->SetOnClickListener(clickListener);\r
+        FastTrainingButton->SetOnClickListener(clickListener);\r
+\r
+        return true;\r
     }\r
-    void SecondaryFunctionView::DeInitView(void)\r
+\r
+    bool SecondaryFunctionView::SecondaryFunctionScrollLabelInit(void)\r
     {\r
-        if (container_ != nullptr)\r
+        // 创建ScreenDurationTitleLabel\r
+        LabelConfig labelconfig = {\r
+            .left = 173,\r
+            .top = 52,\r
+            .width = 120,\r
+            .height = 35,\r
+            .fontSize = 30,\r
+            .lineHeigh = 35,\r
+            .text = "辅助功能",\r
+            .lineBreakMode = UILabel::LINE_BREAK_ADAPT,\r
+        };\r
+\r
+        SecondaryFunctionScrollTitleLabel = SetUpLabel(labelconfig);\r
+        if (nullptr == SecondaryFunctionScrollTitleLabel)\r
         {\r
-            container_->RemoveAll();\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView::SecondaryFunctionScrollTitleLabel is nullptr!");\r
+            return false;\r
         }\r
-        if (label1_ != nullptr)\r
+\r
+        labelconfig.left = 90;\r
+        labelconfig.top = 153;\r
+        labelconfig.text = "快速访问";\r
+        QuickAccessLabel = SetUpLabel(labelconfig);\r
+        if (nullptr == SecondaryFunctionScrollTitleLabel)\r
         {\r
-            delete label1_;\r
-            label1_ = nullptr;\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView::QuickAccessLabel is nullptr!");\r
+            return false;\r
         }\r
-        if (SECONDARY_FUNCTION_BUTTON1 != nullptr)\r
+\r
+        labelconfig.top = 273;\r
+        labelconfig.text = "快速训练";\r
+        FastTrainingLabel = SetUpLabel(labelconfig);\r
+        if (nullptr == SecondaryFunctionScrollTitleLabel)\r
         {\r
-            delete SECONDARY_FUNCTION_BUTTON1;\r
-            SECONDARY_FUNCTION_BUTTON1 = nullptr;\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView::FastTrainingLabel is nullptr!");\r
+            return false;\r
         }\r
-        if (image3_ != nullptr)\r
+\r
+        return true;\r
+    }\r
+\r
+    bool SecondaryFunctionView::SecondaryFunctionScrollImageInit(void)\r
+    {\r
+        ImageConfig imageconfig = {\r
+            .x = 369,\r
+            .y = 157,\r
+            .w = 14,\r
+            .h = 26,\r
+            .ImageSrc = "/user/res/SETTING_NEXT.bin",\r
+        };\r
+\r
+        for (int i = 0; i < 2; i++)\r
         {\r
-            delete image3_;\r
-            image3_ = nullptr;\r
+            imageconfig.y = 157 + (i * 120);\r
+            Image[i] = SetUpImageView(imageconfig);\r
+            if (Image[i] == nullptr)\r
+            {\r
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SecondaryFunctionView::Image[%d] is nullptr!", i);\r
+                return false;\r
+            }\r
         }\r
-        if (label2_ != nullptr)\r
+        return true;\r
+    }\r
+\r
+    // 辅助功能视图初始化\r
+    void SecondaryFunctionView::SecondaryFunctionViewInit(void)\r
+    {\r
+        if (!SecondaryFunctionScrollViewInit())\r
         {\r
-            delete label2_;\r
-            label2_ = nullptr;\r
+            return;\r
         }\r
-        if (SECONDARY_FUNCTION_BUTTON2 != nullptr)\r
+\r
+        if (!SecondaryFunctionScrollLabelInit())\r
         {\r
-            delete SECONDARY_FUNCTION_BUTTON2;\r
-            SECONDARY_FUNCTION_BUTTON2 = nullptr;\r
+            return;\r
         }\r
-        if (image4_ != nullptr)\r
+\r
+        if (!SecondaryFunctionScrollButtonInit())\r
         {\r
-            delete image4_;\r
-            image4_ = nullptr;\r
+            return;\r
         }\r
-        if (label4_ != nullptr)\r
+\r
+        if (!SecondaryFunctionScrollImageInit())\r
         {\r
-            delete label4_;\r
-            label4_ = nullptr;\r
+            return;\r
         }\r
-        delete container_;\r
-        container_ = nullptr;\r
+        initViewStatus = true;\r
     }\r
 \r
     void SecondaryFunctionView::OnStart()\r
     {\r
         View<SecondaryFunctionPresenter>::OnStart();\r
-        InitView();\r
-        RootView::GetInstance()->Add(container_);\r
+        SecondaryFunctionViewInit();\r
     }\r
 \r
     void SecondaryFunctionView::OnSetUpView()\r
     {\r
-\r
         View<SecondaryFunctionPresenter>::OnSetUpView();\r
+        SecondaryFunctionScrollView->Add(SecondaryFunctionScrollTitleLabel);\r
+        SecondaryFunctionScrollView->Add(QuickAccessButton);\r
+        SecondaryFunctionScrollView->Add(FastTrainingButton);\r
+        SecondaryFunctionScrollView->Add(QuickAccessLabel);\r
+        SecondaryFunctionScrollView->Add(FastTrainingLabel);\r
+        SecondaryFunctionScrollView->Add(Image[0]);\r
+        SecondaryFunctionScrollView->Add(Image[1]);\r
+        RootView::GetInstance()->Add(SecondaryFunctionScrollView);\r
         Draw();\r
     }\r
 \r