为血氧界面适配功能按键退出功能,能通过功能键进入和退出(限主界面)
authorluozheng <1732036298@qq.com>
Wed, 28 Feb 2024 02:59:56 +0000 (10:59 +0800)
committerluozheng <1732036298@qq.com>
Wed, 28 Feb 2024 02:59:56 +0000 (10:59 +0800)
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/BloodOxygenPresenter.h
code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp

index 0949112..34ff7f2 100644 (file)
@@ -27,6 +27,11 @@ BloodOxygenPresenter::BloodOxygenPresenter()
 
 BloodOxygenPresenter::~BloodOxygenPresenter()
 {
+    if (keyActListenr != nullptr) 
+    {
+        delete keyActListenr;
+        keyActListenr = nullptr;
+    }
     g_pMainView = nullptr;
 }
 
@@ -39,6 +44,16 @@ void BloodOxygenPresenter::OnStart()
 {
     Presenter<BloodOxygenView>::OnStart();
     WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodOxygenPresenter::On Start ");
+
+    if (keyActListenr == nullptr) 
+    {
+        keyActListenr = new KeyInputListener();
+        if (keyActListenr != nullptr) {
+                RootView::GetInstance()->SetOnKeyActListener(keyActListenr);
+        } else {
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenPresenter::OnStart: new KeyInputListener fail");
+        }
+    }
 }
 
 void BloodOxygenPresenter::OnPause(void) {}