From 29be07103b7437f17ddad8e846142de24cef1f55 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Mon, 29 Dec 2025 16:38:22 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E4=BF=A1=E6=81=AF=E7=95=8C?= =?utf8?q?=E9=9D=A2=EF=BC=8C=E6=8C=89=E9=94=AE=E4=B8=8D=E8=83=BD=E9=80=80?= =?utf8?q?=E5=87=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/message/include/MessagePresenter.h | 2 -- .../message/include/MessageShowPresenter.h | 2 -- .../nativeui/message/src/MessagePresenter.cpp | 14 ++------------ .../nativeui/message/src/MessageShowPresenter.cpp | 13 +------------ .../nativeui/message/src/MessageShowView.cpp | 1 + .../nativeapp/nativeui/message/src/MessageView.cpp | 2 +- .../nativeui/message/include/MessagePresenter.h | 2 -- .../message/include/MessageShowPresenter.h | 2 -- .../nativeui/message/src/MessagePresenter.cpp | 13 ++----------- .../nativeui/message/src/MessageShowPresenter.cpp | 12 ------------ .../nativeui/message/src/MessageShowView.cpp | 3 +-- .../nativeapp/nativeui/message/src/MessageView.cpp | 2 +- 12 files changed, 9 insertions(+), 59 deletions(-) diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/include/MessagePresenter.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/include/MessagePresenter.h index 8f1d39aa6..6d84a49b4 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/include/MessagePresenter.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/include/MessagePresenter.h @@ -27,9 +27,7 @@ namespace OHOS virtual ~MessagePresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static MessagePresenter *GetInstance(); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/include/MessageShowPresenter.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/include/MessageShowPresenter.h index 2afeddaa6..d0a76e6d7 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/include/MessageShowPresenter.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/include/MessageShowPresenter.h @@ -29,9 +29,7 @@ namespace OHOS virtual ~MessageShowPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static MessageShowPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessagePresenter.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessagePresenter.cpp index 7e192924c..6c84b2bfa 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessagePresenter.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessagePresenter.cpp @@ -51,7 +51,6 @@ namespace OHOS void MessagePresenter::OnStart() { model->InitMessageListItems(); - Presenter::OnStart(); if(view_ != nullptr) { @@ -60,10 +59,7 @@ namespace OHOS } } - void MessagePresenter::OnPause(void) - { - Presenter::OnPause(); - } + void MessagePresenter::OnResume(void) { if (view_ == nullptr) @@ -80,14 +76,8 @@ namespace OHOS } } - Presenter::OnResume(); - } - - void MessagePresenter::OnStop(void) - { - Presenter::OnStop(); } - + bool MessagePresenter::OnDrag(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageShowPresenter.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageShowPresenter.cpp index 0755556bd..3fa01dd29 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageShowPresenter.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageShowPresenter.cpp @@ -43,24 +43,13 @@ namespace OHOS void MessageShowPresenter::OnStart() { - Presenter::OnStart(); } - - void MessageShowPresenter::OnPause(void) - { - Presenter::OnPause(); - } - + void MessageShowPresenter::OnResume(void) { RootView::GetInstance()->SetOnKeyActListener(this); } - void MessageShowPresenter::OnStop(void) - { - Presenter::OnStop(); - } - bool MessageShowPresenter::OnDrag(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageShowView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageShowView.cpp index f103b59cb..6fc1cdb00 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageShowView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageShowView.cpp @@ -275,6 +275,7 @@ namespace OHOS UpdateShowConfig(); AddViewToRootContainer(scrollView_); + RootView::GetInstance()->SetOnKeyActListener(this); } diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageView.cpp index 90bfeab4a..d62767f34 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/message/src/MessageView.cpp @@ -201,7 +201,6 @@ /// @brief 页面启动时需要执行的代码逻辑 void MessageView::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartResultView::OnStart"); - View::OnStart(); ShowMessageView(); ShowLackView(); @@ -212,6 +211,7 @@ MessageList->SetAdapter(p_MessageListAdapter); } } + RootView::GetInstance()->SetOnKeyActListener(MessagePresenter::GetInstance()); } void MessageView::AddMessageToList(const MessageListItem &item) { diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/include/MessagePresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/include/MessagePresenter.h index 8f1d39aa6..6d84a49b4 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/include/MessagePresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/include/MessagePresenter.h @@ -27,9 +27,7 @@ namespace OHOS virtual ~MessagePresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static MessagePresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/include/MessageShowPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/include/MessageShowPresenter.h index 2afeddaa6..d0a76e6d7 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/include/MessageShowPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/include/MessageShowPresenter.h @@ -29,9 +29,7 @@ namespace OHOS virtual ~MessageShowPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static MessageShowPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessagePresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessagePresenter.cpp index 7e192924c..54fd92242 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessagePresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessagePresenter.cpp @@ -51,7 +51,6 @@ namespace OHOS void MessagePresenter::OnStart() { model->InitMessageListItems(); - Presenter::OnStart(); if(view_ != nullptr) { @@ -60,12 +59,9 @@ namespace OHOS } } - void MessagePresenter::OnPause(void) - { - Presenter::OnPause(); - } void MessagePresenter::OnResume(void) { + RootView::GetInstance()->SetOnKeyActListener(this); if (view_ == nullptr) { return; @@ -79,14 +75,9 @@ namespace OHOS view_->AddMessageToList(itemInfo[i]); } } - - Presenter::OnResume(); } - void MessagePresenter::OnStop(void) - { - Presenter::OnStop(); - } + bool MessagePresenter::OnDrag(UIView &view, const DragEvent &event) { diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageShowPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageShowPresenter.cpp index 0755556bd..fa28337d9 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageShowPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageShowPresenter.cpp @@ -43,24 +43,12 @@ namespace OHOS void MessageShowPresenter::OnStart() { - Presenter::OnStart(); } - - void MessageShowPresenter::OnPause(void) - { - Presenter::OnPause(); - } - void MessageShowPresenter::OnResume(void) { RootView::GetInstance()->SetOnKeyActListener(this); } - void MessageShowPresenter::OnStop(void) - { - Presenter::OnStop(); - } - bool MessageShowPresenter::OnDrag(UIView &view, const DragEvent &event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT && diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageShowView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageShowView.cpp index f103b59cb..47229abd1 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageShowView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageShowView.cpp @@ -249,8 +249,6 @@ namespace OHOS void MessageShowView::OnStart() { - View::OnStart(); - scrollView_ = new UIScrollView(); if (scrollView_ == nullptr) { @@ -275,6 +273,7 @@ namespace OHOS UpdateShowConfig(); AddViewToRootContainer(scrollView_); + RootView::GetInstance()->SetOnKeyActListener(MessageShowPresenter::GetInstance()); } diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageView.cpp index 1a10bafd3..cebcb5e2e 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/message/src/MessageView.cpp @@ -201,7 +201,6 @@ void MessageView::SetPopupViewStatus(PopupMessage view, bool status) { /// @brief 页面启动时需要执行的代码逻辑 void MessageView::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartResultView::OnStart"); - View::OnStart(); ShowMessageView(); ShowLackView(); @@ -212,6 +211,7 @@ void MessageView::OnStart() { MessageList->SetAdapter(p_MessageListAdapter); } } + RootView::GetInstance()->SetOnKeyActListener(MessagePresenter::GetInstance()); } void MessageView::AddMessageToList(const MessageListItem &item) { -- 2.17.1