From ec22ce2e2c611c80f29485ed8d88f2cff79f521f Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Fri, 23 Aug 2024 11:07:58 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E7=9C=81=E7=94=B5=E6=A8=A1?= =?utf8?q?=E5=BC=8F=E8=A1=A8=E7=9B=98=E7=95=8C=E9=9D=A2=E6=8C=89=E9=94=AE?= =?utf8?q?=E9=80=80=E5=87=BA=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../fd230app/nativeui/saveele/include/SaveBatPresenter.h | 4 +++- .../fd230app/nativeui/saveele/src/SaveBatPresenter.cpp | 5 +++++ .../wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h index a162ded2d..2c7743d92 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h @@ -18,7 +18,8 @@ namespace OHOS public UIView::OnDragListener, public UIView::OnLongPressListener, public ModelListenerSample, - public UIView::OnTouchListener + public UIView::OnTouchListener, + public RootView::OnKeyActListener { public: SaveBatPresenter(); @@ -45,6 +46,7 @@ namespace OHOS bool OnLongPress(UIView &view, const LongPressEvent &event); bool OnPress(UIView &view, const PressEvent &event); bool OnRelease(UIView &view, const ReleaseEvent &event); + bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 uint64_t startTime{0}; int count = 3; // 初始计数 diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp index 9cb78e5c2..abb384891 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp @@ -203,4 +203,9 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Refresh_Back_View: 当前计数: %d, 当前进度值: %d", count, progressValue); } } + bool SaveBatPresenter::OnKeyAct(UIView &view, const KeyEvent &event) + { + /*消耗按键事件*/ + return true; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp index 4874809b8..579f7de82 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp @@ -399,6 +399,7 @@ namespace OHOS InitShowBackView(); SetContainerView(container_); + RootView::GetInstance()->SetOnKeyActListener(presenter_); } void SaveBatView::OnSetUpView() -- 2.17.1