滑动关机和重启添加恢复出厂设置功能
authorluozheng <1732036298@qq.com>
Sat, 20 Jul 2024 07:48:08 +0000 (15:48 +0800)
committerluozheng <1732036298@qq.com>
Sat, 20 Jul 2024 07:48:08 +0000 (15:48 +0800)
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownView.h
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp
code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp
code/sdk/application/wearable/fd230app/nativeui/system/src/SystemFactoryResetView.cpp
code/sdk/application/wearable/fd230app/nativeui/system/src/SystemView.cpp

index 2f75e85..d7829cc 100644 (file)
@@ -406,6 +406,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rebootandshutdown/src/RebootAndShutdownPresenter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rebootandshutdown/src/ShutDownImageAnimatorView.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/rebootandshutdown/src/FactoryResetView.cpp
 
     #声音与震动
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/soundandvibration/src/SoundAndVibrationPresenter.cpp 
diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetView.h
new file mode 100644 (file)
index 0000000..d6199e5
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-07-20 14:12:16
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-07-20 14:54:48
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/FactoryResetVIew.h
+ * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ */
+
+#ifndef FACTORY_RESET_VIEW_H
+#define FACTORY_RESET_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+
+#include "components/ui_image_view.h"
+#include "components/ui_button.h"
+#include "components/ui_view_group.h"
+#include "components/ui_label_ext.h"
+namespace OHOS
+{
+    static constexpr const char *FACTORY_RESET_GROUPVIEW = "FactoryResetGroupView";
+    static constexpr const char *FACTORY_RESET_BUTTON_CHECK_ON = "FactoryResetButtonCheckOn";   /*确认恢复出厂设置*/
+    static constexpr const char *FACTORY_RESET_BUTTON_CHECK_OFF = "FactoryResetButtonCheckOff"; /*取消*/
+    class FactoryResetView
+    {
+
+    public:
+        FactoryResetView();
+        virtual ~FactoryResetView();
+        static FactoryResetView *GetInstance(void);
+
+        UIViewGroup *FactoryResetViewInit(void);
+        void ClearAll(void);
+
+    private:
+        UIViewGroup *group{nullptr};
+        UILabelExt *Title{nullptr};
+        UIImageView *FactoryResetImage{nullptr};
+        UILabelExt *FactoryResetNote{nullptr};
+        UIButton *FactoryResetButtonCheckOn{nullptr};  // 重置确认
+        UIButton *FactoryResetButtonCheckOff{nullptr}; // 重置否定
+        bool initViewStatus{false};
+    };
+} // namespace OHOS
+#endif
\ No newline at end of file
index d9fa2e3..548ea4e 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-07-18 14:25:53
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-20 11:36:13
+ * @LastEditTime: 2024-07-20 14:56:42
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/RebootAndShutdownView.h
  */
 #ifndef REBOOT_AND_SHUTDOWN_VIEW_H
 #include "components/ui_slider.h"
 #include "components/ui_view_group.h"
 #include "rebootandshutdown/include/ShutDownImageAnimatorView.h"
-
+#include "rebootandshutdown/include/FactoryResetView.h"
 namespace OHOS
 {
     typedef enum : uint8_t
     {
         REBOOTANDSHUTDOWN = 0,
         SHUTDOWNANIMATOR, /*关机动画view*/
-        // FACTORYRESET,     /*恢复出厂设置view*/
+        FACTORYRESET,     /*恢复出厂设置view*/
         REBOOTANDSHUTDOWN_MAX,
     } REBOOTANDSHUTDOWNVIEWID;
 
     static constexpr const char *SHUTDOWN_SLIDER_VIEWID = "shutdown_slider_viewid";
     static constexpr const char *REBOOT_SLIDER_VIEWID = "reboot_slider_viewid";
+    static constexpr const char *FACTORYRESET_LABEL_VIEWID = "factoryreset_label_viewid";
+    static constexpr const char *REBOOT_AND_SHUTDOWN_GROUPVIEW = "reboot_and_shutdown_groupview";
 
     class RebootAndShutdownPresenter;
     class RebootAndShutdownView : public View<RebootAndShutdownPresenter>
@@ -42,6 +44,7 @@ namespace OHOS
 
         bool ChangeToRebootAndShutdownView(int16_t thisView);
         bool ChangeToShutDownAnimatorView(int16_t thisView);
+        bool ChangeToFactoryResetView(int16_t thisView);
         void ChangeView(int16_t hideView, int16_t showView);
 
         void OnStart() override;
@@ -66,6 +69,7 @@ namespace OHOS
         bool ClickFunc(int16_t interface);
 
         ShutDownImageAnimatorView *shutDownImageAnimatorView{nullptr};
+        FactoryResetView *factoryResetView{nullptr};
 
     private:
         UILabelExt *RebootAndShutdownLabelInit(LabelConfig &labelconfig);
index 42d9e15..a779a77 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-07-20 11:05:46
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-20 11:34:35
+ * @LastEditTime: 2024-07-20 15:11:40
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/include/ShutDownImageAnimatorView.h
  */
 
@@ -20,7 +20,7 @@ namespace OHOS
     static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_H = 466;
     static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 30;          // 图片帧数
     static constexpr int16_t SHUTDOWN_IMAGE_ANIMATOR_TIME = 150;                    // 图片更新间隔
-    static constexpr char *ShutDownPaths = "/user/res/RebootAndShutDown/ShutDown/"; // 关机图片路径
+    static constexpr const char *ShutDownPaths = "/user/res/RebootAndShutDown/ShutDown/"; // 关机图片路径
 
     class ShutDownImageAnimatorView
     {
diff --git a/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp b/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/FactoryResetView.cpp
new file mode 100644 (file)
index 0000000..b09d102
--- /dev/null
@@ -0,0 +1,187 @@
+#include "rebootandshutdown/include/FactoryResetView.h"
+#include "rebootandshutdown/include/RebootAndShutdownPresenter.h"
+#include "wearable_log.h"
+#include "UiConfig.h"
+#include "ui_resource_string.h"
+
+namespace OHOS
+{
+
+    static FactoryResetView *g_pFactoryResetView{nullptr};
+
+    FactoryResetView::FactoryResetView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::FactoryResetView");
+        g_pFactoryResetView = this;
+    }
+
+    FactoryResetView::~FactoryResetView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::~FactoryResetView");
+        ClearAll();
+        g_pFactoryResetView = nullptr;
+    }
+
+    FactoryResetView *FactoryResetView::GetInstance()
+    {
+        return g_pFactoryResetView;
+    }
+
+    void FactoryResetView::ClearAll()
+    {
+        if (initViewStatus == true)
+        {
+            group->RemoveAll();
+
+            if (Title != nullptr)
+            {
+                delete Title;
+                Title = nullptr;
+            }
+
+            if (FactoryResetImage != nullptr)
+            {
+                delete FactoryResetImage;
+                FactoryResetImage = nullptr;
+            }
+
+            if (FactoryResetNote != nullptr)
+            {
+                delete FactoryResetNote;
+                FactoryResetNote = nullptr;
+            }
+
+            if (FactoryResetButtonCheckOn != nullptr)
+            {
+                delete FactoryResetButtonCheckOn;
+                FactoryResetButtonCheckOn = nullptr;
+            }
+            if (FactoryResetButtonCheckOff != nullptr)
+            {
+                delete FactoryResetButtonCheckOff;
+                FactoryResetButtonCheckOff = nullptr;
+            }
+
+            delete group;
+            group = nullptr;
+        }
+    }
+
+    UIViewGroup *FactoryResetView::FactoryResetViewInit(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FactoryResetView::FactoryResetViewInit");
+        if (group == nullptr)
+        {
+            group = new UIViewGroup();
+            if (group == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new group fail!");
+                return nullptr;
+            }
+            group->SetViewId(FACTORY_RESET_GROUPVIEW);
+            group->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+            group->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            group->SetStyle(STYLE_BORDER_RADIUS, 100);
+            group->SetTouchable(true);
+            group->SetDraggable(true);
+            UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(RebootAndShutdownPresenter::GetInstance());
+            if (dragListener == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownPresenter::GetInstance fail!!");
+                return nullptr;
+            }
+            group->SetOnDragListener(dragListener);
+            /* ---------------------------------- Title --------------------------------- */
+            Title = new UILabelExt();
+            if (Title == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new Title fail!");
+                return nullptr;
+            }
+            Title->SetPosition(83, 50, 300, 35);
+            Title->SetStyle(STYLE_TEXT_FONT, 30);
+            Title->SetStyle(STYLE_LINE_HEIGHT, 35);
+            Title->SetTextId(STR_FACTORY_RESET); /*恢复出厂*/
+            Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            Title->SetRollSpeed(70);
+            Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            /* ---------------------------- FactoryResetImage --------------------------- */
+            FactoryResetImage = new UIImageView();
+            if (FactoryResetImage == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new FactoryResetImage fail!");
+                return nullptr;
+            }
+            FactoryResetImage->SetPosition(193, 120);
+            FactoryResetImage->SetSrc(PNG_ATTENTION_IMAGE);
+            /* ---------------------------- FactoryResetNote ---------------------------- */
+            FactoryResetNote = new UILabelExt();
+            if (FactoryResetNote == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new FactoryResetNote fail!");
+                return nullptr;
+            }
+            FactoryResetNote->SetPosition(53, 228, 360, 70);
+            FactoryResetNote->SetStyle(STYLE_TEXT_FONT, 30);
+            FactoryResetNote->SetStyle(STYLE_LINE_HEIGHT, 35);
+            FactoryResetNote->SetTextId(STR_RESET_CONFIRM_NOTE); /*该操作会清空并重置手表数据,是否确认继续?*/
+            FactoryResetNote->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+            FactoryResetNote->SetTextColor(Color::GetColorFromRGBA(0xff, 0x8a, 0x36, 0xff));
+            FactoryResetNote->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            FactoryResetNote->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            /* ----------------------- FactoryResetButtonCheckOff ----------------------- */
+            FactoryResetButtonCheckOff = new UIButton();
+            if (FactoryResetButtonCheckOff == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new FactoryResetButtonCheckOff fail!");
+                return nullptr;
+            }
+            FactoryResetButtonCheckOff->SetPosition(97, 320, 130, 130);
+            FactoryResetButtonCheckOff->SetViewId(FACTORY_RESET_BUTTON_CHECK_OFF);
+            FactoryResetButtonCheckOff->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+            FactoryResetButtonCheckOff->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+            FactoryResetButtonCheckOff->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+            FactoryResetButtonCheckOff->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            FactoryResetButtonCheckOff->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, PNG_SYSTEM_CHECK_OFF_IMAGE);
+            UIView::OnClickListener *FactoryResetButtonCheckOffClick = static_cast<UIView::OnClickListener *>(RebootAndShutdownPresenter::GetInstance());
+            if (FactoryResetButtonCheckOffClick == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::RebootAndShutdownPresenter::GetInstance fail!!");
+                return nullptr;
+            }
+            FactoryResetButtonCheckOff->SetOnClickListener(FactoryResetButtonCheckOffClick);
+            /* ------------------------ FactoryResetButtonCheckOn ----------------------- */
+            FactoryResetButtonCheckOn = new UIButton();
+            if (FactoryResetButtonCheckOn == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::new FactoryResetButtonCheckOn fail!");
+                return nullptr;
+            }
+            FactoryResetButtonCheckOn->SetPosition(240, 320, 130, 130);
+            FactoryResetButtonCheckOn->SetViewId(FACTORY_RESET_BUTTON_CHECK_ON);
+            FactoryResetButtonCheckOn->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+            FactoryResetButtonCheckOn->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+            FactoryResetButtonCheckOn->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
+            FactoryResetButtonCheckOn->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            FactoryResetButtonCheckOn->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, PNG_SYSTEM_CHECK_ON_IMAGE);
+            UIView::OnClickListener *FactoryResetButtonCheckOnClick = static_cast<UIView::OnClickListener *>(RebootAndShutdownPresenter::GetInstance());
+            if (FactoryResetButtonCheckOnClick == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FactoryResetView::RebootAndShutdownPresenter::GetInstance fail!!");
+                return nullptr;
+            }
+            FactoryResetButtonCheckOn->SetOnClickListener(FactoryResetButtonCheckOnClick);
+
+            /* ----------------------------- Add to scroView ---------------------------- */
+            group->Add(Title);
+            group->Add(FactoryResetImage);
+            group->Add(FactoryResetNote);
+            group->Add(FactoryResetButtonCheckOff);
+            group->Add(FactoryResetButtonCheckOn);
+
+            initViewStatus = true;
+        }
+        return group;
+    }
+}
\ No newline at end of file
index aea338b..a1f1075 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-06-20 15:11:17
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-20 11:38:27
+ * @LastEditTime: 2024-07-20 14:56:16
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/RebootAndShutdownPresenter.cpp
  */
 #include "AppViewIDs.h"
@@ -74,6 +74,20 @@ namespace OHOS
     {
         UNUSED(event);
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownPresenter::OnClick");
+        if (strcmp(view.GetViewId(), FACTORYRESET_LABEL_VIEWID) == 0) // 进入出厂设置界面
+        {
+            RebootAndShutdownView::GetInstance()->ChangeView(REBOOTANDSHUTDOWN, FACTORYRESET);
+            return true;
+        }
+        else if (strcmp(view.GetViewId(), FACTORY_RESET_BUTTON_CHECK_ON) == 0) // 恢复出厂设置确认
+        {
+            do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_RESTORE_FACTORY_SETTING, NULL, 0);
+            return true;
+        }
+        else if (strcmp(view.GetViewId(), FACTORY_RESET_BUTTON_CHECK_OFF) == 0) // 恢复出厂设置取消
+        {
+            RebootAndShutdownView::GetInstance()->ChangeView(FACTORYRESET, REBOOTANDSHUTDOWN);
+        }
         return true;
     }
 
@@ -103,7 +117,14 @@ namespace OHOS
         {
             if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && RebootAndShutdownPresenter::X_DRAG_FLAG)
             {
-                NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+                if (strcmp(view.GetViewId(), REBOOT_AND_SHUTDOWN_GROUPVIEW) == 0)
+                {
+                    NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+                }
+                else if (strcmp(view.GetViewId(), FACTORY_RESET_GROUPVIEW) == 0)
+                {
+                    RebootAndShutdownView::GetInstance()->ChangeView(FACTORYRESET, REBOOTANDSHUTDOWN);
+                }
                 RebootAndShutdownPresenter::X_DRAG_FLAG = false;
                 return true;
             }
index f9d3028..19caa95 100644 (file)
@@ -2,7 +2,7 @@
  * @Author: luozheng 1732036298@qq.com
  * @Date: 2024-07-18 14:26:08
  * @LastEditors: luozheng 1732036298@qq.com
- * @LastEditTime: 2024-07-20 11:36:31
+ * @LastEditTime: 2024-07-20 15:09:36
  * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/rebootandshutdown/src/RebootAndShutdownView.cpp
  */
 
@@ -117,6 +117,12 @@ namespace OHOS
                 delete shutDownImageAnimatorView;
                 shutDownImageAnimatorView = nullptr;
             }
+
+            if (factoryResetView != nullptr)
+            {
+                delete factoryResetView;
+                factoryResetView = nullptr;
+            }
         }
     }
 
@@ -201,9 +207,11 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "factoryResetLabel new fail!");
             return false;
         }
+        factoryResetLabel->SetViewId(FACTORYRESET_LABEL_VIEWID);
         factoryResetLabel->SetTouchable(true);
         factoryResetLabel->SetTextColor(Color::GetColorFromRGBA(0x35, 0x49, 0xff, 0xff));
         factoryResetLabel->SetStyle(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_TOP);
+        factoryResetLabel->SetOnClickListener(presenter_);
 
         return true;
     }
@@ -259,33 +267,11 @@ namespace OHOS
             rebootSlider->SetValue(12);
             rebootSlider->SetCapType(CapType::CAP_ROUND);
         }
+        shutdownSlider->SetOnDragListener(presenter_);
+        shutdownSlider->SetSliderEventListener(presenter_);
 
-        UIView::OnClickListener *sliderClickListener = static_cast<UIView::OnClickListener *>(RebootAndShutdownPresenter::GetInstance());
-        if (sliderClickListener == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sliderClickListener is nullptr!!");
-            return false;
-        }
-        shutdownSlider->SetOnClickListener(sliderClickListener);
-        rebootSlider->SetOnClickListener(sliderClickListener);
-
-        UIView::OnDragListener *sliderDragListener = static_cast<UIView::OnDragListener *>(RebootAndShutdownPresenter::GetInstance());
-        if (sliderDragListener == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sliderDragListener is nullptr!!");
-            return false;
-        }
-        shutdownSlider->SetOnDragListener(sliderDragListener);
-        rebootSlider->SetOnDragListener(sliderDragListener);
-
-        UISlider::UISliderEventListener *sliderEventListener = static_cast<UISlider::UISliderEventListener *>(RebootAndShutdownPresenter::GetInstance());
-        if (sliderEventListener == nullptr)
-        {
-            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "sliderEventListener is nullptr!!");
-            return false;
-        }
-        shutdownSlider->SetSliderEventListener(sliderEventListener);
-        rebootSlider->SetSliderEventListener(sliderEventListener);
+        rebootSlider->SetOnDragListener(presenter_);
+        rebootSlider->SetSliderEventListener(presenter_);
 
         return true;
     }
@@ -342,7 +328,11 @@ namespace OHOS
                 return false;
             }
             rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->SetPosition(0, 0, 466, 466);
+            rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->SetViewId(REBOOT_AND_SHUTDOWN_GROUPVIEW);
             rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->SetStyle(STYLE_BACKGROUND_OPA, 0);
+            rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->SetTouchable(true);
+            rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->SetDraggable(true);
+            rebootAndShutdownGroupView[REBOOTANDSHUTDOWN]->SetOnDragListener(presenter_);
         }
 
         return true;
@@ -381,7 +371,6 @@ namespace OHOS
             return;
         }
         container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
-        container_->SetOnDragListener(presenter_);
         container_->SetTouchable(true);
         container_->SetDraggable(true);
 
@@ -432,7 +421,7 @@ namespace OHOS
     {
         if (rebootAndShutdownGroupView[thisView] == nullptr)
         {
-            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ChangeShutdownDeviceView");
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownView::ChangeToShutDownAnimatorView");
             shutDownImageAnimatorView = new ShutDownImageAnimatorView();
             if (shutDownImageAnimatorView == nullptr)
             {
@@ -451,6 +440,30 @@ namespace OHOS
         return true;
     }
 
+    bool RebootAndShutdownView::ChangeToFactoryResetView(int16_t thisView)
+    {
+        if (rebootAndShutdownGroupView[thisView] == nullptr)
+        {
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootAndShutdownView::ChangeToFactoryResetView");
+            factoryResetView = new FactoryResetView();
+            if (factoryResetView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "factoryResetView new fail");
+                return false;
+            }
+            UIViewGroup *group = factoryResetView->FactoryResetViewInit();
+            if (group == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group nullptr fail");
+                return false;
+            }
+            rebootAndShutdownGroupView[thisView] = group;
+            container_->Add(rebootAndShutdownGroupView[thisView]);
+        }
+
+        return true;
+    }
+
     struct RebootAndShutdownViewMapper
     {
         const int16_t viewId;
@@ -459,7 +472,7 @@ namespace OHOS
 
     static const RebootAndShutdownViewMapper ViewMapper[] = {
         {REBOOTANDSHUTDOWN, &RebootAndShutdownView::ChangeToRebootAndShutdownView},
-        // {FACTORYRESET, &RebootAndShutdownView::ChangeTimeConfigCountdown},
+        {FACTORYRESET, &RebootAndShutdownView::ChangeToFactoryResetView},
         {SHUTDOWNANIMATOR, &RebootAndShutdownView::ChangeToShutDownAnimatorView},
     };
 
index 8c077a8..f993faf 100644 (file)
@@ -66,7 +66,7 @@ namespace OHOS
 
     bool ShutDownImageAnimatorView::ShowUpShutDownAnimatorView()
     {
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ShutDownImageAnimatorView::ShowUpShutDownAnimatorView");
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ShutDownImageAnimatorView::ShowUpShutDownAnimatorView");
         ShutDownPathsArray = CreateImagePathsArray(ShutDownPaths, "bin", SHUTDOWN_IMAGE_ANIMATOR_VIEW_NUM_FRAMES);
 
         if (shutDownImageAnimatorView == nullptr)
index c9ae126..2491335 100644 (file)
@@ -32,22 +32,22 @@ namespace OHOS
         if (initViewStatus == true)\r
         {\r
             scrollView->RemoveAll();\r
-            \r
+\r
             delete Title;\r
-            Title =nullptr;\r
+            Title = nullptr;\r
 \r
             delete FactoryResetImage;\r
             FactoryResetImage = nullptr;\r
 \r
             delete FactoryResetNote;\r
             FactoryResetNote = nullptr;\r
-            \r
+\r
             delete FactoryResetButtonCheckOn;\r
             FactoryResetButtonCheckOn = nullptr;\r
-            \r
+\r
             delete FactoryResetButtonCheckOff;\r
             FactoryResetButtonCheckOff = nullptr;\r
-            \r
+\r
             delete scrollView;\r
             scrollView = nullptr;\r
         }\r
@@ -63,7 +63,14 @@ namespace OHOS
         }\r
         scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());\r
         scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);\r
-        scrollView->SetStyle(STYLE_BORDER_RADIUS, 1294);\r
+        scrollView->SetStyle(STYLE_BORDER_RADIUS, 100);\r
+        UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(SystemPresenter::GetInstance());\r
+        if (dragListener == nullptr)\r
+        {\r
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemPresenter::GetInstance fail!!");\r
+            return nullptr;\r
+        }\r
+        scrollView->SetOnDragListener(dragListener);\r
         /* ---------------------------------- Title --------------------------------- */\r
         Title = new UILabelExt();\r
         if (Title == nullptr)\r
@@ -95,10 +102,10 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SystemFactoryResetView::new FactoryResetNote fail!");\r
             return nullptr;\r
         }\r
-        FactoryResetNote->SetPosition(53, 228,360,70); \r
+        FactoryResetNote->SetPosition(53, 228, 360, 70);\r
         FactoryResetNote->SetStyle(STYLE_TEXT_FONT, 30);\r
         FactoryResetNote->SetStyle(STYLE_LINE_HEIGHT, 35);\r
-        //FactoryResetNote->SetText("该操作会清空并重置手表数据,是否确认继续?");\r
+        // FactoryResetNote->SetText("该操作会清空并重置手表数据,是否确认继续?");\r
         FactoryResetNote->SetTextId(STR_RESET_CONFIRM_NOTE);\r
         FactoryResetNote->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);\r
         FactoryResetNote->SetTextColor(Color::GetColorFromRGBA(0xff, 0x8a, 0x36, 0xff));\r
index 81235e0..6bdf287 100644 (file)
@@ -181,7 +181,8 @@ namespace OHOS
         Title->SetStyle(STYLE_LINE_HEIGHT, 35);\r
         // Title->SetText("系统");\r
         Title->SetTextId(STR_SYSTEM);\r
-        Title->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);\r
+        Title->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);\r
+        Title->SetRollSpeed(70);\r
         Title->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
         // Title->SetRollSpeed(6);\r
         Title->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r