From f8ea7d358988599069c34c5b3a07349974edae32 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Mon, 19 Aug 2024 11:27:21 +0800 Subject: [PATCH] =?utf8?q?=E8=BF=90=E5=8A=A8=E8=AF=86=E5=88=AB=E5=BC=B9?= =?utf8?q?=E7=AA=97=E4=BF=AE=E6=94=B9=EF=BC=8C=E9=9C=80=E8=A6=81=E6=B7=BB?= =?utf8?q?=E5=8A=A0=E5=BC=80=E5=A7=8B=E8=BF=90=E5=8A=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../notify/motion_recognition_notification.h | 3 +- .../msg_center/src/msg_center_customer.cpp | 2 +- .../motion_recognition_notification.cpp | 33 ++++++++++++++++--- 3 files changed, 31 insertions(+), 7 deletions(-) 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 index f43542591..7125889c3 100644 --- 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 @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-17 16:43:46 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-19 09:31:47 + * @LastEditTime: 2024-08-19 11:00:50 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/motion_recognition_notification.h */ @@ -26,6 +26,7 @@ namespace OHOS void SetMotionTypeId(int type); int GetMotionType(void); + int GetMotionTypeTextId(void); private: MotionRecognitionViewEventListener(); 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 85ce94449..f492994eb 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 @@ -1140,7 +1140,7 @@ void MsgCenterNotifyArAlertProc(const Topic topic, Request* req) { uint8_t* motionType=(uint8_t*)req->data; WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyArAlertProc,motionType = %d !",*motionType); - if(*motionType == 0) //未知运动不弹窗 + if(*motionType > 5 || *motionType <1) //未知运动不弹窗 { return; } 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 index 10b984f94..fb625cedc 100644 --- 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 @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-08-17 16:44:20 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-08-19 10:15:11 + * @LastEditTime: 2024-08-19 11:25:09 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/motion_recognition_notification.cpp */ #include "notification_manager.h" @@ -69,6 +69,8 @@ namespace OHOS /*关闭弹窗*/ NotificationManager::GetInstance()->StopNotify(); /*开始运动*/ + int textId = GetMotionTypeTextId(); + // set_sport_config(textId); } return true; @@ -123,15 +125,36 @@ namespace OHOS motionType = STR_MOTION_DETECTION_ROWING_NOTE; break; case 5: - motionType = STR_MOTION_DETECTION_ROWING_NOTE; - break; - default: - motionType = STR_MOTION_DETECTION_WALK_NOTE; + motionType = STR_MOTION_DETECTION_ELLIPTICAL_NOTE; break; } return motionType; } + int MotionRecognitionViewEventListener::GetMotionTypeTextId(void) + { + int 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; + } + static std::string UpdateNoteLabelText(UILabelExt *&label, const std::string &newText, int id) { if (label == nullptr) -- 2.17.1