From: Caisking <3449750381@qq.com> Date: Fri, 23 Aug 2024 03:07:58 +0000 (+0800) Subject: 修复省电模式表盘界面按键退出的异常 X-Git-Tag: release_V1.2.70_20241020_135402~589^2~8 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=ec22ce2e2c611c80f29485ed8d88f2cff79f521f;p=mirrors%2FFD230.git 修复省电模式表盘界面按键退出的异常 --- 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()