From 558e72c6cf5b386c3d1e2228614fb43b1c78c3ba Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Sat, 31 Aug 2024 16:56:28 +0800 Subject: [PATCH] =?utf8?q?=E6=9F=A5=E6=89=BE=E6=89=8B=E6=9C=BA=E5=92=8C?= =?utf8?q?=E9=85=8D=E5=AF=B9=E5=8A=A8=E7=94=BB=E6=94=B9=E6=88=90Imageinfo?= =?utf8?q?=E5=87=8F=E5=B0=91=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/findphone/include/FindPhoneView.h | 10 +++++++++- .../nativeui/findphone/src/FindPhonePresenter.cpp | 9 +++++++-- .../nativeui/findphone/src/FindPhoneView.cpp | 14 +++++++++----- .../msg_center/src/notify/pairing_notification.cpp | 14 +++++++------- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h b/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h index e6cb3916c..940f76b64 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h @@ -1,3 +1,11 @@ +/* + * @Author: luozheng 1732036298@qq.com + * @Date: 2024-08-31 09:52:34 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-31 16:38:04 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/include/FindPhoneView.h + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ #ifndef FIND_PHONE_VIEW_H #define FIND_PHONE_VIEW_H @@ -41,7 +49,7 @@ namespace OHOS UIImageAnimatorView *FindPhoneImageAnimator = nullptr; UILabelButtonExt *FindPhoneLabelButton = nullptr; UIImageView *FindPhoneImageView{nullptr}; - const char **FindPhonePathsArray{nullptr}; + const ImageInfo **FindPhonePathsArray{nullptr}; ImageAnimatorInfo FindPhoneImageInfo[FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; bool viewInitStatus{false}; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp index 33c5fce71..941ba0dd4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp @@ -2,7 +2,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-27 10:47:40 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-07 18:21:37 + * @LastEditTime: 2024-08-31 16:43:28 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhonePresenter.cpp */ #include "AppViewIDs.h" @@ -88,7 +88,7 @@ namespace OHOS } return true; } - + bool FindPhonePresenter::OnDragEnd(UIView &view, const DragEvent &event) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FindPhonePresenter::OnDragEnd"); @@ -96,6 +96,11 @@ namespace OHOS if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && FindPhonePresenter::X_DRAG_FLAG) { NativeAbility::GetInstance().Back(TransitionType::TRANSITION_BACK_TO_HEXAGONS); + // 发送指令停止震动 + if (FindPhoneModel::GetInstance().GetBlueToothConnectedState()) + { + senfindphoneSend(FINDPHONE_STOP); + } FindPhonePresenter::X_DRAG_FLAG = false; } return true; diff --git a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp index f01084c02..cde95682b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp @@ -8,7 +8,7 @@ * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-27 10:47:46 * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-19 15:36:22 + * @LastEditTime: 2024-08-31 16:40:57 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/findphone/src/FindPhoneView.cpp */ #include "findphone/include/FindPhoneView.h" @@ -24,6 +24,7 @@ namespace OHOS { static FindPhoneView *g_pFindPhoneView{nullptr}; + static constexpr const char *FIND_PONE_IMAGE_SRC = "/user/res/findphone/"; FindPhoneView::FindPhoneView() { @@ -68,7 +69,8 @@ namespace OHOS FindPhoneImageAnimator->Stop(); delete FindPhoneImageAnimator; FindPhoneImageAnimator = nullptr; - FreeImagePathsArray(FindPhonePathsArray, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + // FreeImagePathsArray(FindPhonePathsArray, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(FindPhonePathsArray, FIND_PONE_IMAGE_SRC, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); } if (FindPhoneLabel != nullptr) @@ -201,7 +203,7 @@ namespace OHOS FindPhoneTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); FindPhoneTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); /* ----------------------- FindPhoneImageAnimator ---------------------- */ - FindPhonePathsArray = CreateImagePathsArray("/user/res/findphone/",FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FindPhonePathsArray = CreateImageInfoArray(FIND_PONE_IMAGE_SRC, FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (FindPhoneImageAnimator == nullptr) { FindPhoneImageAnimator = new UIImageAnimatorView(); @@ -212,8 +214,10 @@ namespace OHOS } for (uint8_t i = 0; i < FINDPHONE_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - FindPhoneImageInfo[i].imagePath = (FindPhonePathsArray[i]); - FindPhoneImageInfo[i].imageType = IMG_SRC_FILE_PATH; + // FindPhoneImageInfo[i].imagePath = (FindPhonePathsArray[i]); + // FindPhoneImageInfo[i].imageType = IMG_SRC_FILE_PATH; + FindPhoneImageInfo[i].imageInfo = (FindPhonePathsArray[i]); + FindPhoneImageInfo[i].imageType = IMG_SRC_IMAGE_INFO; FindPhoneImageInfo[i].pos.x = FINDPHONE_IMAGE_ANIMATOR_VIEW_X; FindPhoneImageInfo[i].pos.y = FINDPHONE_IMAGE_ANIMATOR_VIEW_Y; FindPhoneImageInfo[i].width = FINDPHONE_IMAGE_ANIMATOR_VIEW_W; diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp index dc90b53cc..ff9564d58 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-22 10:04:36 - * @LastEditors: SnickerSun snickersun@163.com - * @LastEditTime: 2024-08-02 19:27:15 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-08-31 16:49:39 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp */ #include "notification_manager.h" @@ -49,7 +49,7 @@ namespace OHOS static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_H = 80; static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_TIMEOFUPDATE = 100; static constexpr int UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES = 25; // 解绑动画帧数 - const char **UnBindPathsArray{nullptr}; + const ImageInfo **UnBindPathsArray{nullptr}; ImageAnimatorInfo UnBindImageInfo[UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES]; UIViewGroup *DeviceUnbindingRequestGroupView{nullptr}; @@ -310,7 +310,7 @@ namespace OHOS DeviceUnBindingView->SetDraggable(true); DeviceUnBindingView->SetTouchable(true); /* ----------------------- DeviceUnBindingAnimatorView ---------------------- */ - UnBindPathsArray = CreateImagePathsArray("/user/res/remind/unbind/", UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + UnBindPathsArray = CreateImageInfoArray("/user/res/remind/unbind/", UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); if (DeviceUnBindingAnimatorView == nullptr) { DeviceUnBindingAnimatorView = new UIImageAnimatorView(); @@ -321,8 +321,8 @@ namespace OHOS } for (uint8_t i = 0; i < UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES; i++) { - UnBindImageInfo[i].imagePath = (UnBindPathsArray[i]); - UnBindImageInfo[i].imageType = IMG_SRC_FILE_PATH; + UnBindImageInfo[i].imageInfo = (UnBindPathsArray[i]); + UnBindImageInfo[i].imageType = IMG_SRC_IMAGE_INFO; UnBindImageInfo[i].pos.x = UNBIND_IMAGE_ANIMATOR_VIEW_X; UnBindImageInfo[i].pos.y = UNBIND_IMAGE_ANIMATOR_VIEW_Y; UnBindImageInfo[i].width = UNBIND_IMAGE_ANIMATOR_VIEW_W; @@ -598,7 +598,7 @@ namespace OHOS delete DeviceUnBindingViewTitleLabel; DeviceUnBindingViewTitleLabel = nullptr; - FreeImagePathsArray(UnBindPathsArray, UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); + FreeImageInfoArray(UnBindPathsArray, "/user/res/remind/unbind/", UNBIND_IMAGE_ANIMATOR_VIEW_NUM_FRAMES); DeviceUnBindingAnimatorView->Stop(); delete DeviceUnBindingAnimatorView; -- 2.17.1