From: 袁清梦 <3449750381@qq.com> Date: Fri, 23 Aug 2024 07:59:04 +0000 (+0000) Subject: Merge #774 into sdk602patch0626 from refs/changes/774/head X-Git-Tag: release_V1.2.70_20241020_135402~598^2~1 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=249dc6fd5aca89ca636981ba023ef888870aaa9c;p=mirrors%2FFD230.git Merge #774 into sdk602patch0626 from refs/changes/774/head Code review from 袁清梦 * refs/changes/774/head: (3 commits squashed) - 修复省电模式表盘界面按键退出的异常 - Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230 into sdk602patch0626 - 修复心率检测界面刷新异常 Signed-off-by: Caisking <3449750381@qq.com> Reviewed-by: snickersun@163.com Merged-by: snickersun@163.com CR-link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/774 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp index e2b36e22f..09528efd5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartModel.cpp @@ -163,7 +163,9 @@ extern "C" GraphicService::GetInstance()->PostGraphicEvent( std::bind(&OHOS::HeartModel::Heart_Update_View, OHOS::HeartModel::GetInstance())); } - if (request->msgId == TOPIC_EVENT_WEARSTATE_UPDATE){} + if (request->msgId == TOPIC_EVENT_WEARSTATE_UPDATE) + { + } } #ifdef __cplusplus @@ -626,10 +628,10 @@ namespace OHOS void HeartModel::Heart_Result() { // 心率提醒(0开 1关) - uint8_t HeartState = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_HEARTRATE_REMIND); + uint8_t HeartRemindState = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_HEARTRATE_REMIND); uint16_t ThresholdValue = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_HEARTRATE_THRESHOLD_VALUE); - if (HeartState) + if (HeartRemindState) { // 检查当前心率是否高于或低于阈值 uint16_t ThresholdState = ConfigModel::GetInstance()->get_configData_int(ConfigModel::CONFIGMODEL_ITEM_HEARTRATE_MAX_MIN); @@ -654,8 +656,8 @@ namespace OHOS case HeartResult::SUCCESS: WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "检测结果: 成功"); Heart_Save(); - // NativeAbility::GetInstance().ChangeSlice(VIEW_HEART_CHART); - // NativeAbility::GetInstance().Back(); // 成功 心率界面检测成功 不回退 + /*通知进行UI更新*/ + SendMsgToUIService(UI_UPDATE_HEARTRATE_DATA, 0, nullptr, 0); break; case HeartResult::NOT_WORN: // 未佩戴状态 @@ -766,6 +768,7 @@ namespace OHOS void HeartModel::Heart_Update_View(void) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "更新心率界面"); int hour = HealthService::GetInstance()->GetCurrentHour(); if (HeartRateView::GetInstance() != nullptr) { 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()