修复省电模式表盘界面按键退出的异常
authorCaisking <3449750381@qq.com>
Fri, 23 Aug 2024 03:07:58 +0000 (11:07 +0800)
committerCaisking <3449750381@qq.com>
Fri, 23 Aug 2024 03:07:58 +0000 (11:07 +0800)
code/sdk/application/wearable/fd230app/nativeui/saveele/include/SaveBatPresenter.h
code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/saveele/src/SaveBatView.cpp

index a162ded..2c7743d 100644 (file)
@@ -18,7 +18,8 @@ namespace OHOS
                              public UIView::OnDragListener,\r
                              public UIView::OnLongPressListener,\r
                              public ModelListenerSample,\r
-                             public UIView::OnTouchListener\r
+                             public UIView::OnTouchListener,\r
+                             public RootView::OnKeyActListener\r
     {\r
     public:\r
         SaveBatPresenter();\r
@@ -45,6 +46,7 @@ namespace OHOS
         bool OnLongPress(UIView &view, const LongPressEvent &event);\r
         bool OnPress(UIView &view, const PressEvent &event);\r
         bool OnRelease(UIView &view, const ReleaseEvent &event);\r
+        bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件\r
 \r
         uint64_t startTime{0};\r
         int count = 3;         // 初始计数\r
index 9cb78e5..abb3848 100644 (file)
@@ -203,4 +203,9 @@ namespace OHOS
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Refresh_Back_View: 当前计数: %d, 当前进度值: %d", count, progressValue);\r
         }\r
     }\r
+    bool SaveBatPresenter::OnKeyAct(UIView &view, const KeyEvent &event)\r
+    {\r
+        /*消耗按键事件*/\r
+        return true;\r
+    }\r
 }
\ No newline at end of file
index 4874809..579f7de 100644 (file)
@@ -399,6 +399,7 @@ namespace OHOS
         InitShowBackView();\r
 \r
         SetContainerView(container_);\r
+        RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
     }\r
 \r
     void SaveBatView::OnSetUpView()\r