From 6869c1c8d016c9fb23c9c9eef378d0fa680d0d24 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Mon, 29 Dec 2025 14:34:01 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E5=BC=80=E5=90=AF4G=E5=90=8E?= =?utf8?q?=E9=95=BF=E6=8C=89=E5=8A=9F=E8=83=BD=E6=8C=89=E9=94=AE=E6=AD=BB?= =?utf8?q?=E6=9C=BA=E9=97=AE=E9=A2=98=EF=BC=8C230=E5=92=8Cn9=E4=BF=AE?= =?utf8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../makephone/include/MainCallingPresenter.h | 2 -- .../nativeui/makephone/src/MainCallingPresenter.cpp | 12 ++---------- .../nativeui/makephone/src/MainCallingView.cpp | 13 +++++-------- .../src/RebootAndShutdownModel.cpp | 1 - .../service/msg_center/src/notify/phone_crt.cpp | 10 +++++++--- .../makephone/include/MainCallingPresenter.h | 2 -- .../nativeui/makephone/src/MainCallingPresenter.cpp | 12 ++---------- .../nativeui/makephone/src/MainCallingView.cpp | 13 +++++-------- .../src/RebootAndShutdownModel.cpp | 1 - .../n9/service/msg_center/src/notify/phone_crt.cpp | 7 +++++-- 10 files changed, 26 insertions(+), 47 deletions(-) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingPresenter.h index 67d7e38f3..9883b057f 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/include/MainCallingPresenter.h @@ -26,9 +26,7 @@ public: ~MainCallingPresenter() override; void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static MainCallingPresenter *GetInstance(); void HonrsViewChange(); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp index 9a4ca9f3e..e0b0082d1 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp @@ -65,18 +65,10 @@ MainCallingPresenter *MainCallingPresenter::GetInstance() void MainCallingPresenter::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::OnStart"); - - } -void MainCallingPresenter::OnPause(void) {} - -void MainCallingPresenter::OnResume(void) {} - -void MainCallingPresenter::OnStop(void) -{ - RootView::GetInstance()->ClearOnKeyActListener(); - +void MainCallingPresenter::OnResume(void) { + RootView::GetInstance()->SetOnKeyActListener(this); } void MainCallingPresenter::HonrsViewChange() diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingView.cpp index 8f16e2eb5..c92e6a741 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/makephone/src/MainCallingView.cpp @@ -145,7 +145,6 @@ void MainCallingView::updataCallingname(void) if(displayView) displayView->updataCallingname(); - RootView::GetInstance()->Invalidate(); //callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str()); } @@ -159,7 +158,6 @@ void MainCallingView::update_headset_state(uint8_t data) if(callView) { callView->update_headset_state(data); - RootView::GetInstance()->Invalidate(); } } @@ -175,13 +173,12 @@ void MainCallingView::OnStart() return; } - RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MainCallingPresenter::GetInstance(); - RootView::GetInstance()->SetOnKeyActListener(keyactListener); - RootView::GetInstance()->Add(displayGroup); - RootView::GetInstance()->Add(callingGroup); - RootView::GetInstance()->Add(screenGroup); - RootView::GetInstance()->Add(waitingGroup); + AddViewToRootContainer(displayGroup); + AddViewToRootContainer(callingGroup); + AddViewToRootContainer(screenGroup); + AddViewToRootContainer(waitingGroup); + waitingGroup->SetVisible(false); callingGroup->SetVisible(false); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp index 0ded82eb4..3a4058513 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp @@ -439,7 +439,6 @@ namespace OHOS if (HandleAlarmOrFindWatchNotify()) return; GraphicService::GetInstance()->PostGraphicEvent(std::bind(SOSKeyLongPress)); - SOSKeyLongPress(); } /*注册功能键的长按事件*/ diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/phone_crt.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/phone_crt.cpp index ada010a06..27a529f34 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/src/notify/phone_crt.cpp +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/notify/phone_crt.cpp @@ -313,8 +313,11 @@ UIViewGroup* CALL_FAIL_HINT(void) if (FAILHintView == nullptr) { FAILHintView = new UIViewGroup(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!"); - + if(FAILHintView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!"); + return nullptr; + } } FAILHintView->SetPosition(0, 0); FAILHintView->SetWidth(Screen::GetInstance().GetWidth()); @@ -872,7 +875,8 @@ void phone_VibratorFunc(void) custom_VibratorFunc_int(0); } } - + + diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/include/MainCallingPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/include/MainCallingPresenter.h index 67d7e38f3..9883b057f 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/include/MainCallingPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/include/MainCallingPresenter.h @@ -26,9 +26,7 @@ public: ~MainCallingPresenter() override; void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static MainCallingPresenter *GetInstance(); void HonrsViewChange(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp index 9a4ca9f3e..e0b0082d1 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp @@ -65,18 +65,10 @@ MainCallingPresenter *MainCallingPresenter::GetInstance() void MainCallingPresenter::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::OnStart"); - - } -void MainCallingPresenter::OnPause(void) {} - -void MainCallingPresenter::OnResume(void) {} - -void MainCallingPresenter::OnStop(void) -{ - RootView::GetInstance()->ClearOnKeyActListener(); - +void MainCallingPresenter::OnResume(void) { + RootView::GetInstance()->SetOnKeyActListener(this); } void MainCallingPresenter::HonrsViewChange() diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingView.cpp index 8f16e2eb5..c92e6a741 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/makephone/src/MainCallingView.cpp @@ -145,7 +145,6 @@ void MainCallingView::updataCallingname(void) if(displayView) displayView->updataCallingname(); - RootView::GetInstance()->Invalidate(); //callerDisplay->SetText(CallerLogModel::GetInstance()->Getphonename().c_str()); } @@ -159,7 +158,6 @@ void MainCallingView::update_headset_state(uint8_t data) if(callView) { callView->update_headset_state(data); - RootView::GetInstance()->Invalidate(); } } @@ -175,13 +173,12 @@ void MainCallingView::OnStart() return; } - RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MainCallingPresenter::GetInstance(); - RootView::GetInstance()->SetOnKeyActListener(keyactListener); - RootView::GetInstance()->Add(displayGroup); - RootView::GetInstance()->Add(callingGroup); - RootView::GetInstance()->Add(screenGroup); - RootView::GetInstance()->Add(waitingGroup); + AddViewToRootContainer(displayGroup); + AddViewToRootContainer(callingGroup); + AddViewToRootContainer(screenGroup); + AddViewToRootContainer(waitingGroup); + waitingGroup->SetVisible(false); callingGroup->SetVisible(false); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp index 4b3fe8097..470796cc5 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/rebootandshutdown/src/RebootAndShutdownModel.cpp @@ -445,7 +445,6 @@ namespace OHOS if (HandleAlarmOrFindWatchNotify()) return; GraphicService::GetInstance()->PostGraphicEvent(std::bind(SOSKeyLongPress)); - SOSKeyLongPress(); } /*注册功能键的长按事件*/ diff --git a/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp b/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp index b562c356a..27a529f34 100644 --- a/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp +++ b/code/sdk/application/wearable/n9/service/msg_center/src/notify/phone_crt.cpp @@ -313,8 +313,11 @@ UIViewGroup* CALL_FAIL_HINT(void) if (FAILHintView == nullptr) { FAILHintView = new UIViewGroup(); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!"); - + if(FAILHintView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!"); + return nullptr; + } } FAILHintView->SetPosition(0, 0); FAILHintView->SetWidth(Screen::GetInstance().GetWidth()); -- 2.17.1