运动识别弹窗添加,待测试
authorluozheng <1732036298@qq.com>
Thu, 29 May 2025 03:31:14 +0000 (11:31 +0800)
committerluozheng <1732036298@qq.com>
Thu, 29 May 2025 03:31:14 +0000 (11:31 +0800)
code/sdk/application/wearable/fd230/service/broadcast/src/broadcast_implement.c
code/sdk/application/wearable/fd230/service/msg_center/CMakeLists.txt
code/sdk/application/wearable/fd230/service/msg_center/include/notify/motion_recognition_notification.h [new file with mode: 0644]
code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/fd230/service/msg_center/src/notify/motion_recognition_notification.cpp [new file with mode: 0644]

index 11a994e..c247812 100644 (file)
@@ -37,6 +37,7 @@ static const TopicToCore topicToCoreArray[] = {
     {TOPIC_EVENT_CHARGE_PLUG, A_CORE_MASK, 1},
     {TOPIC_EVENT_CHARGE_UNPLUG, A_CORE_MASK, 1},
     {TOPIC_EVENT_LOWPOWER_ALARM, A_CORE_MASK, 1},
+    {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, A_CORE_MASK, 1},
 };
 
 /* 所有的topic,其对应的位图 */
index 65e1c34..18fb721 100644 (file)
@@ -150,6 +150,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/pairing_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/motion_recognition_notification.cpp
 )
 else()
 set(SOURCES
@@ -162,6 +163,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/pairing_notification.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/transmitting.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/motion_recognition_notification.cpp
     
 )
 endif()
diff --git a/code/sdk/application/wearable/fd230/service/msg_center/include/notify/motion_recognition_notification.h b/code/sdk/application/wearable/fd230/service/msg_center/include/notify/motion_recognition_notification.h
new file mode 100644 (file)
index 0000000..5233048
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-17 16:43:46
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-10-18 20:25:34
+ * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h
+ */
+
+#ifndef _MOTION_RECOGNITION_NOTIFICATION_H_
+#define _MOTION_RECOGNITION_NOTIFICATION_H_
+
+/*运动识别*/
+namespace OHOS
+{
+    UIViewGroup *CreateMotionRecognitionView(void);
+    void FreeMotionRecognitionView(void);
+
+    class MotionRecognitionViewEventListener : public UIView::OnTouchListener, public UIView::OnDragListener
+    {
+    public:
+        static MotionRecognitionViewEventListener &GetInstance();
+        bool OnRelease(UIView &view, const ReleaseEvent &event) override;
+        bool OnDrag(UIView &view, const DragEvent &event) override;
+        bool OnDragEnd(UIView &view, const DragEvent &event) override;
+
+        void SetMotionTypeId(int type);
+        int GetMotionType(void);
+        UIResourceTextId GetMotionTypeTextId(void);
+
+        void record_motion_recognition_log(void);
+
+    private:
+        MotionRecognitionViewEventListener();
+        ~MotionRecognitionViewEventListener();
+        MotionRecognitionViewEventListener(const MotionRecognitionViewEventListener &) = delete;
+        const MotionRecognitionViewEventListener &operator=(const MotionRecognitionViewEventListener &) = delete;
+        int motionTypeId;
+        bool X_DRAG_FLAG{false};
+    };
+
+}
+#endif
\ No newline at end of file
index 40d3277..5209523 100644 (file)
@@ -43,6 +43,8 @@
 #include "custom_save_runtime.h"
 #include "transmitting.h"
 #include "charge_notification.h"
+#include "motion_recognition_notification.h"
+
 
 #ifdef SUPPORT_POWER_MANAGER
 #include "power_display_service.h"
@@ -67,11 +69,14 @@ const PriorityMapper PRI_MAPPER[] = {
     {TOPIC_EVENT_HFP_PHONE_TO_WATCH, PRIORITY_ONE},
     {TOPIC_EVENT_DEVICE_BIND, PRIORITY_ONE},
     {TOPIC_EVENT_BLE_TRANSMIT,PRIORITY_ONE},
+    // #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION
     {TOPIC_EVENT_CHARGE_PLUG, PRIORITY_TWO},
     {TOPIC_EVENT_CHARGE_UNPLUG, PRIORITY_TWO},
     {TOPIC_EVENT_LOWPOWER_ALARM,PRIORITY_TWO},
-    // {TOPIC_EVENT_DEVICE_UNBIND, PRIORITY_TWO},
-    // {TOPIC_EVENT_DEVICE_UNBINDING_REQUEST, PRIORITY_TWO},
+    // #endif
+    // #ifdef SUPPORT_CYWEE_SERVICE
+    {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, PRIORITY_TWO},
+    // #endif
 
 };
 
@@ -107,9 +112,14 @@ void MsgCenterSubscribe()
     MsgCenterSubscribeTopic(TOPIC_EVENT_HFP_WATCH_TO_PHONE);
     MsgCenterSubscribeTopic(TOPIC_EVENT_DEVICE_BIND);
     MsgCenterSubscribeTopic(TOPIC_EVENT_BLE_TRANSMIT);
+    // #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION
     MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_PLUG);
     MsgCenterSubscribeTopic(TOPIC_EVENT_CHARGE_UNPLUG);
     MsgCenterSubscribeTopic(TOPIC_EVENT_LOWPOWER_ALARM);
+    // #endif
+    // #ifdef SUPPORT_CYWEE_SERVICE
+    MsgCenterSubscribeTopic(TOPIC_EVENT_AR_ALERT_TYPE_UPDATE);
+    // #endif
     
 }
 
@@ -167,6 +177,12 @@ static OHOS::UIViewGroup* showlowpowerNotify(void)
     return OHOS::lowPowerShow();
 }
 
+/*显示运动识别视图*/
+static OHOS::UIViewGroup* showMotionRecognitionNotify(void)
+{
+    return OHOS::CreateMotionRecognitionView();
+}
+
 void MsgCenterNotifyAlarmProc(const Topic topic, Request* req)
 {
     unused(req);
@@ -498,6 +514,25 @@ void MsgCenterNotifyLowPowerAlarmProc(const Topic topic, Request* req)
     // }
     #endif
 }
+
+/*运动识别*/
+void MsgCenterNotifyArAlertProc(const Topic topic, Request* req)
+{
+    uint8_t* motionType=(uint8_t*)req->data;
+    WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyArAlertProc,motionType = %d !",*motionType);
+    MotionRecognitionViewEventListener::GetInstance().record_motion_recognition_log();
+    if(*motionType > 5 || *motionType <1) //未知运动不弹窗
+    {
+        return;
+    }
+    if (CheckPriority(topic))
+    {
+        MotionRecognitionViewEventListener::GetInstance().SetMotionTypeId(*motionType);
+        NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO);
+        NotificationManager::GetInstance()->ShowNotify(showMotionRecognitionNotify, (uint16_t)topic, true);
+    }
+   
+}
 #endif
 
 /* 订阅事件通知逻辑可定制 */
@@ -512,9 +547,14 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = {
     {TOPIC_EVENT_HFP_PHONE_TO_WATCH, MsgCenterNotifyHfpWatchProc},
     {TOPIC_EVENT_BLE_TRANSMIT,       MsgCenterNotifybleTransmit},
     {TOPIC_EVENT_DEVICE_BIND,     MsgCenterNotifyDeviceBindProc},
+    // #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION
     {TOPIC_EVENT_CHARGE_PLUG,       MsgCenterNotifyChargePlugProc},
     {TOPIC_EVENT_CHARGE_UNPLUG,       MsgCenterNotifyChargeUnPlugProc},
     {TOPIC_EVENT_LOWPOWER_ALARM,       MsgCenterNotifyLowPowerAlarmProc},
+    // #endif
+    // #ifdef SUPPORT_CYWEE_SERVICE
+    {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE,       MsgCenterNotifyArAlertProc},
+    // #endif
     // {TOPIC_EVENT_DEVICE_UNBIND,   MsgCenterNotifyDeviceUnBindProc},   
     // {TOPIC_EVENT_DEVICE_UNBINDING_REQUEST,   MsgCenterNotifyDeviceUnBindingRequestProc},   
 
diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/motion_recognition_notification.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/motion_recognition_notification.cpp
new file mode 100644 (file)
index 0000000..9c83eef
--- /dev/null
@@ -0,0 +1,402 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-17 16:44:20
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-11-05 14:55:35
+ * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp
+ */
+#include "notification_manager.h"
+
+#include "notification_manager.h"
+#include "wearable_log.h"
+#include "components/ui_button.h"
+#include "components/ui_image_view.h"
+#include "components/ui_label_ext.h"
+#include "components/ui_scroll_view.h"
+#ifdef FD230
+#include "ui_resource_string.h"
+#endif
+#include <service/graphic_service.h>
+#include "ConfigModel.h"
+#include "traing/include/TraingModel.h"
+#include "uiservice/include/ui_service.h"
+#include "vibrator_service.h"
+#include "custom_runtime.h"
+#include "system/include/SystemLogModel.h"
+#include <custom_utils.h>
+#include "motion_recognition_notification.h"
+
+namespace OHOS
+{
+
+    UIViewGroup *MotionRecognitionGroupView{nullptr};
+    UIScrollView *MotionRecognitionScrollView{nullptr};
+    UIImageView *MotionRecognitionImage{nullptr};
+    UILabelExt *MotionRecognitionNoteLabel{nullptr};   // 运动识别note
+    UILabelExt *MotionRecognitionStartLabel{nullptr};  /*开始lable*/
+    UIButton *MotionRecognitionStartButton{nullptr};   /*开始button*/
+    UILabelExt *MotionRecognitionIgnoreLabel{nullptr}; /*忽略lable*/
+    UIButton *MotionRecognitionIgnoreButton{nullptr};  /*忽略button*/
+
+    static constexpr const int X_DRAG_OFFSET = 20;
+    static constexpr const int DOUBLES = 2;
+
+    static constexpr const char *MOTION_RECOGNITION_GROUPVIEWID = "motion_recognition_groupviewid";
+    static constexpr const char *MOTION_RECOGNITION_IGNORE_BUTTONVIEWID = "motion_recognition_ignore_buttonviewid";
+    static constexpr const char *MOTION_RECOGNITION_START_BUTTONVIEWID = "motion_recognition_start_buttonviewid";
+
+    MotionRecognitionViewEventListener::MotionRecognitionViewEventListener()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionViewEventListener::MotionRecognitionViewEventListener");
+    }
+
+    MotionRecognitionViewEventListener::~MotionRecognitionViewEventListener()
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionViewEventListener::~MotionRecognitionViewEventListener");
+    }
+
+    MotionRecognitionViewEventListener &MotionRecognitionViewEventListener::GetInstance()
+    {
+        static MotionRecognitionViewEventListener instance;
+        return instance;
+    }
+
+    bool MotionRecognitionViewEventListener::OnRelease(UIView &view, const ReleaseEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionViewEventListener::OnRelease");
+        UNUSED(event);
+        std::string viewId = view.GetViewId();
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "%s onclick", viewId.c_str());
+        if (viewId == MOTION_RECOGNITION_IGNORE_BUTTONVIEWID)
+        {
+            NotificationManager::GetInstance()->StopNotify();
+        }
+        else if (viewId == MOTION_RECOGNITION_START_BUTTONVIEWID) /*开始运动*/
+        {
+            /*关闭弹窗*/
+            NotificationManager::GetInstance()->StopNotify();
+            /*开始运动*/
+            UIResourceTextId sportId = GetMotionTypeTextId();
+            TraingModel::GetInstance()->set_sport_config(sportId);
+        }
+
+        return true;
+    }
+
+    bool MotionRecognitionViewEventListener::OnDrag(UIView &view, const DragEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionViewEventListener::OnDrag");
+        UNUSED(view);
+        if ((event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) // 拖动过程中判断是否是水平滑动
+        {
+            MotionRecognitionViewEventListener::X_DRAG_FLAG = true;
+        }
+        return true;
+    }
+
+    bool MotionRecognitionViewEventListener::OnDragEnd(UIView &view, const DragEvent &event)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionViewEventListener::OnDragEnd");
+        std::string viewId = view.GetViewId();
+        if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && MotionRecognitionViewEventListener::X_DRAG_FLAG)
+        {
+            if (viewId == MOTION_RECOGNITION_GROUPVIEWID)
+            {
+                NotificationManager::GetInstance()->StopNotify();
+            }
+            MotionRecognitionViewEventListener::X_DRAG_FLAG = false;
+        }
+        return true;
+    }
+
+    void MotionRecognitionViewEventListener::SetMotionTypeId(int type)
+    {
+        motionTypeId = type;
+    }
+
+    int MotionRecognitionViewEventListener::GetMotionType(void)
+    {
+        int motionType;
+        switch (motionTypeId)
+        {
+        case 1:
+            motionType = STR_MOTION_DETECTION_WALK_NOTE;
+            break;
+        case 2:
+            motionType = STR_MOTION_DETECTION_RUN_NOTE;
+            break;
+        case 3:
+            motionType = STR_MOTION_DETECTION_RIDE_NOTE;
+            break;
+        case 4:
+            motionType = STR_MOTION_DETECTION_ROWING_NOTE;
+            break;
+        case 5:
+            motionType = STR_MOTION_DETECTION_ELLIPTICAL_NOTE;
+            break;
+        }
+        return motionType;
+    }
+
+    UIResourceTextId MotionRecognitionViewEventListener::GetMotionTypeTextId(void)
+    {
+        UIResourceTextId motionTypeTextId;
+        switch (motionTypeId)
+        {
+        case 1:
+            motionTypeTextId = STR_EXERCISE_OUTDOORWALKING;
+            break;
+        case 2:
+            motionTypeTextId = STR_EXERCISE_OUTDOORRUNNING;
+            break;
+        case 3:
+            motionTypeTextId = STR_EXERCISE_OUTDOORBIKING;
+            break;
+        case 4:
+            motionTypeTextId = STR_EXERCISE_ROWINGMACHINE;
+            break;
+        case 5:
+            motionTypeTextId = STR_EXERCISE_ELLIPTICALTRAINER;
+            break;
+        }
+        return motionTypeTextId;
+    }
+
+    // 记录运动识别日志
+    void MotionRecognitionViewEventListener::record_motion_recognition_log(void)
+    {
+        // popup_windows_log_data systemlog;
+        // systemlog.timestamp = SystemLogModel::GetInstance()->GetCurrentTime();
+        // systemlog.type = popup_windows_type::MOTION_RECOGNITION;
+        // SystemLogModel::GetInstance()->save_popup_windows_log(systemlog);
+        uint8_t type =  0;
+        do_custom_fileoperate_service_check_msg(CUSTOM_FILEOPERATE_MSG_TYPE_POPUP_WINDOWS_DATA_LIST, &type, sizeof(type));
+    }
+
+    static std::string UpdateNoteLabelText(UILabelExt *&label, const std::string &newText, int id)
+    {
+        if (label == nullptr)
+        {
+            return nullptr;
+        }
+        /*取Id对应的字符串*/
+        UILabelExt *labelext = new UILabelExt();
+        labelext->SetTextId(id);
+        std::string text = labelext->GetText();
+
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UpdateLabel:%s->%s\r\n", text.c_str(), newText.c_str());
+
+        // 找到标志"XX"在字符串中的位置
+        size_t pos = text.find("XX");
+        if (pos != std::string::npos)
+        {
+            // 替换标志"XX"为更新字符串
+            text.replace(pos, 2, newText); // 2 是标志"XX"的长度
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "newText:%s\r\n", text.c_str());
+            label->SetText(text.c_str());
+        }
+        else
+        {
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "找不到变量标志位XX,请注意是否已经被修改!");
+        }
+
+        delete labelext;
+        return text;
+    }
+
+    /*创建运动识别视图*/
+    UIViewGroup *CreateMotionRecognitionView(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CreateMotionRecognitionView(void)");
+        if (MotionRecognitionGroupView == nullptr)
+        {
+            MotionRecognitionGroupView = new UIViewGroup();
+            if (MotionRecognitionGroupView == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMotionRecognitionView] MotionRecognitionGroupView new fail!!");
+                return nullptr;
+            }
+            MotionRecognitionGroupView->SetPosition(0, 0, 466, 466);
+            MotionRecognitionGroupView->SetViewId(MOTION_RECOGNITION_GROUPVIEWID);
+            MotionRecognitionGroupView->SetTouchable(true);
+            MotionRecognitionGroupView->SetDraggable(true);
+            UIView::OnDragListener *dragListener = static_cast<UIView::OnDragListener *>(&MotionRecognitionViewEventListener::GetInstance());
+            if (dragListener == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMotionRecognitionView] dragListener new fail!!");
+                return nullptr;
+            }
+            MotionRecognitionGroupView->SetOnDragListener(dragListener);
+            /* ----------------------- MotionRecognitionScrollView ---------------------- */
+            if (MotionRecognitionScrollView == nullptr)
+            {
+                MotionRecognitionScrollView = new UIScrollView();
+                if (MotionRecognitionScrollView == nullptr)
+                {
+                    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MotionRecognitionScrollView new fail");
+                    return nullptr;
+                }
+            }
+            MotionRecognitionScrollView->SetPosition(0, 0, 466, 466);
+            MotionRecognitionScrollView->SetScrollBlankSize(50);
+            MotionRecognitionScrollView->SetReboundSize(35);
+            MotionRecognitionScrollView->SetThrowDrag(true);
+            MotionRecognitionScrollView->SetMaxScrollDistance(1000);
+            MotionRecognitionScrollView->SetDirection(UIScrollView::VERTICAL);
+            /* --------------------------- MotionRecognitionImage --------------------------- */
+            MotionRecognitionImage = new UIImageView();
+            if (MotionRecognitionImage == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMotionRecognitionView] MotionRecognitionImage new fail!!");
+                return nullptr;
+            }
+            MotionRecognitionImage->SetPosition(173, 80, 120, 80);
+            MotionRecognitionImage->SetAutoEnable(false);
+            MotionRecognitionImage->SetResizeMode(UIImageView::CENTER);
+            MotionRecognitionImage->SetSrc("/user/res/MotionRecognition/MotionRecognition.bin");
+            /* ------------------------- MotionRecognitionNoteLabel ------------------------- */
+            MotionRecognitionNoteLabel = new UILabelExt();
+            if (MotionRecognitionNoteLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMotionRecognitionView] MotionRecognitionNoteLabel new fail!!");
+                return nullptr;
+            }
+            MotionRecognitionNoteLabel->SetPosition(53, 210, 360, 70);
+            MotionRecognitionNoteLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            MotionRecognitionNoteLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+#ifdef FD230
+            MotionRecognitionNoteLabel->SetTextId(MotionRecognitionViewEventListener::GetInstance().GetMotionType());
+#endif
+            MotionRecognitionNoteLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP);
+            MotionRecognitionNoteLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            MotionRecognitionNoteLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            /* ---------------------- MotionRecognitionIgnoreButton --------------------- */
+            if (MotionRecognitionIgnoreButton == nullptr)
+            {
+                MotionRecognitionIgnoreButton = new UIButton();
+            }
+            MotionRecognitionIgnoreButton->SetPosition(58, MotionRecognitionNoteLabel->GetY() + MotionRecognitionNoteLabel->GetHeight() + 40, 170, 90);
+            MotionRecognitionIgnoreButton->SetViewId(MOTION_RECOGNITION_IGNORE_BUTTONVIEWID);
+            MotionRecognitionIgnoreButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+            MotionRecognitionIgnoreButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff383838, UIButton::PRESSED);
+            MotionRecognitionIgnoreButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            UIView::OnTouchListener *TouchListener1 = static_cast<UIView::OnTouchListener *>(&MotionRecognitionViewEventListener::GetInstance());
+            if (TouchListener1 == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMotionRecognitionView] TouchListener1 new fail!!");
+                return nullptr;
+            }
+            MotionRecognitionIgnoreButton->SetOnTouchListener(TouchListener1);
+            /* ---------------------- MotionRecognitionIgnoreLabel ---------------------- */
+            MotionRecognitionIgnoreLabel = new UILabelExt();
+            if (MotionRecognitionIgnoreLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMotionRecognitionView] MotionRecognitionIgnoreLabel new fail!!");
+                return nullptr;
+            }
+            MotionRecognitionIgnoreLabel->SetPosition(93, MotionRecognitionIgnoreButton->GetY() + 30, 100, 30);
+            MotionRecognitionIgnoreLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            MotionRecognitionIgnoreLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+#ifdef FD230
+            MotionRecognitionIgnoreLabel->SetTextId(STR_IGNORE);
+#endif
+            MotionRecognitionIgnoreLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            MotionRecognitionIgnoreLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            MotionRecognitionIgnoreLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+            /* ---------------------- MotionRecognitionStartButton --------------------- */
+            if (MotionRecognitionStartButton == nullptr)
+            {
+                MotionRecognitionStartButton = new UIButton();
+            }
+            MotionRecognitionStartButton->SetPosition(238, MotionRecognitionNoteLabel->GetY() + MotionRecognitionNoteLabel->GetHeight() + 40, 170, 90);
+            MotionRecognitionStartButton->SetViewId(MOTION_RECOGNITION_START_BUTTONVIEWID);
+            MotionRecognitionStartButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c);
+            MotionRecognitionStartButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff383838, UIButton::PRESSED);
+            MotionRecognitionStartButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+            UIView::OnTouchListener *TouchListener2 = static_cast<UIView::OnTouchListener *>(&MotionRecognitionViewEventListener::GetInstance());
+            if (TouchListener2 == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMotionRecognitionView] TouchListener2 new fail!!");
+                return nullptr;
+            }
+            MotionRecognitionStartButton->SetOnTouchListener(TouchListener2);
+            /* ---------------------- MotionRecognitionStartLabel ---------------------- */
+            MotionRecognitionStartLabel = new UILabelExt();
+            if (MotionRecognitionStartLabel == nullptr)
+            {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CreateMotionRecognitionView] MotionRecognitionStartLabel new fail!!");
+                return nullptr;
+            }
+            MotionRecognitionStartLabel->SetPosition(273, MotionRecognitionStartButton->GetY() + 30, 100, 30);
+            MotionRecognitionStartLabel->SetStyle(STYLE_TEXT_FONT, 30);
+            MotionRecognitionStartLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+#ifdef FD230
+            MotionRecognitionStartLabel->SetTextId(STR_START);
+#endif
+            MotionRecognitionStartLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+            MotionRecognitionStartLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+            MotionRecognitionStartLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Create MotionRecognitionView succeed!!");
+            /* ----------------------------------- Add ---------------------------------- */
+            MotionRecognitionScrollView->Add(MotionRecognitionImage);
+            MotionRecognitionScrollView->Add(MotionRecognitionNoteLabel);
+            MotionRecognitionScrollView->Add(MotionRecognitionStartButton);
+            MotionRecognitionScrollView->Add(MotionRecognitionStartLabel);
+            MotionRecognitionScrollView->Add(MotionRecognitionIgnoreButton);
+            MotionRecognitionScrollView->Add(MotionRecognitionIgnoreLabel);
+            MotionRecognitionGroupView->Add(MotionRecognitionScrollView);
+        }
+        /* -------------------------------------------------------------------------- */
+        ScreenTurnOn(10 * 1000); // 显示时长10s
+        // 震动一次
+        if (true != OHOS::ConfigModel::GetInstance()->GetDnotdisturb() && (!uapi_sleep_mode_flag_get()))
+        {
+            ui_api_vibrate_once_func();
+        }
+        /* -------------------------------------------------------------------------- */
+        NotificationManager::GetInstance()->RegisterNotifyCleanupFunction(FreeMotionRecognitionView);
+        return MotionRecognitionGroupView;
+    }
+
+    /*释放运动识别视图*/
+    void FreeMotionRecognitionView(void)
+    {
+        WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FreeMotionRecognitionView(void)");
+        if (MotionRecognitionGroupView != nullptr)
+        {
+            MotionRecognitionGroupView->RemoveAll();
+            if (MotionRecognitionScrollView != nullptr)
+            {
+                MotionRecognitionScrollView->RemoveAll();
+                delete MotionRecognitionImage;
+                MotionRecognitionImage = nullptr;
+
+                delete MotionRecognitionNoteLabel;
+                MotionRecognitionNoteLabel = nullptr;
+
+                delete MotionRecognitionStartLabel;
+                MotionRecognitionStartLabel = nullptr;
+
+                delete MotionRecognitionStartButton;
+                MotionRecognitionStartButton = nullptr;
+
+                delete MotionRecognitionIgnoreLabel;
+                MotionRecognitionIgnoreLabel = nullptr;
+
+                delete MotionRecognitionIgnoreButton;
+                MotionRecognitionIgnoreButton = nullptr;
+
+                delete MotionRecognitionScrollView;
+                MotionRecognitionScrollView = nullptr;
+            }
+            RootView::GetInstance()->Remove(MotionRecognitionGroupView);
+            delete MotionRecognitionGroupView;
+            MotionRecognitionGroupView = nullptr;
+            WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Free MotionRecognitionView succeed!!");
+            ScreenTurnOff();
+        }
+        return;
+    }
+
+}
\ No newline at end of file