勿扰模式slice添加
authorluozheng <1732036298@qq.com>
Thu, 27 Mar 2025 03:58:51 +0000 (11:58 +0800)
committerluozheng <1732036298@qq.com>
Thu, 27 Mar 2025 03:58:51 +0000 (11:58 +0800)
code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/include/DnotDisturbModel.h [new file with mode: 0644]
code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/include/DnotDisturbPresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/include/DnotDisturbView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbModel.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbView.cpp [new file with mode: 0644]

diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/include/DnotDisturbModel.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/include/DnotDisturbModel.h
new file mode 100644 (file)
index 0000000..ca8aead
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-04-10 16:38:44
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-10 10:23:18
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbModel.h
+ */
+#ifndef DNOTDISTURB_MODEL_H
+#define DNOTDISTURB_MODEL_H
+
+namespace OHOS
+{
+    class DnotDisturbModel
+    {
+    public:
+        static DnotDisturbModel &GetInstance(void);
+        void SetDoNotDisturbModeEnabled(bool enabled);
+        bool GetDoNotDisturbModeEnabled() const;
+        void UpdateDoNotDisturbMode(void);
+
+    private:
+        DnotDisturbModel();
+        DnotDisturbModel(const DnotDisturbModel &) = delete;
+        DnotDisturbModel &operator=(const DnotDisturbModel &) = delete;
+        virtual ~DnotDisturbModel();
+
+        //bool isDoNotDisturbModeEnabled = false; // 默认勿扰模式未开启
+    };
+}
+
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/include/DnotDisturbPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/include/DnotDisturbPresenter.h
new file mode 100644 (file)
index 0000000..ca7b7bf
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-04-10 11:58:32
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-06-07 18:54:26
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbPresenter.h
+ */
+
+#ifndef DNOTDISTURB_PRESENTER_H
+#define DNOTDISTURB_PRESENTER_H
+
+#include "Presenter.h"
+#include "View.h"
+
+namespace OHOS
+{
+    class DnotDisturbView;
+    class DnotDisturbPresenter : public Presenter<DnotDisturbView>,
+                                 public UIView::OnClickListener,
+                                 public RootView::OnKeyActListener,
+                                 public ModelListenerSample,
+                                 public UIView::OnDragListener
+    {
+    public:
+        DnotDisturbPresenter();
+        virtual ~DnotDisturbPresenter();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+
+        static DnotDisturbPresenter *GetInstance();
+        virtual void Notify() override;
+
+    private:
+        bool OnClick(UIView &view, const ClickEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+        bool OnDragEnd(UIView &view, const DragEvent &event) override;
+        bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件
+        bool X_DRAG_FLAG{false};
+    };
+}
+
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/include/DnotDisturbView.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/include/DnotDisturbView.h
new file mode 100644 (file)
index 0000000..e8136db
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-04-10 11:58:15
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2025-02-24 18:07:42
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/include/DnotDisturbView.h
+ */
+#ifndef DNOTDISTURB_VIEW_H
+#define DNOTDISTURB_VIEW_H
+
+
+#include "View.h"
+
+#include "components/ui_scroll_view.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label_button_ext.h"
+#include "ModelListenerSample.h"
+#include "iostream"
+namespace OHOS
+{
+    class DnotDisturbPresenter;
+    class DnotDisturbView : public View<DnotDisturbPresenter>
+    {
+
+    public:
+        DnotDisturbView();
+        virtual ~DnotDisturbView();
+        static DnotDisturbView *GetInstance(void);
+        UILabelButtonExt *GetButtonOn(void);
+        UILabelButtonExt *GetButtonOff(void);
+        void UpdataTime();
+        
+        void OnStart() override;
+
+    private:
+        void DnotDisturbViewInit(void);
+        void ClearAll(void);
+        UIScrollView *scrollView = nullptr;
+        UILabelExt *showTitleLabel{nullptr}; 
+        UIImageView *DnotDisturbImage{nullptr};
+        UILabelExt *AttentionLabel{nullptr};
+        UILabelButtonExt *ButtonOn;
+        UILabelButtonExt *ButtonOff;
+        UIImageView *temp{nullptr};
+    };
+}
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbModel.cpp
new file mode 100644 (file)
index 0000000..d8728a0
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-20 19:16:00
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-23 15:12:45
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbModel.cpp
+ */
+#include "dnotdisturb/include/DnotDisturbModel.h"
+#include "main/include/MainViewSample.h"
+#include "MainModel.h"
+#include "ConfigModel.h"
+#include "custom_runtime.h"
+#include "main/include/dropdown/DropDownCardPage1.h"
+
+namespace OHOS
+{
+
+    DnotDisturbModel::DnotDisturbModel() {}
+
+    DnotDisturbModel::~DnotDisturbModel() {}
+
+    DnotDisturbModel &DnotDisturbModel::GetInstance()
+    {
+        static DnotDisturbModel instance;
+        return instance;
+    }
+
+    void DnotDisturbModel::SetDoNotDisturbModeEnabled(bool enabled)
+    {
+        ConfigModel::GetInstance()->SetDnotdisturb(enabled);
+        #ifdef FD230_650
+        /*更新主界面配置*/
+        MainModel::GetInstance().setDialState(DialState::DO_NOT_DISTURB, enabled);
+        #endif
+    }
+
+    bool DnotDisturbModel::GetDoNotDisturbModeEnabled() const
+    {
+        // if(uapi_sleep_mode_flag_get())
+        // {
+        //     return true;
+        // }
+
+        return ConfigModel::GetInstance()->GetDnotdisturb();
+    }
+
+    /*更新勿扰模式*/
+    void DnotDisturbModel::UpdateDoNotDisturbMode(void)
+    {
+        if (PullUpDownView::GetInstance() != nullptr)
+        {
+            /*更新主界面下拉界面配置*/
+            if(DropDownCardPage1::GetInstance() && DropDownCardPage1::GetInstance()->GetDropDownCardPage1_ToggleButton(DropDownCardPage1::toggleButton_DNOTDISTURB))
+            {
+                // DropDownCardPage1::GetInstance()->GetDropDownCardPage1_ToggleButton(DropDownCardPage1::toggleButton_DNOTDISTURB)->SetState(GetDoNotDisturbModeEnabled());
+                DropDownCardPage1::GetInstance()->UpdateDnotdisturbState(GetDoNotDisturbModeEnabled());
+            }
+            PullUpDownView::GetInstance()->UpdateDnotDisturbStatus(GetDoNotDisturbModeEnabled());
+            #ifdef FD230_650
+            /*更新主界面配置*/
+            MainModel::GetInstance().setDialState(DialState::DO_NOT_DISTURB, GetDoNotDisturbModeEnabled());
+            #endif
+        }
+        return;
+    }
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp
new file mode 100644 (file)
index 0000000..d2babee
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-04-10 11:58:37
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-10 11:01:46
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbPresenter.cpp
+ */
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+#include "UiConfig.h"
+#include "dnotdisturb/include/DnotDisturbView.h"
+#include "dnotdisturb/include/DnotDisturbPresenter.h"
+#include "dnotdisturb/include/DnotDisturbModel.h"
+#include "common/key_code.h"
+#include <custom_utils.h>
+#include "NativeRegisterManager.h"
+namespace OHOS
+{
+    REGIST_SLICE(VIEW_DNOTDISTURB, DnotDisturbView, DnotDisturbPresenter);
+
+    // 当前Presenter属性实例化的内存指针
+    static DnotDisturbPresenter *g_pDnotDisturbPresenter = nullptr;
+
+    DnotDisturbPresenter::DnotDisturbPresenter()
+    {
+        g_pDnotDisturbPresenter = this;
+    }
+
+    DnotDisturbPresenter::~DnotDisturbPresenter()
+    {
+        g_pDnotDisturbPresenter = nullptr;
+    }
+
+    DnotDisturbPresenter *DnotDisturbPresenter::GetInstance()
+    {
+        return g_pDnotDisturbPresenter;
+    }
+
+    void DnotDisturbPresenter::OnStart()
+    {
+    }
+
+    void DnotDisturbPresenter::OnPause(void)
+    {
+        Presenter<DnotDisturbView>::OnPause();
+    }
+
+    void DnotDisturbPresenter::OnResume(void)
+    {
+        Presenter<DnotDisturbView>::OnResume();
+    }
+
+    void DnotDisturbPresenter::OnStop(void)
+    {
+    }
+
+    bool DnotDisturbPresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnDrag");
+        UNUSED(view);
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+        {
+            DnotDisturbPresenter::X_DRAG_FLAG = true;
+        }
+        return true;
+    }
+
+    bool DnotDisturbPresenter::OnDragEnd(UIView &view, const DragEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnDragEnd");
+        UNUSED(event);
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && DnotDisturbPresenter::X_DRAG_FLAG)
+        {
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+            DnotDisturbPresenter::X_DRAG_FLAG = false;
+        }
+        return true;
+    }
+
+    bool DnotDisturbPresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+        UNUSED(event);
+        DnotDisturbView *p_DnotDisturbView = DnotDisturbView::GetInstance();
+        if (p_DnotDisturbView == nullptr)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::GetInstance fail!!");
+            return false;
+        }
+        if (&view == p_DnotDisturbView->GetButtonOn()) // 开启勿扰模式
+        {
+            bool state = DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled();
+            DnotDisturbModel::GetInstance().SetDoNotDisturbModeEnabled(state ? false : true);
+        }
+        else if (&view == p_DnotDisturbView->GetButtonOff())
+        {
+            // NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+        }
+        NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+        return true;
+    }
+
+    // 增加按键事件
+    bool DnotDisturbPresenter::OnKeyAct(UIView &view, const KeyEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbPresenter::OnKeyAct");
+        uint16_t keyID = event.GetKeyId();
+        uint16_t keyState = event.GetState();
+        // 如果是power键就返回上一级
+        if (keyID == static_cast<uint16_t>(ZliteKeyCode::ZLITE_KEY_POWER) && keyState == 1 && uapi_get_screen_state() == 0)
+        {
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+        }
+        return true;
+    }
+
+    void DnotDisturbPresenter::Notify()
+    {
+        // DnotDisturbView::GetInstance()->UpdataTime();
+    }
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/dnotdisturb/src/DnotDisturbView.cpp
new file mode 100644 (file)
index 0000000..bf74133
--- /dev/null
@@ -0,0 +1,256 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-04-10 11:58:21
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2025-02-24 18:06:56
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbView.cpp
+ */
+#include "dnotdisturb/include/DnotDisturbView.h"
+#include "dnotdisturb/include/DnotDisturbPresenter.h"
+#include "dnotdisturb/include/DnotDisturbModel.h"
+#include "wearable_log.h"
+#include "screensetting/include/ScreenModels.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include "uicomponents/UIComponents.h"
+#include "ui_resource_string.h"
+namespace OHOS
+{
+
+    static DnotDisturbView *g_pDnotDisturbView{nullptr};
+
+    DnotDisturbView::DnotDisturbView()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::DnotDisturbView");
+        g_pDnotDisturbView = this;
+    }
+
+    DnotDisturbView::~DnotDisturbView()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::~DnotDisturbView");
+        ClearAll();
+        g_pDnotDisturbView = nullptr;
+    }
+
+    DnotDisturbView *DnotDisturbView::GetInstance()
+    {
+        return g_pDnotDisturbView;
+    }
+
+    void DnotDisturbView::ClearAll(void)
+    {
+        if (scrollView != nullptr)
+        {
+            scrollView->RemoveAll();
+
+            if (showTitleLabel != nullptr)
+            {
+                delete showTitleLabel;
+                showTitleLabel = nullptr;
+            }
+
+            if (DnotDisturbImage != nullptr)
+            {
+                delete DnotDisturbImage;
+                DnotDisturbImage = nullptr;
+            }
+
+            if (AttentionLabel != nullptr)
+            {
+                delete AttentionLabel;
+                AttentionLabel = nullptr;
+            }
+
+            if (ButtonOn != nullptr)
+            {
+                delete ButtonOn;
+                ButtonOn = nullptr;
+            }
+
+            if (ButtonOff != nullptr)
+            {
+                delete ButtonOff;
+                ButtonOff = nullptr;
+            }
+            if (temp != nullptr)
+            {
+                delete temp;
+                temp = nullptr;
+            }
+            delete scrollView;
+            scrollView = nullptr;
+        }
+    }
+
+    void DnotDisturbView::DnotDisturbViewInit(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::DnotDisturbViewInit");
+        if (scrollView == nullptr)
+        {
+            scrollView = new UIScrollView();
+            if (scrollView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::scrollView new fail!!");
+                return;
+            }
+            scrollView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+            scrollView->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            scrollView->SetTouchable(true);
+            scrollView->SetDraggable(true);
+            scrollView->SetScrollBlankSize(30);
+            scrollView->SetReboundSize(30);
+            scrollView->SetDirection(1);
+            scrollView->SetThrowDrag(true);         // 设置手指抬起屏幕后是否继续滚动。
+            scrollView->SetMaxScrollDistance(1000); // 设置手指抬起屏幕后的最大滚动距离。
+            scrollView->SetSwipeACCLevel(200);      /*设置手指抬起屏幕后的补偿距离。*/
+            FocusManager::GetInstance()->RequestFocus(scrollView);
+            FocusManager::GetInstance()->RequestFocusByDirection(FOCUS_DIRECTION_UP);
+            scrollView->SetRotateFactor(1.0);
+            UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(DnotDisturbPresenter::GetInstance());
+            if (dragListener == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::dragListener new fail!!");
+                return;
+            }
+            scrollView->SetOnDragListener(dragListener);
+            /* -------------------------------------------------------------------------- */
+            showTitleLabel = new UILabelExt();
+            if (showTitleLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::showTitleLabel new fail!!");
+                return;
+            }
+            showTitleLabel->SetPosition(83, 52, 300, 35);
+            showTitleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            showTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            showTitleLabel->SetTextId(STR_DO_NOT_DISTURB);
+            showTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE);
+            showTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            showTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            scrollView->Add(showTitleLabel);
+            /* -------------------------------------------------------------------------- */
+            DnotDisturbImage = new UIImageView();
+            if (DnotDisturbImage == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::DnotDisturbImage new fail!!");
+                return;
+            }
+            DnotDisturbImage->SetPosition(186, 110);
+            DnotDisturbImage->Resize(94, 94);
+            DnotDisturbImage->SetStyle(STYLE_BACKGROUND_COLOR, 0xff8120e2);
+            DnotDisturbImage->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+            DnotDisturbImage->SetStyle(STYLE_BORDER_RADIUS, 100);
+            DnotDisturbImage->SetAutoEnable(false);
+            DnotDisturbImage->SetResizeMode(UIImageView::FILL);
+            DnotDisturbImage->SetSrc(PNG_APPLIST_DISTURB_IMAGE);
+            scrollView->Add(DnotDisturbImage);
+            /* -------------------------------------------------------------------------- */
+            AttentionLabel = new UILabelExt();
+            if (AttentionLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::AttentionLabel new fail!!");
+                return;
+            }
+            AttentionLabel->SetPosition(33, 228, 400, 70);
+            AttentionLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            AttentionLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+            // bool ?勿扰模式已开启是否关闭:开启勿扰模式,手表将不会发出震动与铃声,是否开启
+            AttentionLabel->SetTextId(DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled() ? STR_DISTURBNOTE_OFF : STR_DO_NOT_DISTURB_MODE);
+            AttentionLabel->SetLineBreakMode(UILabelExt::LINE_BREAK_WRAP);
+            AttentionLabel->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
+            AttentionLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            AttentionLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            scrollView->Add(AttentionLabel);
+            /* -------------------------------------------------------------------------- */
+            ButtonOn = new UILabelButtonExt();
+            if (ButtonOn == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::ButtonOn new fail!!");
+                return;
+            }
+            ButtonOn->SetPosition(256, AttentionLabel->GetY() + AttentionLabel->GetHeight() + 20, 120, 120);
+            ButtonOn->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+            ButtonOn->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+            const char *ButtonOnImgSrc = "/user/res/SYSTEM_CheckOn.bin";
+            ButtonOn->SetImageSrc(ButtonOnImgSrc, ButtonOnImgSrc);
+            ButtonOn->SetImagePosition(10, 10);
+            ButtonOn->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
+            ButtonOn->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            ButtonOn->SetOnClickListener(presenter_);
+            scrollView->Add(ButtonOn);
+            /* -------------------------------------------------------------------------- */
+            ButtonOff = new UILabelButtonExt();
+            if (ButtonOff == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DnotDisturbView::ButtonOff new fail!!");
+                return;
+            }
+            ButtonOff->SetPosition(111, AttentionLabel->GetY() + AttentionLabel->GetHeight() + 20, 120, 120);
+            ButtonOff->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+            ButtonOff->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+            const char *ButtonOffImgSrc = "/user/res/SYSTEM_CheckOff.bin";
+            ButtonOff->SetImageSrc(ButtonOffImgSrc, ButtonOffImgSrc);
+            ButtonOff->SetImagePosition(10, 10);
+            ButtonOff->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
+            ButtonOff->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            ButtonOff->SetOnClickListener(presenter_);
+            scrollView->Add(ButtonOff);
+            /* -------------------------------------------------------------------------- */
+            if ((ButtonOff->GetY() + ButtonOff->GetHeight() > Screen::GetInstance().GetHeight()))
+            {
+                if (temp == nullptr)
+                {
+                    temp = new UIImageView();
+                    if (temp == nullptr)
+                    {
+                        return;
+                    }
+
+                    temp->SetPosition(43, ButtonOff->GetY() + ButtonOff->GetHeight(), 380, 40);
+                    temp->SetVisible(false);
+                    scrollView->Add(temp);
+                }
+            }
+        }
+    }
+
+    /*更新当前时间*/
+    void DnotDisturbView::UpdataTime()
+    {
+#if 0
+        // 获取当前时间
+        struct tm pTM;
+        time_t seconds;
+        time(&seconds);
+        localtime_r(&seconds, &pTM);
+
+        // 解析时间
+        int hour = pTM.tm_hour;
+        int minute = pTM.tm_min;
+
+        // 将时间和日期转换为字符串
+        std::string stringtime = (hour < 10 ? "0" : "") + std::to_string(hour) + ":" + (minute < 10 ? "0" : "") + std::to_string(minute);
+        showTitleLabel->SetText(stringtime.c_str());
+#endif
+    }
+
+    UILabelButtonExt *DnotDisturbView::GetButtonOn(void)
+    {
+        return ButtonOn;
+    }
+
+    UILabelButtonExt *DnotDisturbView::GetButtonOff(void)
+    {
+        return ButtonOff;
+    }
+
+    void DnotDisturbView::OnStart()
+    {
+        DnotDisturbViewInit();
+
+        if (scrollView)
+        {
+            AddViewToRootContainer(scrollView);
+        }
+    }
+}
\ No newline at end of file