添加运动识别弹窗 718/1
authorluozheng <1732036298@qq.com>
Mon, 19 Aug 2024 02:09:23 +0000 (10:09 +0800)
committerluozheng <1732036298@qq.com>
Mon, 19 Aug 2024 02:09:23 +0000 (10:09 +0800)
16 files changed:
code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h
code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h [new file with mode: 0644]
code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/MotionRecognition/MotionRecognition.bin [new file with mode: 0644]
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/ui_resource_string.h
code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang
tools/language_tool/Language_xml/input_list_en.txt
tools/language_tool/Language_xml/input_list_zh.txt
tools/language_tool/Language_xml/language_en.xml
tools/language_tool/Language_xml/language_zh.xml
tools/language_tool/font/en.lang
tools/language_tool/font/ui_resource_string.h
tools/language_tool/font/zh.lang

index 28b6856..7592312 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
@@ -502,32 +502,38 @@ enum UIResourceTextId : uint16_t {
     STR_CONNECTING = 489,\r
     STR_CONNECTION_FAIL = 490,\r
     STR_PTALORTM = 491,\r
-    STR_MOTION_DETECTION_NOTE = 492,\r
-    STR_PE4GC = 493,\r
-    STR_OBU_MESSAGE = 494,\r
-    STR_DELETE = 495,\r
-    STR_CHARGE = 496,\r
-    STR_CHARGE_NOTE = 497,\r
-    STR_STEP_FREQUENCY = 498,\r
-    STR_STEP_LENGTH = 499,\r
-    STR_AVG_PACE = 500,\r
-    STR_TONGYI_QIANWEN = 501,\r
-    STR_IFLYTEK_SPARK = 502,\r
-    STR_DISTURBNOTE_OFF = 503,\r
-    STR_4G_NOTE = 504,\r
-    STR_MUSIC_PLAYER_SOURCE_NOTE = 505,\r
-    STR_MUSIC_LIST_IS_EMPTY = 506,\r
-    STR_BT_HEADSET_RESCAN = 507,\r
-    STR_BT_HEADSET_NOFOND = 508,\r
-    STR_SCHEDULE = 509,\r
-    STR_SCHEDULE_TITLE = 510,\r
-    STR_SCHEDULE_NO_DATA = 511,\r
-    STR_SCHEDULE_NO_DATA_PROMPT = 512,\r
-    STR_NO_PAIRED_DEV = 513,\r
-    STR_MAX_ID = 514,\r
+    STR_MOTION_DETECTION_WALK_NOTE = 492,\r
+    STR_MOTION_DETECTION_RUN_NOTE = 493,\r
+    STR_MOTION_DETECTION_RIDE_NOTE = 494,\r
+    STR_MOTION_DETECTION_ROWING_NOTE = 495,\r
+    STR_MOTION_DETECTION_ELLIPTICAL_NOTE = 496,\r
+    STR_PE4GC = 497,\r
+    STR_OBU_MESSAGE = 498,\r
+    STR_DELETE = 499,\r
+    STR_CHARGE = 500,\r
+    STR_CHARGE_NOTE = 501,\r
+    STR_STEP_FREQUENCY = 502,\r
+    STR_STEP_LENGTH = 503,\r
+    STR_AVG_PACE = 504,\r
+    STR_TONGYI_QIANWEN = 505,\r
+    STR_IFLYTEK_SPARK = 506,\r
+    STR_DISTURBNOTE_OFF = 507,\r
+    STR_4G_NOTE = 508,\r
+    STR_MUSIC_PLAYER_SOURCE_NOTE = 509,\r
+    STR_MUSIC_LIST_IS_EMPTY = 510,\r
+    STR_BT_HEADSET_RESCAN = 511,\r
+    STR_BT_HEADSET_NOFOND = 512,\r
+    STR_SCHEDULE = 513,\r
+    STR_SCHEDULE_TITLE = 514,\r
+    STR_SCHEDULE_NO_DATA = 515,\r
+    STR_SCHEDULE_NO_DATA_PROMPT = 516,\r
+    STR_NO_PAIRED_DEV = 517,\r
+    STR_IGNORE = 518,\r
+    STR_START = 519,\r
+    STR_MAX_ID = 520,\r
 }; // UIResourceTextId\r
-\r
-enum FontLanguageId : uint8_t {\r
+
+enum FontLanguageId : uint8_t {
     LANGUAGE_ID_EN,\r
     LANGUAGE_ID_ZH,\r
     LANGUAGE_ID_MAX\r
diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h
new file mode 100644 (file)
index 0000000..f435425
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-17 16:43:46
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-19 09:31:47
+ * @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_
+/*运动识别*/
+
+#include "BaseView.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);
+
+    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 700240c..17c2487 100644 (file)
@@ -32,6 +32,7 @@
 #include "sedentaryReminder_notification.h"
 #include "message_notification.h"
 #include "sleep_notification.h"
+#include "motion_recognition_notification.h"
 
 constexpr uint16_t HALF_SCREEN = 2;
 constexpr int16_t NOTIFY_PRIORITY_DEFAULT = 4;
index b386586..8356dbf 100644 (file)
@@ -270,6 +270,11 @@ static OHOS::UIViewGroup* showSedentaryReminderNotify(void)
     return OHOS::CreateSedentaryReminderView();
 }
 
+/*显示运动识别视图*/
+static OHOS::UIViewGroup* showMotionRecognitionNotify(void)
+{
+    return OHOS::CreateMotionRecognitionView();
+}
 
 /*显示传输中*/
 static OHOS::UIViewGroup* showtransmitNotify(void)
@@ -1110,11 +1115,22 @@ void MsgCenterNotifyActivityExtraInfoProc(const Topic topic, Request* req)
 {
     unused(topic);
 }
-
+/*运动识别*/
 void MsgCenterNotifyArAlertProc(const Topic topic, Request* req)
 {
-    unused(topic);
-    NotificationManager::GetInstance()->ShowNotify(showSedentaryReminderNotify, (uint16_t)topic, true);
+    uint8_t* motionType=(uint8_t*)req->data;
+    WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyArAlertProc,motionType = %d !",*motionType);
+    if(*motionType == 0) //未知运动不弹窗
+    {
+        return;
+    }
+    const power_display_svr_api_t *display_api = power_display_svr_get_api();
+    if (display_api->get_screen_state() != SCREEN_ON)
+    {
+        display_api->turn_on_screen();
+    }
+    MotionRecognitionViewEventListener::GetInstance().SetMotionTypeId(*motionType);
+    NotificationManager::GetInstance()->ShowNotify(showMotionRecognitionNotify, (uint16_t)topic, true);
 }
 
 void MsgCenterNotifyInactivityProc(const Topic topic, Request *req)
diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp
new file mode 100644 (file)
index 0000000..65176b9
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ * @Author: luozheng 1732036298@qq.com
+ * @Date: 2024-08-17 16:44:20
+ * @LastEditors: luozheng 1732036298@qq.com
+ * @LastEditTime: 2024-08-19 10:08:12
+ * @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"
+
+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_LOGE(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();
+        }
+
+        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_ROWING_NOTE;
+            break;
+        default:
+            motionType = STR_MOTION_DETECTION_WALK_NOTE;
+            break;
+        }
+        return motionType;
+    }
+
+    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_LOGE(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_LOGE(WEARABLE_LOG_MODULE_APP, "newText:%s\r\n", text.c_str());
+            label->SetText(text.c_str());
+        }
+        else
+        {
+            WEARABLE_LOGE(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_IGNORE_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);
+        }
+        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_LOGE(WEARABLE_LOG_MODULE_APP, "Free MotionRecognitionView succeed!!");
+        }
+        return;
+    }
+
+}
\ No newline at end of file
diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/MotionRecognition/MotionRecognition.bin b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/MotionRecognition/MotionRecognition.bin
new file mode 100644 (file)
index 0000000..ab4cf3d
--- /dev/null
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:47a4b68bf6536074fda984a91ba28711546580ccae1314ad81fbf8864bf5425d
+size 6424
index 66f231f..f39fe48 100644 (file)
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang differ
index 97f22d9..7592312 100644 (file)
@@ -502,29 +502,35 @@ enum UIResourceTextId : uint16_t {
     STR_CONNECTING = 489,\r
     STR_CONNECTION_FAIL = 490,\r
     STR_PTALORTM = 491,\r
-    STR_MOTION_DETECTION_NOTE = 492,\r
-    STR_PE4GC = 493,\r
-    STR_OBU_MESSAGE = 494,\r
-    STR_DELETE = 495,\r
-    STR_CHARGE = 496,\r
-    STR_CHARGE_NOTE = 497,\r
-    STR_STEP_FREQUENCY = 498,\r
-    STR_STEP_LENGTH = 499,\r
-    STR_AVG_PACE = 500,\r
-    STR_TONGYI_QIANWEN = 501,\r
-    STR_IFLYTEK_SPARK = 502,\r
-    STR_DISTURBNOTE_OFF = 503,\r
-    STR_4G_NOTE = 504,\r
-    STR_MUSIC_PLAYER_SOURCE_NOTE = 505,\r
-    STR_MUSIC_LIST_IS_EMPTY = 506,\r
-    STR_BT_HEADSET_RESCAN = 507,\r
-    STR_BT_HEADSET_NOFOND = 508,\r
-    STR_SCHEDULE = 509,\r
-    STR_SCHEDULE_TITLE = 510,\r
-    STR_SCHEDULE_NO_DATA = 511,\r
-    STR_SCHEDULE_NO_DATA_PROMPT = 512,\r
-    STR_NO_PAIRED_DEV = 513,\r
-    STR_MAX_ID = 514,\r
+    STR_MOTION_DETECTION_WALK_NOTE = 492,\r
+    STR_MOTION_DETECTION_RUN_NOTE = 493,\r
+    STR_MOTION_DETECTION_RIDE_NOTE = 494,\r
+    STR_MOTION_DETECTION_ROWING_NOTE = 495,\r
+    STR_MOTION_DETECTION_ELLIPTICAL_NOTE = 496,\r
+    STR_PE4GC = 497,\r
+    STR_OBU_MESSAGE = 498,\r
+    STR_DELETE = 499,\r
+    STR_CHARGE = 500,\r
+    STR_CHARGE_NOTE = 501,\r
+    STR_STEP_FREQUENCY = 502,\r
+    STR_STEP_LENGTH = 503,\r
+    STR_AVG_PACE = 504,\r
+    STR_TONGYI_QIANWEN = 505,\r
+    STR_IFLYTEK_SPARK = 506,\r
+    STR_DISTURBNOTE_OFF = 507,\r
+    STR_4G_NOTE = 508,\r
+    STR_MUSIC_PLAYER_SOURCE_NOTE = 509,\r
+    STR_MUSIC_LIST_IS_EMPTY = 510,\r
+    STR_BT_HEADSET_RESCAN = 511,\r
+    STR_BT_HEADSET_NOFOND = 512,\r
+    STR_SCHEDULE = 513,\r
+    STR_SCHEDULE_TITLE = 514,\r
+    STR_SCHEDULE_NO_DATA = 515,\r
+    STR_SCHEDULE_NO_DATA_PROMPT = 516,\r
+    STR_NO_PAIRED_DEV = 517,\r
+    STR_IGNORE = 518,\r
+    STR_START = 519,\r
+    STR_MAX_ID = 520,\r
 }; // UIResourceTextId\r
 
 enum FontLanguageId : uint8_t {
index 0ce38bd..2567714 100644 (file)
Binary files a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang and b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/zh.lang differ
index 39284ff..0d48cac 100644 (file)
@@ -490,7 +490,11 @@ STR_DYWTDAK$Do you want to delete API keys
 STR_CONNECTING$Connecting\r
 STR_CONNECTION_FAIL$Connection fail\r
 STR_PTALORTM$Please try again later or replace the model\r
-STR_MOTION_DETECTION_NOTE$It seems that you are performing XX movement, whether to start recording\r
+STR_MOTION_DETECTION_WALK_NOTE$Detect that you seem to be walking, whether to start recording\r
+STR_MOTION_DETECTION_RUN_NOTE$Detect that you seem to be running, whether to start recording\r
+STR_MOTION_DETECTION_RIDE_NOTE$Detect that you seem to be cycling, whether to start recording\r
+STR_MOTION_DETECTION_ROWING_NOTE$Detected that you appear to be rowing machine, whether to start recording\r
+STR_MOTION_DETECTION_ELLIPTICAL_NOTE$Detected that you appear to be on the elliptical machine, whether to start recording\r
 STR_PE4GC$Please enable 4G capability\r
 STR_OBU_MESSAGE$OBU\r
 STR_DELETE$Delete\r
@@ -511,4 +515,6 @@ STR_SCHEDULE$Schedule
 STR_SCHEDULE_TITLE$Schedule management\r
 STR_SCHEDULE_NO_DATA$No schedules\r
 STR_SCHEDULE_NO_DATA_PROMPT$Please sync with the APP\r
-STR_NO_PAIRED_DEV$No paired devices are available
\ No newline at end of file
+STR_NO_PAIRED_DEV$No paired devices are available\r
+STR_IGNORE$Ignore\r
+STR_START$Start
\ No newline at end of file
index 6117346..3ab2aa5 100644 (file)
@@ -490,7 +490,11 @@ STR_DYWTDAK$是否确认删除API keys
 STR_CONNECTING$正在连接\r
 STR_CONNECTION_FAIL$连接失败\r
 STR_PTALORTM$请稍后再重试或更换模型\r
-STR_MOTION_DETECTION_NOTE$检测到您好像在进行XX运动,是否开始记录\r
+STR_MOTION_DETECTION_WALK_NOTE$检测到您好像在进行走路,是否开始记录\r
+STR_MOTION_DETECTION_RUN_NOTE$检测到您好像在进行跑步,是否开始记录\r
+STR_MOTION_DETECTION_RIDE_NOTE$检测到您好像在进行骑车,是否开始记录\r
+STR_MOTION_DETECTION_ROWING_NOTE$检测到您好像在进行划船机,是否开始记录\r
+STR_MOTION_DETECTION_ELLIPTICAL_NOTE$检测到您好像在进行椭圆机,是否开始记录\r
 STR_PE4GC$请开启4G能力\r
 STR_OBU_MESSAGE$OBU\r
 STR_DELETE$删除\r
@@ -511,4 +515,6 @@ STR_SCHEDULE$日程
 STR_SCHEDULE_TITLE$日程管理\r
 STR_SCHEDULE_NO_DATA$当前无日程\r
 STR_SCHEDULE_NO_DATA_PROMPT$请先通过APP同步\r
-STR_NO_PAIRED_DEV$暂无已配对设备
\ No newline at end of file
+STR_NO_PAIRED_DEV$暂无已配对设备\r
+STR_IGNORE$忽略\r
+STR_START$开始
\ No newline at end of file
index ad593d5..ed0897d 100644 (file)
        <lanstr id="STR_CONNECTING" value="Connecting"/>
        <lanstr id="STR_CONNECTION_FAIL" value="Connection fail"/>
        <lanstr id="STR_PTALORTM" value="Please try again later or replace the model"/>
-       <lanstr id="STR_MOTION_DETECTION_NOTE" value="It seems that you are performing XX movement, whether to start recording"/>
+       <lanstr id="STR_MOTION_DETECTION_WALK_NOTE" value="Detect that you seem to be walking, whether to start recording"/>
+       <lanstr id="STR_MOTION_DETECTION_RUN_NOTE" value="Detect that you seem to be running, whether to start recording"/>
+       <lanstr id="STR_MOTION_DETECTION_RIDE_NOTE" value="Detect that you seem to be cycling, whether to start recording"/>
+       <lanstr id="STR_MOTION_DETECTION_ROWING_NOTE" value="Detected that you appear to be rowing machine, whether to start recording"/>
+       <lanstr id="STR_MOTION_DETECTION_ELLIPTICAL_NOTE" value="Detected that you appear to be on the elliptical machine, whether to start recording"/>
        <lanstr id="STR_PE4GC" value="Please enable 4G capability"/>
        <lanstr id="STR_OBU_MESSAGE" value="OBU"/>
        <lanstr id="STR_DELETE" value="Delete"/>
        <lanstr id="STR_SCHEDULE_NO_DATA" value="No schedules"/>
        <lanstr id="STR_SCHEDULE_NO_DATA_PROMPT" value="Please sync with the APP"/>
        <lanstr id="STR_NO_PAIRED_DEV" value="No paired devices are available"/>
+       <lanstr id="STR_IGNORE" value="Ignore"/>
+       <lanstr id="STR_START" value="Start"/>
 </language>
index f40d499..14b3f09 100644 (file)
        <lanstr id="STR_CONNECTING" value="正在连接"/>
        <lanstr id="STR_CONNECTION_FAIL" value="连接失败"/>
        <lanstr id="STR_PTALORTM" value="请稍后再重试或更换模型"/>
-       <lanstr id="STR_MOTION_DETECTION_NOTE" value="检测到您好像在进行XX运动,是否开始记录"/>
+       <lanstr id="STR_MOTION_DETECTION_WALK_NOTE" value="检测到您好像在进行走路,是否开始记录"/>
+       <lanstr id="STR_MOTION_DETECTION_RUN_NOTE" value="检测到您好像在进行跑步,是否开始记录"/>
+       <lanstr id="STR_MOTION_DETECTION_RIDE_NOTE" value="检测到您好像在进行骑车,是否开始记录"/>
+       <lanstr id="STR_MOTION_DETECTION_ROWING_NOTE" value="检测到您好像在进行划船机,是否开始记录"/>
+       <lanstr id="STR_MOTION_DETECTION_ELLIPTICAL_NOTE" value="检测到您好像在进行椭圆机,是否开始记录"/>
        <lanstr id="STR_PE4GC" value="请开启4G能力"/>
        <lanstr id="STR_OBU_MESSAGE" value="OBU"/>
        <lanstr id="STR_DELETE" value="删除"/>
        <lanstr id="STR_SCHEDULE_NO_DATA" value="当前无日程"/>
        <lanstr id="STR_SCHEDULE_NO_DATA_PROMPT" value="请先通过APP同步"/>
        <lanstr id="STR_NO_PAIRED_DEV" value="暂无已配对设备"/>
+       <lanstr id="STR_IGNORE" value="忽略"/>
+       <lanstr id="STR_START" value="开始"/>
 </language>
index 66f231f..f39fe48 100644 (file)
Binary files a/tools/language_tool/font/en.lang and b/tools/language_tool/font/en.lang differ
index 97f22d9..7592312 100644 (file)
@@ -502,29 +502,35 @@ enum UIResourceTextId : uint16_t {
     STR_CONNECTING = 489,\r
     STR_CONNECTION_FAIL = 490,\r
     STR_PTALORTM = 491,\r
-    STR_MOTION_DETECTION_NOTE = 492,\r
-    STR_PE4GC = 493,\r
-    STR_OBU_MESSAGE = 494,\r
-    STR_DELETE = 495,\r
-    STR_CHARGE = 496,\r
-    STR_CHARGE_NOTE = 497,\r
-    STR_STEP_FREQUENCY = 498,\r
-    STR_STEP_LENGTH = 499,\r
-    STR_AVG_PACE = 500,\r
-    STR_TONGYI_QIANWEN = 501,\r
-    STR_IFLYTEK_SPARK = 502,\r
-    STR_DISTURBNOTE_OFF = 503,\r
-    STR_4G_NOTE = 504,\r
-    STR_MUSIC_PLAYER_SOURCE_NOTE = 505,\r
-    STR_MUSIC_LIST_IS_EMPTY = 506,\r
-    STR_BT_HEADSET_RESCAN = 507,\r
-    STR_BT_HEADSET_NOFOND = 508,\r
-    STR_SCHEDULE = 509,\r
-    STR_SCHEDULE_TITLE = 510,\r
-    STR_SCHEDULE_NO_DATA = 511,\r
-    STR_SCHEDULE_NO_DATA_PROMPT = 512,\r
-    STR_NO_PAIRED_DEV = 513,\r
-    STR_MAX_ID = 514,\r
+    STR_MOTION_DETECTION_WALK_NOTE = 492,\r
+    STR_MOTION_DETECTION_RUN_NOTE = 493,\r
+    STR_MOTION_DETECTION_RIDE_NOTE = 494,\r
+    STR_MOTION_DETECTION_ROWING_NOTE = 495,\r
+    STR_MOTION_DETECTION_ELLIPTICAL_NOTE = 496,\r
+    STR_PE4GC = 497,\r
+    STR_OBU_MESSAGE = 498,\r
+    STR_DELETE = 499,\r
+    STR_CHARGE = 500,\r
+    STR_CHARGE_NOTE = 501,\r
+    STR_STEP_FREQUENCY = 502,\r
+    STR_STEP_LENGTH = 503,\r
+    STR_AVG_PACE = 504,\r
+    STR_TONGYI_QIANWEN = 505,\r
+    STR_IFLYTEK_SPARK = 506,\r
+    STR_DISTURBNOTE_OFF = 507,\r
+    STR_4G_NOTE = 508,\r
+    STR_MUSIC_PLAYER_SOURCE_NOTE = 509,\r
+    STR_MUSIC_LIST_IS_EMPTY = 510,\r
+    STR_BT_HEADSET_RESCAN = 511,\r
+    STR_BT_HEADSET_NOFOND = 512,\r
+    STR_SCHEDULE = 513,\r
+    STR_SCHEDULE_TITLE = 514,\r
+    STR_SCHEDULE_NO_DATA = 515,\r
+    STR_SCHEDULE_NO_DATA_PROMPT = 516,\r
+    STR_NO_PAIRED_DEV = 517,\r
+    STR_IGNORE = 518,\r
+    STR_START = 519,\r
+    STR_MAX_ID = 520,\r
 }; // UIResourceTextId\r
 
 enum FontLanguageId : uint8_t {
index 0ce38bd..2567714 100644 (file)
Binary files a/tools/language_tool/font/zh.lang and b/tools/language_tool/font/zh.lang differ