增加睡眠模式;更新睡眠模式判定接口 808/1 808/head
authorcheng <chengyf@zhihuishixun.com>
Tue, 27 Aug 2024 12:35:05 +0000 (20:35 +0800)
committercheng <chengyf@zhihuishixun.com>
Tue, 27 Aug 2024 12:35:05 +0000 (20:35 +0800)
34 files changed:
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h
code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h
code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h
code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp
code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp
code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/countdown/src/CountDownModel.cpp
code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessModel.cpp
code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp
code/sdk/application/wearable/fd230app/nativeui/displaybrightness/src/DisplayBrightnessView.cpp
code/sdk/application/wearable/fd230app/nativeui/dnotdisturb/src/DnotDisturbModel.cpp
code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckAbnormalView.cpp
code/sdk/application/wearable/fd230app/nativeui/heart_blood/CheckInvalidView.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp
code/sdk/application/wearable/fd230app/nativeui/main/src/dropdown/DropDownCardPage1.cpp
code/sdk/application/wearable/fd230app/nativeui/sleepmode/include/SleepModeModel.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/sleepmode/include/SleepModePresenter.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/sleepmode/include/SleepModeView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeModel.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModePresenter.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeView.cpp [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingModel.cpp
code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp
code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp
code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp
code/sdk/application/wearable/service/msg_center/src/notify/sleep_notification.cpp
code/sdk/application/wearable/service/power_manager/src/power_display_service.c
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h
code/sdk/drivers/peripheral/config/src/ConfigModel.cpp
code/sdk/drivers/peripheral/utils/custom_utils.c
tools/language_tool/font/ui_resource_string.h

index 46837da..3f90941 100644 (file)
@@ -133,6 +133,7 @@ set(PRIVATE_HEADER
     ${ROOT_DIR}/open_source/openharmony/utils/native/lite/kv_store/innerkits
 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/schedule/include
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/sleepmode/include
 )
 
 set(SOURCES
@@ -757,6 +758,10 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/schedule/src/ScheduleModel.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/schedule/src/ScheduleListAdapter.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/schedule/src/ScheduleListItem.cpp
+    #sleep mode
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/sleepmode/src/SleepModeView.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/sleepmode/src/SleepModePresenter.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/sleepmode/src/SleepModeModel.cpp
 
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/calculator/src/CalculatorView.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/calculator/src/CalculatorPresenter.cpp
index cf46569..74ea9c9 100644 (file)
@@ -122,6 +122,7 @@ typedef enum : uint16_t
     VIEW_GOAL,           // 每日目标
     VIEW_CALCULATOR,     // 计算器
     VIEW_SCHEDULE,       // schedule
+    VIEW_SLEEPMODE, // sleep mode
     /*屏蔽Slice*/
     VIEW_PHONERING,     // 拨号界面
     VIEW_PHONECALLING,  // 来电
index a3fd409..6078437 100644 (file)
@@ -121,6 +121,7 @@ namespace OHOS
         /* -------------------------------------------------------------------------- */
         void InitCalculatorSlice(void);
         void InitScheduleSlice(void);
+        void InitSleepModeSlice(void);
         void InittestSlice(void);
 
     private:
index e6d8587..d67039d 100644 (file)
@@ -1,15 +1,15 @@
-/*\r
-* Copyright (c) xxxxxxxx Technologies Co., Ltd. 2021-2021. All rights reserved.\r
-* Description: language\r
-* Author: Graphic develop team\r
-* Create: 2021-07-06\r
-*/\r
-\r
-#ifndef UI_RESOURCE_STRING_H\r
-#define UI_RESOURCE_STRING_H\r
-#include <cstdint>\r
-namespace OHOS {\r
-enum UIResourceTextId : uint16_t {\r
+/*
+* Copyright (c) xxxxxxxx Technologies Co., Ltd. 2021-2021. All rights reserved.
+* Description: language
+* Author: Graphic develop team
+* Create: 2021-07-06
+*/
+
+#ifndef UI_RESOURCE_STRING_H
+#define UI_RESOURCE_STRING_H
+#include <cstdint>
+namespace OHOS {
+enum UIResourceTextId : uint16_t {
     STR_EXERCISE_OUTDOORWALKING = 0,\r
     STR_EXERCISE_OUTDOORRUNNING = 1,\r
     STR_EXERCISE_OUTDOORBIKING = 2,\r
@@ -560,8 +560,8 @@ enum UIResourceTextId : uint16_t {
     STR_SLEEP_MODE_PROMPT_ON = 547,\r
     STR_MAX_ID = 548,\r
 }; // UIResourceTextId\r
-\r
-enum FontLanguageId : uint8_t {\r
+
+enum FontLanguageId : uint8_t {
     LANGUAGE_ID_ZH,\r
     LANGUAGE_ID_EN,\r
     LANGUAGE_ID_MAX\r
index e9540e5..f88f405 100644 (file)
 /* -------------------------------------------------------------------------- */
 #include "schedule/include/SchedulePresenter.h"
 #include "schedule/include/ScheduleData.h"
+#include "sleepmode/include/SleepModePresenter.h"
 
 #ifdef SUPPORT_ALIPAY_SEC
 #include "AlipayMainView.h"
 #include "product_adapter.h"
 #endif
 #include "bleEvent.h"
+#include "../../../../../../drivers/peripheral/config/include/ConfigModelC.h"
 
 namespace OHOS
 {
@@ -416,6 +418,7 @@ namespace OHOS
         /*智能助手*/
         {VIEW_OFFLINEVOICE, &NativeLauncher::InitOfflineVoice},
         {VIEW_SCHEDULE, &NativeLauncher::InitScheduleSlice},
+        {VIEW_SLEEPMODE, &NativeLauncher::InitSleepModeSlice},
 
 #ifdef SUPPORT_ALIPAY_SEC
         {VIEW_MAIN_ALIPAY, &NativeLauncher::InitMainAlipaySlice},
@@ -505,6 +508,7 @@ namespace OHOS
         read_jsonHistory_weather();
         
         C_ScheduleDataReadFromFile();
+        mmi_sleep_mode_switch_read();
     }
 
     void NativeLauncher::InitAllNativeSlices(void)
@@ -1534,4 +1538,16 @@ namespace OHOS
         NativeAbility::GetInstance().AddSliceProxy(VIEW_SCHEDULE, t_View);
     }
 
+    void NativeLauncher::InitSleepModeSlice(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitSleepModeSlice");
+        SliceProxy *t_View = new AbilitySliceProxy<SleepModeView, SleepModePresenter>;
+        if (nullptr == t_View)
+        {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "View is nullptr");
+            return;
+        }
+        NativeAbility::GetInstance().AddSliceProxy(VIEW_SLEEPMODE, t_View);
+    }
+
 }
index 6cf0c9e..9804b3e 100644 (file)
@@ -20,7 +20,7 @@
 #include "ui_service.h"
 #include "notification_manager.h"
 #include "../../../../../../../drivers/peripheral/config/include/ConfigModel.h"
-#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"
+#include "custom_runtime.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -692,7 +692,7 @@ void AlarmClockModel::PopInterCancelMusic()
 
 void AlarmClockModel::PopInterPlayMusic()
 {
-    if(true == ConfigModel::GetInstance()->GetDnotdisturb() && (0 == uapi_dev_runtime_get_sleep_monitoring_status()))
+    if(true == ConfigModel::GetInstance()->GetDnotdisturb() || (uapi_sleep_mode_flag_get()))
     {
         return;
     }
index 89278f4..564c309 100644 (file)
@@ -174,7 +174,7 @@ namespace OHOS
                 HealthService::GetInstance()->SetHealthCurrent(highHealthState);
                 viewId = VIEW_CHECK_INVALID;
             }
-            if(uapi_dev_runtime_get_sleep_monitoring_status())
+            if(uapi_sleep_mode_flag_get())
             {
                 if(VIEW_DNOTDISTURB == viewId)
                     return false; 
index 3ac4f11..e56a828 100644 (file)
@@ -14,6 +14,7 @@
 #include <cmsis_os.h>\r
 #include "ConfigModel.h"\r
 #include "ui_resource_string.h"\r
+#include "custom_runtime.h"\r
 namespace OHOS\r
 {\r
     /* -------------------------------------------------------------------------- */\r
@@ -308,6 +309,10 @@ namespace OHOS
     /*触发铃声的开始*/\r
     void CountDownModel::RequestStartRingtone(void)\r
     {\r
+        if(uapi_sleep_mode_flag_get())\r
+        {\r
+            return;\r
+        }\r
         if (true != ConfigModel::GetInstance()->GetDnotdisturb())\r
         {\r
             PostRingtoneEvent(&CountDownModel::StartRingtonePlayback);\r
index e8c8be6..0355432 100644 (file)
@@ -36,7 +36,7 @@ namespace OHOS
             return false;
         }
         bool t_value = mmi_flip_wrist_switch_get();
-        if(uapi_dev_runtime_get_sleep_monitoring_status())
+        if(uapi_sleep_mode_flag_get())
         {
             t_value = false;
         }
index 4ab35f4..819075e 100644 (file)
@@ -170,7 +170,7 @@ namespace OHOS
         }\r
         if (strcmp(view.GetViewId(), BRINGHTNESSCONTROLBUTTON_VIEW) == 0)\r
         {\r
-            if(uapi_dev_runtime_get_sleep_monitoring_status())\r
+            if(uapi_sleep_mode_flag_get())\r
             {\r
                 return false;\r
             }\r
index dd1b552..437da13 100644 (file)
@@ -402,7 +402,7 @@ namespace OHOS
         DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessLabel);\r
         DisplayBrightnessScrollView[DISPLAYBRIGHTNESSVIEW]->Add(RaiseToBrightnessCheckBoxButton);\r
 \r
-        if(uapi_dev_runtime_get_sleep_monitoring_status())\r
+        if(uapi_sleep_mode_flag_get())\r
         {\r
             RaiseToBrightnessCheckBoxButton->SetTouchable(false);\r
         }\r
index f186f55..1818c8f 100644 (file)
@@ -34,7 +34,7 @@ namespace OHOS
 
     bool DnotDisturbModel::GetDoNotDisturbModeEnabled() const
     {
-        if(uapi_dev_runtime_get_sleep_monitoring_status())
+        if(uapi_sleep_mode_flag_get())
         {
             return true;
         }
index 09ab6f0..1d4e6f6 100644 (file)
@@ -23,6 +23,7 @@
 #include "heart_blood/CheckAbnormalView.h"
 
 #include "vibrator_service.h"
+#include "custom_runtime.h"
 
 namespace OHOS
 {
@@ -164,7 +165,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::InitBloodView fail");
         }
         
-        if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+        if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
         {
             ui_api_vibrate_once_func();
         }
index 78953d5..51a1030 100644 (file)
@@ -31,6 +31,7 @@
 #include "heart_blood/health_service/health_service.h"
 
 #include "vibrator_service.h"
+#include "custom_runtime.h"
 
 namespace OHOS
 {
@@ -215,7 +216,7 @@ namespace OHOS
         }
         SetViewData();
 
-        if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+        if(true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
         {
             // 震动提醒
             ui_api_vibrate_once_func();
index eb28df0..db24886 100644 (file)
@@ -134,7 +134,7 @@ namespace OHOS
             return true;
         }
 
-        if (uapi_dev_runtime_get_sleep_monitoring_status())
+        if (uapi_sleep_mode_flag_get())
         {
             if (VIEW_DNOTDISTURB == g_jumpView[curViewId])
             {
index c7c2232..259de96 100644 (file)
@@ -12,6 +12,7 @@
 #include "AppViewIDs.h"
 #include "NativeAbility.h"
 #include "dnotdisturb/include/DnotDisturbModel.h"
+#include "sleepmode/include/SleepModeModel.h"
 #include "main/include/MainModel.h"
 #include <custom_runtime.h>
 #include "ConfigModel.h"
@@ -113,11 +114,22 @@ namespace OHOS
         }
         else if (viewId == DROPDOWN_SLEEP_TOGGLEBUTTON_VIEWID) // 睡眠开关
         {
-            state = toggleButton[DropDownCardPage1::toggleButton_SLEEP]->GetState();
+            if (uapi_sleep_mode_flag_get())
+            {
+                state = toggleButton[DropDownCardPage1::toggleButton_SLEEP]->GetState();
+                UpdateSleepModelState(state);
+                SleepModeModel::GetInstance().SetSleepModeDisabled();
+                // state = toggleButton[DropDownCardPage1::toggleButton_DNOTDISTURB]->GetState();
+                UpdateDnotdisturbState(DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled());
+            }
+            else
+            {
+                NativeAbility::GetInstance().EnterSlice(VIEW_SLEEPMODE);
+            }
         }
         else if (viewId == DROPDOWN_DNOTDISTURB_TOGGLEBUTTON_VIEWID) // 勿扰开关
         {
-            if (uapi_dev_runtime_get_sleep_monitoring_status())
+            if (uapi_sleep_mode_flag_get())
             {
                 return true;
             }
@@ -180,7 +192,7 @@ namespace OHOS
         bool state_bt = ConfigModel::GetInstance()->GetClassicBlueToothState(); // 传统蓝牙开关
         bool state_4g = uapi_cat1_get_power_stat();
         bool state_savepower = uapi_dev_runtime_get_saveele_status();
-        bool state_sleep = uapi_dev_runtime_get_sleep_monitoring_status();
+        bool state_sleep = uapi_sleep_mode_flag_get();
         bool state_dnotdisturb = DnotDisturbModel::GetInstance().GetDoNotDisturbModeEnabled();
 
         ToggleButtonConfig toggleButtonConfig[] = {
diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleepmode/include/SleepModeModel.h b/code/sdk/application/wearable/fd230app/nativeui/sleepmode/include/SleepModeModel.h
new file mode 100644 (file)
index 0000000..14cc1ac
--- /dev/null
@@ -0,0 +1,25 @@
+
+#ifndef __SLEEPMODEMODEL_H__
+#define __SLEEPMODEMODEL_H__
+
+
+namespace OHOS
+{
+    class SleepModeModel
+    {
+    public:
+        static SleepModeModel &GetInstance(void);
+        // void UpdateSleepMode(void);
+        void SetSleepModeEnabled(void);
+        void SetSleepModeDisabled(void);
+
+    private:
+        SleepModeModel();
+        SleepModeModel(const SleepModeModel &) = delete;
+        SleepModeModel &operator=(const SleepModeModel &) = delete;
+        virtual ~SleepModeModel();
+
+    };
+}
+
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleepmode/include/SleepModePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/sleepmode/include/SleepModePresenter.h
new file mode 100644 (file)
index 0000000..2d28b5d
--- /dev/null
@@ -0,0 +1,42 @@
+
+#ifndef __SLEEPMODEPRESENTER_H__
+#define __SLEEPMODEPRESENTER_H__
+
+#include "Presenter.h"
+#include "View.h"
+#include "sleepmode/include/SleepModeView.h"
+#include "sleepmode/include/SleepModeModel.h"
+
+
+namespace OHOS
+{
+    class SleepModeView;
+    class SleepModePresenter : public Presenter<SleepModeView>,
+                                 public UIView::OnClickListener,
+                                 public RootView::OnKeyActListener,
+                                 public UIView::OnDragListener
+    {
+    public:
+        SleepModePresenter();
+        virtual ~SleepModePresenter();
+
+        void OnStart() override;
+        void OnPause() override;
+        void OnResume() override;
+        void OnStop() override;
+
+        static SleepModePresenter *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};
+
+        SleepModeModel * SleepModeModel_{nullptr};
+    };
+}
+
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleepmode/include/SleepModeView.h b/code/sdk/application/wearable/fd230app/nativeui/sleepmode/include/SleepModeView.h
new file mode 100644 (file)
index 0000000..f4317cc
--- /dev/null
@@ -0,0 +1,49 @@
+
+#ifndef __SLEEPMODEVIEW_H__
+#define __SLEEPMODEVIEW_H__
+
+#include "BaseView.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"
+
+
+namespace OHOS
+{
+    #define SLEEPMODE_ViewId_OKButton_ "SLEEPMODE_ViewId_OKButton_"
+
+    class SleepModePresenter;
+    class SleepModeView : public View<SleepModePresenter>
+    {
+    public:
+        SleepModeView();
+        virtual ~SleepModeView();
+        static SleepModeView * GetInstance(void);
+        
+        void OnStart() override;
+        void OnSetUpView() override;
+        void OnTearDownView() override;
+        void OnStop() override;
+
+    private:
+        UIScrollView * InitScreen(void);
+        void DeinitScreen(void);
+
+        UIScrollView * ScrollView_{nullptr};
+        UILabelExt * TitleLabelExt_{nullptr}; 
+        UIImageView * PromptImage_{nullptr};
+        UILabelExt * PromptLabelExt_{nullptr};
+        UILabelButtonExt * CancelButton_{nullptr};
+        UILabelButtonExt * OKButton_{nullptr};
+
+
+        #define SCREEN_WIDTH (Screen::GetInstance().GetWidth())
+        #define SCREEN_HEIGHT (Screen::GetInstance().GetHeight())
+
+        #define SLEEP_MODE_PROMPT_IMAGE "/user/res/Sleepmode/sleepmode.bin"
+    };
+}
+#endif
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeModel.cpp
new file mode 100644 (file)
index 0000000..c60aeb3
--- /dev/null
@@ -0,0 +1,80 @@
+
+#include "sleepmode/include/SleepModeModel.h"
+#include "main/include/MainViewSample.h"
+#include "MainModel.h"
+#include "ConfigModel.h"
+#include "custom_runtime.h"
+#include "custom_utils.h"
+#include "ui_service.h"
+#include "ConfigModelC.h"
+#include "power_display_service.h"
+
+
+namespace OHOS
+{
+    SleepModeModel::SleepModeModel() {}
+
+    SleepModeModel::~SleepModeModel() {}
+
+    SleepModeModel &SleepModeModel::GetInstance()
+    {
+        static SleepModeModel instance;
+        return instance;
+    }
+
+    void SleepModeModel::SetSleepModeEnabled(void)
+    {
+        uapi_sleep_mode_flag_set(1);
+
+        // update donotdisturb
+        // SendMsgToUIService(UI_UPDATE_DNOTDISTURB_MODE, 0, nullptr, 0);
+
+        /*更新主界面配置*/
+        MainModel::GetInstance().setDialState(DialState::SLEEP, true);
+
+        // disable flip wrist
+        uapi_take_to_wake(0);
+
+        // turn down brightness
+        const power_display_svr_api_t *display_api = power_display_svr_get_api();
+        display_api->set_brightness(51);
+    }
+
+    void SleepModeModel::SetSleepModeDisabled(void)
+    {
+        uapi_sleep_mode_flag_set(0);
+
+        // update donotdisturb
+        // SendMsgToUIService(UI_UPDATE_DNOTDISTURB_MODE, 0, nullptr, 0);
+
+        /*更新主界面配置*/
+        MainModel::GetInstance().setDialState(DialState::SLEEP, false);
+
+        // enable flip wrist
+        if(true == mmi_flip_wrist_switch_get())
+        {
+            uapi_take_to_wake(1);
+        }
+
+        // reset brightness
+        const power_display_svr_api_t *display_api = power_display_svr_get_api();
+        display_api->set_brightness(OHOS::ConfigModel::GetInstance()->GetBrightness());
+    }
+
+    // /*更新勿扰模式*/
+    // void SleepModeModel::UpdateSleepMode(void)
+    // {
+    //     if (PullUpDownView::GetInstance() != nullptr)
+    //     {
+    //         /*更新主界面下拉界面配置*/
+    //         if(DropDownCardPage1::GetInstance() && DropDownCardPage1::GetInstance()->GetDropDownCardPage1_ToggleButton(DropDownCardPage1::toggleButton_DNOTDISTURB))
+    //         {
+    //             DropDownCardPage1::GetInstance()->GetDropDownCardPage1_ToggleButton(DropDownCardPage1::toggleButton_DNOTDISTURB)->SetState(GetSleepModeEnabled());
+    //         }
+    //         PullUpDownView::GetInstance()->UpdateSleepModeStatus(GetSleepModeEnabled());
+    //         /*更新主界面配置*/
+    //         MainModel::GetInstance().setDialState(DialState::DO_NOT_DISTURB, GetSleepModeEnabled());
+    //     }
+    //     return;
+    // }
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModePresenter.cpp
new file mode 100644 (file)
index 0000000..57882dc
--- /dev/null
@@ -0,0 +1,104 @@
+
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+#include "UiConfig.h"
+#include "sleepmode/include/SleepModePresenter.h"
+#include "common/key_code.h"
+#include <custom_utils.h>
+
+
+namespace OHOS
+{
+    static SleepModePresenter * p_SleepModePresenterInstance = nullptr;
+
+    SleepModePresenter::SleepModePresenter()
+    {
+        SleepModeModel_ = &SleepModeModel::GetInstance();
+        p_SleepModePresenterInstance = this;
+    }
+
+    SleepModePresenter::~SleepModePresenter()
+    {
+        p_SleepModePresenterInstance = nullptr;
+    }
+
+    SleepModePresenter * SleepModePresenter::GetInstance()
+    {
+        return p_SleepModePresenterInstance;
+    }
+
+    void SleepModePresenter::OnStart()
+    {
+        Presenter<SleepModeView>::OnStart();
+    }
+
+    void SleepModePresenter::OnPause(void)
+    {
+        Presenter<SleepModeView>::OnPause();
+    }
+
+    void SleepModePresenter::OnResume(void)
+    {
+        Presenter<SleepModeView>::OnResume();
+    }
+
+    void SleepModePresenter::OnStop(void)
+    {
+        Presenter<SleepModeView>::OnStop();
+    }
+
+    bool SleepModePresenter::OnDrag(UIView &view, const DragEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SleepModePresenter::OnDrag");
+        UNUSED(view);
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+        {
+            SleepModePresenter::X_DRAG_FLAG = true;
+        }
+        return true;
+    }
+
+    bool SleepModePresenter::OnDragEnd(UIView &view, const DragEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SleepModePresenter::OnDragEnd");
+        UNUSED(event);
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && SleepModePresenter::X_DRAG_FLAG)
+        {
+            NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+            SleepModePresenter::X_DRAG_FLAG = false;
+        }
+        return true;
+    }
+
+    bool SleepModePresenter::OnClick(UIView &view, const ClickEvent &event)
+    {
+        UNUSED(event);
+
+        if(0 == strcmp(view.GetViewId(), SLEEPMODE_ViewId_OKButton_))
+        {
+            SleepModeModel_->SetSleepModeEnabled();
+        }
+
+        NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS);
+        return true;
+    }
+
+    // 增加按键事件
+    bool SleepModePresenter::OnKeyAct(UIView &view, const KeyEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SleepModePresenter::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 SleepModePresenter::Notify()
+    // {
+    //     // SleepModeView::GetInstance()->UpdataTime();
+    // }
+}
\ No newline at end of file
diff --git a/code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeView.cpp b/code/sdk/application/wearable/fd230app/nativeui/sleepmode/src/SleepModeView.cpp
new file mode 100644 (file)
index 0000000..987c5f2
--- /dev/null
@@ -0,0 +1,231 @@
+
+#include "sleepmode/include/SleepModeView.h"
+#include "sleepmode/include/SleepModePresenter.h"
+#include "sleepmode/include/SleepModeModel.h"
+#include "wearable_log.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include "uicomponents/UIComponents.h"
+#include "ui_resource_string.h"
+
+
+namespace OHOS
+{
+    static SleepModeView * p_SleepModeViewInstance = nullptr;
+
+    SleepModeView::SleepModeView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SleepModeView::SleepModeView");
+        p_SleepModeViewInstance = this;
+    }
+
+    SleepModeView::~SleepModeView()
+    {
+        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SleepModeView::~SleepModeView");
+        p_SleepModeViewInstance = nullptr;
+    }
+
+    SleepModeView * SleepModeView::GetInstance()
+    {
+        return p_SleepModeViewInstance;
+    }
+
+    void SleepModeView::OnStart()
+    {
+        View<SleepModePresenter>::OnStart();
+
+        SetContainerView(new UIViewGroup());
+        if (nullptr == GetContainer())
+        {
+                       // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d]", __LINE__);
+            return;
+        }
+        container_->SetPosition(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+        container_->SetTouchable(true);
+        container_->SetDraggable(true);
+
+        ScrollView_ = InitScreen();
+
+        container_->Add(ScrollView_);
+
+        RootView::GetInstance()->SetOnKeyActListener(presenter_);
+    }
+
+    void SleepModeView::OnSetUpView()
+    {
+        View<SleepModePresenter>::OnSetUpView();
+
+        Draw();
+    }
+
+    void SleepModeView::OnTearDownView()
+    {
+        View<SleepModePresenter>::OnTearDownView();
+    }
+
+    void SleepModeView::OnStop()
+    {
+        View<SleepModePresenter>::OnStop();
+        RootView::GetInstance()->ClearOnKeyActListener();
+
+        if (nullptr != container_)
+        {
+            container_->RemoveAll();
+
+            DeinitScreen();
+
+            delete container_;
+            container_ = nullptr;
+        }
+
+        return;
+    }    
+
+    void SleepModeView::DeinitScreen()
+    {
+        if(nullptr != ScrollView_)
+        {
+            ScrollView_->RemoveAll();
+            if(nullptr != TitleLabelExt_)
+            {
+                delete TitleLabelExt_;
+                TitleLabelExt_ = nullptr;
+            }
+            if(nullptr != PromptImage_)
+            {
+                delete PromptImage_;
+                PromptImage_ = nullptr;
+            }
+            if(nullptr != PromptLabelExt_)
+            {
+                delete PromptLabelExt_;
+                PromptLabelExt_ = nullptr;
+            }
+            if(nullptr != CancelButton_)
+            {
+                delete CancelButton_;
+                CancelButton_ = nullptr;
+            }
+            if(nullptr != OKButton_)
+            {
+                delete OKButton_;
+                OKButton_ = nullptr;
+            }
+            
+            delete ScrollView_;
+            ScrollView_ = nullptr;
+        }
+    }
+
+    UIScrollView * SleepModeView::InitScreen(void)
+    {
+        if (nullptr == ScrollView_)
+        {
+            ScrollView_ = new UIScrollView();
+            if (nullptr == ScrollView_)
+                return nullptr;
+
+            ScrollView_->SetPosition(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+            // ScrollView_->SetViewId();
+            ScrollView_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE);
+            ScrollView_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+            ScrollView_->SetOnDragListener(presenter_);
+            ScrollView_->SetTouchable(true);
+            ScrollView_->SetDraggable(true);
+
+            if (nullptr == TitleLabelExt_)
+            {
+                TitleLabelExt_ = new UILabelExt();
+                if (nullptr == TitleLabelExt_)
+                    return nullptr;
+
+                TitleLabelExt_->SetPosition(83, 50, 300, 35);
+                TitleLabelExt_->SetStyle(STYLE_TEXT_FONT, 30);
+                TitleLabelExt_->SetStyle(STYLE_LINE_HEIGHT, 35);
+                TitleLabelExt_->SetTextId(STR_SLEEPMODE);
+                TitleLabelExt_->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+                TitleLabelExt_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+                TitleLabelExt_->SetRollSpeed(70);
+                TitleLabelExt_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+                // TitleLabelExt_->SetStyle(STYLE_TEXT_COLOR, 0xffff5a36);
+            }
+
+            if (nullptr == PromptImage_)
+            {
+                PromptImage_ = new UIImageView();
+                if (nullptr == PromptImage_)
+                    return nullptr;
+
+                PromptImage_->SetPosition(183, 107);
+                // PromptImage_->Resize(94, 94);
+                // PromptImage_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff8120e2);
+                // PromptImage_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+                // PromptImage_->SetStyle(STYLE_BORDER_RADIUS, 100);
+                // PromptImage_->SetAutoEnable(false);
+                // PromptImage_->SetResizeMode(UIImageView::CENTER);
+                PromptImage_->SetSrc(SLEEP_MODE_PROMPT_IMAGE);
+            }
+
+            if (nullptr == PromptLabelExt_)
+            {
+                PromptLabelExt_ = new UILabelExt();
+                if (nullptr == PromptLabelExt_)
+                    return nullptr;
+
+                PromptLabelExt_->SetPosition(53, 230, 360, 70);
+                PromptLabelExt_->SetStyle(STYLE_TEXT_FONT, 30);
+                PromptLabelExt_->SetStyle(STYLE_LINE_HEIGHT, 35);
+                PromptLabelExt_->SetTextId(STR_SLEEP_MODE_PROMPT_ON);
+                PromptLabelExt_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+                PromptLabelExt_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+                PromptLabelExt_->SetRollSpeed(70);
+                PromptLabelExt_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+                PromptLabelExt_->SetStyle(STYLE_TEXT_COLOR, 0Xff999999);
+            }
+
+            if (nullptr == CancelButton_)
+            {
+                CancelButton_ = new UILabelButtonExt();
+                if (nullptr == CancelButton_)
+                    return nullptr;
+
+                CancelButton_->SetPosition(111, 320, 100, 100);
+                // CancelButton_->SetViewId(SCHEDULE_ViewId_DeleteCancelButton_);
+                CancelButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+                CancelButton_->SetStyle(STYLE_BACKGROUND_OPA, 25); // 10%
+                CancelButton_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
+                CancelButton_->SetStyleForState(STYLE_BACKGROUND_OPA, 25, UIButton::PRESSED);
+                CancelButton_->SetStyle(STYLE_BORDER_RADIUS, 100);
+                CancelButton_->SetImagePosition(0, 0);
+                CancelButton_->SetImageSrc(PNG_SYSTEM_CHECK_OFF_IMAGE, PNG_SYSTEM_CHECK_OFF_IMAGE);
+                CancelButton_->SetOnClickListener(presenter_);
+            }
+
+            if (nullptr == OKButton_)
+            {
+                OKButton_ = new UILabelButtonExt();
+                if (nullptr == OKButton_)
+                    return nullptr;
+
+                OKButton_->SetPosition(256, 320, 100, 100);
+                OKButton_->SetViewId(SLEEPMODE_ViewId_OKButton_);
+                OKButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffffffff);
+                OKButton_->SetStyle(STYLE_BACKGROUND_OPA, 25); // 10%
+                OKButton_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xffffffff, UIButton::PRESSED);
+                OKButton_->SetStyleForState(STYLE_BACKGROUND_OPA, 25, UIButton::PRESSED);
+                OKButton_->SetStyle(STYLE_BORDER_RADIUS, 100);
+                OKButton_->SetImagePosition(0, 0);
+                OKButton_->SetImageSrc(PNG_SYSTEM_CHECK_ON_IMAGE, PNG_SYSTEM_CHECK_ON_IMAGE);
+                OKButton_->SetOnClickListener(presenter_);
+            }
+
+            ScrollView_->Add(TitleLabelExt_);
+            ScrollView_->Add(PromptImage_);
+            ScrollView_->Add(PromptLabelExt_);
+            ScrollView_->Add(CancelButton_);
+            ScrollView_->Add(OKButton_);
+        }
+
+        return ScrollView_;
+    }
+}
\ No newline at end of file
index d13f55e..43827fb 100644 (file)
@@ -510,7 +510,7 @@ namespace OHOS
         if (sportdata->heart >= maxHeartRate)
         {
             uapi_set_screen_on_api(); // 亮屏检测
-            if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+            if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
             {
                 ui_api_vibrate_once_func();
             }
index 67705d4..7db379f 100644 (file)
@@ -1880,7 +1880,7 @@ int get_ScreenDuration(void) //获取亮屏时长
 }
 void Set_RaiseToWake(bool value) //抬婉亮屏开关 
 {
-    if(uapi_dev_runtime_get_sleep_monitoring_status())
+    if(uapi_sleep_mode_flag_get())
     {
         return;
     }
index 6029f60..2cd458c 100644 (file)
@@ -782,7 +782,7 @@ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req)
          }  
         display_api->set_screen_set_keepon_timeout(10);
         
-        if(true != ConfigModel::GetInstance()->GetDnotdisturb())
+        if(true != ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
         {
             AlarmClockModel::GetInstance()->AlarmPlayerStart();
         }
index 5e2708a..f7db40c 100644 (file)
@@ -15,6 +15,7 @@
 #include <power_display_service.h>
 #include <custom_utils.h>
 #include "vibrator_service.h"
+#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"
 
 namespace OHOS
 {
@@ -91,7 +92,7 @@ namespace OHOS
     {
         /*亮屏加震动*/
         uapi_set_screen_on_api();
-        if(true != ConfigModel::GetInstance()->GetDnotdisturb())
+        if(true != ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
         {
             // uapi_vibrationModeSet(ConfigModel::GetInstance()->GetVibrationReminder());
             ui_api_vibrate_once_func();
index 8681cc5..2c319dc 100644 (file)
@@ -38,6 +38,7 @@
 #include <cmsis_os2.h>
 #include <cmsis_os.h>
 #include "vibrator_service.h"
+#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"
 
 namespace OHOS
 {
@@ -125,7 +126,7 @@ namespace OHOS
 
     void FindWatchViewEventListener::SetVibration(void)
     {
-        if(true == ConfigModel::GetInstance()->GetDnotdisturb())
+        if(true == ConfigModel::GetInstance()->GetDnotdisturb() || (uapi_sleep_mode_flag_get()))
         {
             return;
         }
@@ -314,7 +315,7 @@ namespace OHOS
     {
         ScreenTurnOn(-1); // 亮屏操作
 
-        if(true == ConfigModel::GetInstance()->GetDnotdisturb())
+        if(true == ConfigModel::GetInstance()->GetDnotdisturb() || (uapi_sleep_mode_flag_get()))
         {
             return;
         }
index 599b2cd..d948443 100644 (file)
@@ -14,6 +14,7 @@
 #include "string"
 #include "vibrator_service.h"
 #include "../../../../../../../drivers/peripheral/config/include/ConfigModel.h"
+#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"
 
 namespace OHOS
 {
@@ -200,7 +201,7 @@ namespace OHOS
         MessageGroupView->Add(messageLabel);
         MessageGroupView->Add(deleteButton);
 
-        if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+        if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
         {
             // 震动提醒
             ui_api_vibrate_once_func();
index b708ae7..cebf133 100644 (file)
@@ -14,6 +14,7 @@
 #include "UiConfig.h"
 #include "ConfigModel.h"
 #include "alarm/include/AlarmClockModel.h"
+#include "../../../../../../../drivers/peripheral/utils/custom_runtime.h"
 
 namespace OHOS
 {
@@ -150,7 +151,7 @@ namespace OHOS
 
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create SleepGroupView succeed!!");
 
-        if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+        if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
         {
             ui_api_vibrate_once_func();
         }
@@ -194,7 +195,7 @@ namespace OHOS
         SleepGroupView->Add(closebutton);
 
         WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create SleepGroupView succeed!!");
-        if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb())
+        if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
         {
             ui_api_vibrate_once_func();
         }
index 10b582e..833d45a 100755 (executable)
@@ -207,6 +207,11 @@ static brightness_mode_t power_display_get_brightness_mode(void)
 
 static errcode_t power_display_set_brightness(uint8_t brightness)
 {
+    if(uapi_sleep_mode_flag_get()) // in sleep mode, cannot change brightness
+    {
+        brightness = 51;
+    }
+
     message_type_t mt = SET_BRIGHTNESS_CMD;
     uint32_t event_info = brightness;
 #ifndef SUPPORT_AT_OHOSFWK
index e6d8587..d67039d 100644 (file)
@@ -1,15 +1,15 @@
-/*\r
-* Copyright (c) xxxxxxxx Technologies Co., Ltd. 2021-2021. All rights reserved.\r
-* Description: language\r
-* Author: Graphic develop team\r
-* Create: 2021-07-06\r
-*/\r
-\r
-#ifndef UI_RESOURCE_STRING_H\r
-#define UI_RESOURCE_STRING_H\r
-#include <cstdint>\r
-namespace OHOS {\r
-enum UIResourceTextId : uint16_t {\r
+/*
+* Copyright (c) xxxxxxxx Technologies Co., Ltd. 2021-2021. All rights reserved.
+* Description: language
+* Author: Graphic develop team
+* Create: 2021-07-06
+*/
+
+#ifndef UI_RESOURCE_STRING_H
+#define UI_RESOURCE_STRING_H
+#include <cstdint>
+namespace OHOS {
+enum UIResourceTextId : uint16_t {
     STR_EXERCISE_OUTDOORWALKING = 0,\r
     STR_EXERCISE_OUTDOORRUNNING = 1,\r
     STR_EXERCISE_OUTDOORBIKING = 2,\r
@@ -560,8 +560,8 @@ enum UIResourceTextId : uint16_t {
     STR_SLEEP_MODE_PROMPT_ON = 547,\r
     STR_MAX_ID = 548,\r
 }; // UIResourceTextId\r
-\r
-enum FontLanguageId : uint8_t {\r
+
+enum FontLanguageId : uint8_t {
     LANGUAGE_ID_ZH,\r
     LANGUAGE_ID_EN,\r
     LANGUAGE_ID_MAX\r
index d43d098..7cd6097 100644 (file)
@@ -12,6 +12,7 @@
 #define CONFIG_DEBUG
 #endif
 #include "../../../../../drivers/peripheral/vibrator/service/vibrator_service.h"
+#include "../../../../../application/wearable/fd230app/nativeui/sleepmode/include/SleepModeModel.h"
 
 // #define DEBUG_LINE()  printf("%s %d\n",__func__,__LINE__)
 namespace OHOS
@@ -1500,6 +1501,10 @@ void mmi_sleep_mode_switch_read(void)
 {
     uint8_t flag = (OHOS::ConfigModel::GetInstance()->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SLEEP_MODE_SWITCH));
     uapi_sleep_mode_flag_set(flag);
+    if(flag)
+    {
+        OHOS::SleepModeModel::GetInstance().SetSleepModeEnabled();
+    }
 }
 
 // sleep mode switch set
@@ -1524,6 +1529,10 @@ void mmi_flip_wrist_switch_set(bool value)
 // play audio judgement
 bool mmi_play_audio_is_permitted(void)
 {
+    if(uapi_sleep_mode_flag_get())
+    {
+        return false;
+    }
     if(true == (OHOS::ConfigModel::GetInstance()->GetDnotdisturb()))
     {
         return false;
@@ -1535,6 +1544,10 @@ bool mmi_play_audio_is_permitted(void)
 // play vibrate judgement
 bool mmi_play_vibrate_is_permitted(void)
 {
+    if(uapi_sleep_mode_flag_get())
+    {
+        return false;
+    }
     if(true == (OHOS::ConfigModel::GetInstance()->GetDnotdisturb()))
     {
         return false;
index 4352510..41066f4 100644 (file)
@@ -183,6 +183,7 @@ void uapi_save_time_of_day(void)
 void shutdown_reboot_prejobs_task(void)
 {
     C_ScheduleDataWriteToFile();
+    mmi_sleep_mode_switch_write();
 
     uapi_save_time_of_day();
     //保存步数
index e6d8587..d67039d 100644 (file)
@@ -1,15 +1,15 @@
-/*\r
-* Copyright (c) xxxxxxxx Technologies Co., Ltd. 2021-2021. All rights reserved.\r
-* Description: language\r
-* Author: Graphic develop team\r
-* Create: 2021-07-06\r
-*/\r
-\r
-#ifndef UI_RESOURCE_STRING_H\r
-#define UI_RESOURCE_STRING_H\r
-#include <cstdint>\r
-namespace OHOS {\r
-enum UIResourceTextId : uint16_t {\r
+/*
+* Copyright (c) xxxxxxxx Technologies Co., Ltd. 2021-2021. All rights reserved.
+* Description: language
+* Author: Graphic develop team
+* Create: 2021-07-06
+*/
+
+#ifndef UI_RESOURCE_STRING_H
+#define UI_RESOURCE_STRING_H
+#include <cstdint>
+namespace OHOS {
+enum UIResourceTextId : uint16_t {
     STR_EXERCISE_OUTDOORWALKING = 0,\r
     STR_EXERCISE_OUTDOORRUNNING = 1,\r
     STR_EXERCISE_OUTDOORBIKING = 2,\r
@@ -560,8 +560,8 @@ enum UIResourceTextId : uint16_t {
     STR_SLEEP_MODE_PROMPT_ON = 547,\r
     STR_MAX_ID = 548,\r
 }; // UIResourceTextId\r
-\r
-enum FontLanguageId : uint8_t {\r
+
+enum FontLanguageId : uint8_t {
     LANGUAGE_ID_ZH,\r
     LANGUAGE_ID_EN,\r
     LANGUAGE_ID_MAX\r