From 8e3261584e7e636c9b7e4f5c4458acda3182d6e6 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Tue, 2 Sep 2025 17:23:58 +0800 Subject: [PATCH] =?utf8?q?VIEW=5FADD=5FCARD=20=E9=A1=B5=E9=9D=A2=20?= =?utf8?q?=E5=92=8C=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2=E5=9C=A8OnResume?= =?utf8?q?=E5=A4=84=E7=90=86=E6=8C=89=E9=94=AE=E6=B3=A8=E5=86=8C=EF=BC=8C?= =?utf8?q?=E8=A7=A3=E5=86=B3=E5=9B=A0=E5=BC=B9=E7=AA=97=E5=AF=BC=E8=87=B4?= =?utf8?q?=E6=8C=89=E9=94=AE=E7=9B=91=E5=90=AC=E8=A2=AB=E6=B8=85=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../fd230/nativeabilityfwk/src/AbilitySlice.cpp | 1 - .../nativeui/add_card/include/AddCardPresenter.h | 2 +- .../nativeui/add_card/src/AddCardPresenter.cpp | 4 ++++ .../nativeui/add_card/src/AddCardView.cpp | 2 -- .../nativeui/applist/src/ApplistPresenter.cpp | 4 +--- .../nativeui/main/src/MainPresenterSample.cpp | 4 +--- .../nativeui/settings/include/SettingPresenter.h | 1 + .../nativeui/settings/src/SettingPresenter.cpp | 15 +++++++++++---- .../nativeui/settings/src/SettingView.cpp | 4 ---- .../msg_center/src/msg_center_customer.cpp | 1 + 10 files changed, 20 insertions(+), 18 deletions(-) diff --git a/code/sdk/application/wearable/fd230/nativeabilityfwk/src/AbilitySlice.cpp b/code/sdk/application/wearable/fd230/nativeabilityfwk/src/AbilitySlice.cpp index 899c81a63..13bdd5265 100644 --- a/code/sdk/application/wearable/fd230/nativeabilityfwk/src/AbilitySlice.cpp +++ b/code/sdk/application/wearable/fd230/nativeabilityfwk/src/AbilitySlice.cpp @@ -55,7 +55,6 @@ void AbilitySlice::OnResume() } // Reset the default key listener // RootView::GetInstance()->SetOnKeyActListener(KeyInputListener::GetInstance()); - RootView::GetInstance()->SetOnKeyActListener(RootView::GetInstance()->GetOnKeyActListener()); NativeAbility::GetInstance().SetCurSlicePriority(gSliceDefaultPriority); UIView* backView = PageTransitionMgr::GetInstance().GetTopSlideBackImage(); diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/include/AddCardPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/include/AddCardPresenter.h index f5802cdfe..b6e1f8580 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/include/AddCardPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/include/AddCardPresenter.h @@ -47,7 +47,7 @@ namespace OHOS ~AddCardPresenter() override; - + void OnResume() override; void OnTickEvent() override; void Notify() override {} bool OnClick(UIView &view, const ClickEvent &event) override; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/src/AddCardPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/src/AddCardPresenter.cpp index ec70283c0..df60ed0ae 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/src/AddCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/src/AddCardPresenter.cpp @@ -34,6 +34,10 @@ namespace OHOS } + void AddCardPresenter::OnResume() + { + RootView::GetInstance()->SetOnKeyActListener(this); + } bool AddCardPresenter::OnDrag(UIView &view, const DragEvent &event) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/src/AddCardView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/src/AddCardView.cpp index 0da9759ef..87a1c4605 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/src/AddCardView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/add_card/src/AddCardView.cpp @@ -34,8 +34,6 @@ namespace OHOS SetUpListInfo(); SetUpListView(); SetUpToast(); - //按键监听 - RootView::GetInstance()->SetOnKeyActListener(presenter_); } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistPresenter.cpp index 3b43455fa..d18c039ee 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/applist/src/ApplistPresenter.cpp @@ -58,9 +58,7 @@ REGIST_SLICE(VIEW_APPLIST, ApplistView, ApplistPresenter); } else if (GetCurrentStyle() == AppListStyle::WATERFALL_STYLE) { view_->ResumeWaterFallDraggable(); } - // 避免与弹窗收起的时序冲突,放到UI线程消息队列 - GraphicService::GetInstance()->PostGraphicEvent( - std::bind(&OHOS::RootView::SetOnKeyActListener, OHOS::RootView::GetInstance(), KeyInputListener::GetInstance())); + RootView::GetInstance()->SetOnKeyActListener(KeyInputListener::GetInstance()); } bool ApplistPresenter::OnRotate(UIView& view, const RotateEvent& event) diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/MainPresenterSample.cpp index ece2fbdce..42f1cba2a 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/main/src/MainPresenterSample.cpp @@ -135,9 +135,7 @@ REGIST_SLICE(VIEW_MAIN, MainViewSample, MainPresenterSample); // Set current page again to invoke OnActive method. uint8_t curCardId = view_->GetHorCurrentCard(); view_->SwitchToCard(curCardId); - // 避免与弹窗收起的时序冲突,放到UI线程消息队列 - GraphicService::GetInstance()->PostGraphicEvent( - std::bind(&OHOS::RootView::SetOnKeyActListener, OHOS::RootView::GetInstance(), KeyInputListener::GetInstance())); + RootView::GetInstance()->SetOnKeyActListener(KeyInputListener::GetInstance()); #if IS_SUPPORT_BIND_VOTE if (ConfigModel::GetInstance()->GetisFirstTimeStart() == true) { diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/include/SettingPresenter.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/include/SettingPresenter.h index dbc767f4d..f0adc2f07 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/include/SettingPresenter.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/include/SettingPresenter.h @@ -32,6 +32,7 @@ namespace OHOS int GetListItemNum(); void OnStart() override; + void OnResume() override; bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView &view, const DragEvent &event) override; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/src/SettingPresenter.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/src/SettingPresenter.cpp index 5fc810cdf..57f445f03 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/src/SettingPresenter.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/src/SettingPresenter.cpp @@ -22,8 +22,8 @@ namespace OHOS { REGIST_MENU_PRO(VIEW_SETTING, SettingView, SettingPresenter, - PNG_APPLIST_SETTING_IMAGE_BIG, PNG_APPLIST_SETTING_IMAGE,PNG_APPLIST_SETTING_IMAGE, "设置", STR_SETTINGS); - + PNG_APPLIST_SETTING_IMAGE_BIG, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_SETTING_IMAGE, "设置", STR_SETTINGS); + static SettingPresenter *g_pSettingPresenter = nullptr; SettingPresenter::SettingPresenter() { @@ -88,6 +88,13 @@ namespace OHOS view_->RefreshSettingList(itemInfo); } + void SettingPresenter::OnResume() + { + RootView::GetInstance()->SetOnKeyActListener(this); + if (view_->GetSettingList()) + view_->GetSettingList()->RequestFocus(); + } + bool SettingPresenter::OnDrag(UIView &view, const DragEvent &event) { UNUSED(view); @@ -131,9 +138,9 @@ namespace OHOS SettingItemView *settingItemView = static_cast(&view); AppViewId viewId = settingItemView->GetViewId(); - + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d\n", viewId); - NativeAbility::GetInstance().EnterSlice(viewId); //Test + NativeAbility::GetInstance().EnterSlice(viewId); // Test return true; } } diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/src/SettingView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/src/SettingView.cpp index da278de0b..3f9d8ad8b 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/src/SettingView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/settings/src/SettingView.cpp @@ -117,8 +117,6 @@ namespace OHOS contentList->SetSwipeACCLevel(200); /*设置手指抬起屏幕后的补偿距离。*/ // contentList->SetReboundSize(30); // contentList->SetScrollBlankSize(30); - FocusManager::GetInstance()->RequestFocus(contentList); - FocusManager::GetInstance()->RequestFocusByDirection(FOCUS_DIRECTION_UP); contentList->SetRotateFactor(1.0); /* ----------------------------------- Add ---------------------------------- */ scrollView->Add(contentList); @@ -134,8 +132,6 @@ namespace OHOS viewInitStatus = true; } settingListOnSetUpView(); - // 增加按键监听 - RootView::GetInstance()->SetOnKeyActListener(presenter_); } diff --git a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp index 60f5754a9..3fe4ea548 100644 --- a/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/fd230/service/msg_center/src/msg_center_customer.cpp @@ -484,6 +484,7 @@ void MsgCenterNotifyChargePlugProc(const Topic topic, Request* req) { if (CheckPriority(topic) && !uapi_dev_runtime_get_factory_test_status_flag()) //产测模式不弹充电弹窗 { + NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify(ShowChargeingNotify, (uint16_t)topic, true); } } -- 2.17.1