From 2ac80e742c5113a00426904f7262da5b74f69fce Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Mon, 19 Aug 2024 10:09:23 +0800 Subject: [PATCH] =?utf8?q?=E6=B7=BB=E5=8A=A0=E8=BF=90=E5=8A=A8=E8=AF=86?= =?utf8?q?=E5=88=AB=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../include/ui_resource_string.h | 80 ++-- .../notify/motion_recognition_notification.h | 40 ++ .../include/notify/notification_manager.h | 1 + .../msg_center/src/msg_center_customer.cpp | 22 +- .../motion_recognition_notification.cpp | 351 ++++++++++++++++++ .../MotionRecognition/MotionRecognition.bin | 3 + .../fd230/fs/user/res/font/en.lang | Bin 11114 -> 11426 bytes .../fs/user/res/font/ui_resource_string.h | 52 +-- .../fd230/fs/user/res/font/zh.lang | Bin 10028 -> 10290 bytes .../Language_xml/input_list_en.txt | 10 +- .../Language_xml/input_list_zh.txt | 10 +- .../Language_xml/language_en.xml | 8 +- .../Language_xml/language_zh.xml | 8 +- tools/language_tool/font/en.lang | Bin 11114 -> 11426 bytes tools/language_tool/font/ui_resource_string.h | 52 +-- tools/language_tool/font/zh.lang | Bin 10028 -> 10290 bytes 16 files changed, 545 insertions(+), 92 deletions(-) create mode 100644 code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h create mode 100644 code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp create mode 100644 code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/MotionRecognition/MotionRecognition.bin diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h index 28b685610..75923127f 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/ui_resource_string.h @@ -1,15 +1,15 @@ -/* -* 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 -namespace OHOS { -enum UIResourceTextId : uint16_t { +/* +* 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 +namespace OHOS { +enum UIResourceTextId : uint16_t { STR_EXERCISE_OUTDOORWALKING = 0, STR_EXERCISE_OUTDOORRUNNING = 1, STR_EXERCISE_OUTDOORBIKING = 2, @@ -502,32 +502,38 @@ enum UIResourceTextId : uint16_t { STR_CONNECTING = 489, STR_CONNECTION_FAIL = 490, STR_PTALORTM = 491, - STR_MOTION_DETECTION_NOTE = 492, - STR_PE4GC = 493, - STR_OBU_MESSAGE = 494, - STR_DELETE = 495, - STR_CHARGE = 496, - STR_CHARGE_NOTE = 497, - STR_STEP_FREQUENCY = 498, - STR_STEP_LENGTH = 499, - STR_AVG_PACE = 500, - STR_TONGYI_QIANWEN = 501, - STR_IFLYTEK_SPARK = 502, - STR_DISTURBNOTE_OFF = 503, - STR_4G_NOTE = 504, - STR_MUSIC_PLAYER_SOURCE_NOTE = 505, - STR_MUSIC_LIST_IS_EMPTY = 506, - STR_BT_HEADSET_RESCAN = 507, - STR_BT_HEADSET_NOFOND = 508, - STR_SCHEDULE = 509, - STR_SCHEDULE_TITLE = 510, - STR_SCHEDULE_NO_DATA = 511, - STR_SCHEDULE_NO_DATA_PROMPT = 512, - STR_NO_PAIRED_DEV = 513, - STR_MAX_ID = 514, + STR_MOTION_DETECTION_WALK_NOTE = 492, + STR_MOTION_DETECTION_RUN_NOTE = 493, + STR_MOTION_DETECTION_RIDE_NOTE = 494, + STR_MOTION_DETECTION_ROWING_NOTE = 495, + STR_MOTION_DETECTION_ELLIPTICAL_NOTE = 496, + STR_PE4GC = 497, + STR_OBU_MESSAGE = 498, + STR_DELETE = 499, + STR_CHARGE = 500, + STR_CHARGE_NOTE = 501, + STR_STEP_FREQUENCY = 502, + STR_STEP_LENGTH = 503, + STR_AVG_PACE = 504, + STR_TONGYI_QIANWEN = 505, + STR_IFLYTEK_SPARK = 506, + STR_DISTURBNOTE_OFF = 507, + STR_4G_NOTE = 508, + STR_MUSIC_PLAYER_SOURCE_NOTE = 509, + STR_MUSIC_LIST_IS_EMPTY = 510, + STR_BT_HEADSET_RESCAN = 511, + STR_BT_HEADSET_NOFOND = 512, + STR_SCHEDULE = 513, + STR_SCHEDULE_TITLE = 514, + STR_SCHEDULE_NO_DATA = 515, + STR_SCHEDULE_NO_DATA_PROMPT = 516, + STR_NO_PAIRED_DEV = 517, + STR_IGNORE = 518, + STR_START = 519, + STR_MAX_ID = 520, }; // UIResourceTextId - -enum FontLanguageId : uint8_t { + +enum FontLanguageId : uint8_t { LANGUAGE_ID_EN, LANGUAGE_ID_ZH, LANGUAGE_ID_MAX 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 index 000000000..f43542591 --- /dev/null +++ b/code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h @@ -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 diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h b/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h index 700240cec..17c24876c 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h @@ -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; diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index b3865869d..8356dbfee 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -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 index 000000000..65176b9ff --- /dev/null +++ b/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp @@ -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 +#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(&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(&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(&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 index 000000000..ab4cf3dcb --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/MotionRecognition/MotionRecognition.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47a4b68bf6536074fda984a91ba28711546580ccae1314ad81fbf8864bf5425d +size 6424 diff --git a/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang b/code/sdk/build/config/target_config/brandy/mk_fs_image/fd230/fs/user/res/font/en.lang index 66f231f04000194402491d42edfc3a5a24c5a869..f39fe487aefb790d1f86bad6ac1d56b16a6d1855 100644 GIT binary patch delta 385 zcmaDAwkT3G)8F<`Y90d$;Mgd-l|5^p0t3TeAhuCtU}yv4+d%vsh<^hylM(|1HxQcu zu|E(e0dYPM*8y=i5N`uwb!8wMh|d7=Wgz|o#H=a|43a>s2E_J291p~4Dw}0E8WogW zQcF^kOB6~n5=#^+^Gg+qQ&V#lO7azwQWeS*bFwq@(kGwPkj1C0s5CE+2xZBY$vIGE zx)4iKQxMiB78Il=7C|j8$}b11RLD(C&dAJ51=(*wKu3Na(5O^})SR5mf|AVS#2lFB Y%_lV$GVyw*=j9irG6a_-7L_mn09D#?XaE2J delta 172 zcmZ1!`6^6w-=eR(Qu7#40Mka%t?WT36c`wu0PzbTehU1maIX%%;r1APmGh%9~9%8WnUrOB9MzQ*(p(tJQ;{D1F^L{149lFR|4@oAYKZ@n}GNb5Z?gecR>7AezOe6Z5g%~ zTQ|JezJBt56|u>8RHWHnY@hgS?NT`R<*JD<_AY~QIiGe+deO1-*_>T)k!MTRKAqDB b6xsY=MVE>1>HfXXr!Hl9x~Jjk@@@tIK%-Cw delta 132 zcmdlKu*Oex^QQ+wRT&H@fN7)XR`#IpG7JoyvJ4EoKr8~pia_iG#PL9!1;ph*+ycZC zfp{|ze+J@cIR=IvAf5@t`+)c;5MKh~M?m~TZnFu;Z5fV;h!^`OJndSs`Matv69BEK B9qRx9 diff --git a/tools/language_tool/Language_xml/input_list_en.txt b/tools/language_tool/Language_xml/input_list_en.txt index 39284ff72..0d48cace9 100644 --- a/tools/language_tool/Language_xml/input_list_en.txt +++ b/tools/language_tool/Language_xml/input_list_en.txt @@ -490,7 +490,11 @@ STR_DYWTDAK$Do you want to delete API keys STR_CONNECTING$Connecting STR_CONNECTION_FAIL$Connection fail STR_PTALORTM$Please try again later or replace the model -STR_MOTION_DETECTION_NOTE$It seems that you are performing XX movement, whether to start recording +STR_MOTION_DETECTION_WALK_NOTE$Detect that you seem to be walking, whether to start recording +STR_MOTION_DETECTION_RUN_NOTE$Detect that you seem to be running, whether to start recording +STR_MOTION_DETECTION_RIDE_NOTE$Detect that you seem to be cycling, whether to start recording +STR_MOTION_DETECTION_ROWING_NOTE$Detected that you appear to be rowing machine, whether to start recording +STR_MOTION_DETECTION_ELLIPTICAL_NOTE$Detected that you appear to be on the elliptical machine, whether to start recording STR_PE4GC$Please enable 4G capability STR_OBU_MESSAGE$OBU STR_DELETE$Delete @@ -511,4 +515,6 @@ STR_SCHEDULE$Schedule STR_SCHEDULE_TITLE$Schedule management STR_SCHEDULE_NO_DATA$No schedules STR_SCHEDULE_NO_DATA_PROMPT$Please sync with the APP -STR_NO_PAIRED_DEV$No paired devices are available \ No newline at end of file +STR_NO_PAIRED_DEV$No paired devices are available +STR_IGNORE$Ignore +STR_START$Start \ No newline at end of file diff --git a/tools/language_tool/Language_xml/input_list_zh.txt b/tools/language_tool/Language_xml/input_list_zh.txt index 6117346a7..3ab2aa533 100644 --- a/tools/language_tool/Language_xml/input_list_zh.txt +++ b/tools/language_tool/Language_xml/input_list_zh.txt @@ -490,7 +490,11 @@ STR_DYWTDAK$是否确认删除API keys STR_CONNECTING$正在连接 STR_CONNECTION_FAIL$连接失败 STR_PTALORTM$请稍后再重试或更换模型 -STR_MOTION_DETECTION_NOTE$检测到您好像在进行XX运动,是否开始记录 +STR_MOTION_DETECTION_WALK_NOTE$检测到您好像在进行走路,是否开始记录 +STR_MOTION_DETECTION_RUN_NOTE$检测到您好像在进行跑步,是否开始记录 +STR_MOTION_DETECTION_RIDE_NOTE$检测到您好像在进行骑车,是否开始记录 +STR_MOTION_DETECTION_ROWING_NOTE$检测到您好像在进行划船机,是否开始记录 +STR_MOTION_DETECTION_ELLIPTICAL_NOTE$检测到您好像在进行椭圆机,是否开始记录 STR_PE4GC$请开启4G能力 STR_OBU_MESSAGE$OBU STR_DELETE$删除 @@ -511,4 +515,6 @@ STR_SCHEDULE$日程 STR_SCHEDULE_TITLE$日程管理 STR_SCHEDULE_NO_DATA$当前无日程 STR_SCHEDULE_NO_DATA_PROMPT$请先通过APP同步 -STR_NO_PAIRED_DEV$暂无已配对设备 \ No newline at end of file +STR_NO_PAIRED_DEV$暂无已配对设备 +STR_IGNORE$忽略 +STR_START$开始 \ No newline at end of file diff --git a/tools/language_tool/Language_xml/language_en.xml b/tools/language_tool/Language_xml/language_en.xml index ad593d57a..ed0897d3f 100644 --- a/tools/language_tool/Language_xml/language_en.xml +++ b/tools/language_tool/Language_xml/language_en.xml @@ -491,7 +491,11 @@ - + + + + + @@ -513,4 +517,6 @@ + + diff --git a/tools/language_tool/Language_xml/language_zh.xml b/tools/language_tool/Language_xml/language_zh.xml index f40d49913..14b3f0986 100644 --- a/tools/language_tool/Language_xml/language_zh.xml +++ b/tools/language_tool/Language_xml/language_zh.xml @@ -491,7 +491,11 @@ - + + + + + @@ -513,4 +517,6 @@ + + diff --git a/tools/language_tool/font/en.lang b/tools/language_tool/font/en.lang index 66f231f04000194402491d42edfc3a5a24c5a869..f39fe487aefb790d1f86bad6ac1d56b16a6d1855 100644 GIT binary patch delta 385 zcmaDAwkT3G)8F<`Y90d$;Mgd-l|5^p0t3TeAhuCtU}yv4+d%vsh<^hylM(|1HxQcu zu|E(e0dYPM*8y=i5N`uwb!8wMh|d7=Wgz|o#H=a|43a>s2E_J291p~4Dw}0E8WogW zQcF^kOB6~n5=#^+^Gg+qQ&V#lO7azwQWeS*bFwq@(kGwPkj1C0s5CE+2xZBY$vIGE zx)4iKQxMiB78Il=7C|j8$}b11RLD(C&dAJ51=(*wKu3Na(5O^})SR5mf|AVS#2lFB Y%_lV$GVyw*=j9irG6a_-7L_mn09D#?XaE2J delta 172 zcmZ1!`6^6w-=eR(Qu7#40Mka%t?WT36c`wu0PzbTehU1maIX%%;r1APmGh%9~9%8WnUrOB9MzQ*(p(tJQ;{D1F^L{149lFR|4@oAYKZ@n}GNb5Z?gecR>7AezOe6Z5g%~ zTQ|JezJBt56|u>8RHWHnY@hgS?NT`R<*JD<_AY~QIiGe+deO1-*_>T)k!MTRKAqDB b6xsY=MVE>1>HfXXr!Hl9x~Jjk@@@tIK%-Cw delta 132 zcmdlKu*Oex^QQ+wRT&H@fN7)XR`#IpG7JoyvJ4EoKr8~pia_iG#PL9!1;ph*+ycZC zfp{|ze+J@cIR=IvAf5@t`+)c;5MKh~M?m~TZnFu;Z5fV;h!^`OJndSs`Matv69BEK B9qRx9 -- 2.17.1