From: xue <2144439972@qq.com> Date: Wed, 18 Jun 2025 10:19:08 +0000 (+0800) Subject: 修复未重置bug X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=fe071442b3dd9f3704630c90b697c6c06503d6a1;p=mirrors%2FFD230.git 修复未重置bug --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPMainPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPMainPresenter.h index 90e5a44d7..ac164fffc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPMainPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPMainPresenter.h @@ -25,6 +25,7 @@ namespace OHOS BPMainPresenter(); virtual ~BPMainPresenter(); static BPMainPresenter *GetInstance(void); + void ReSetPassflag(); void OnStart() override; void OnPause() override; diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainPresenter.cpp index b6acce853..571c5753f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainPresenter.cpp @@ -50,9 +50,9 @@ namespace OHOS { static constexpr uint16_t PROGRESS_VALUE_MIN = 0; static constexpr uint16_t PROGRESS_VALUE_MAX = 10; + static int16_t passflag = 0; // 第几次校准成功标志位 static BPMainPresenter *g_pBPMainPresenter; - /* -------------------------------------------------------------------------- */ BPMainPresenter::BPMainPresenter() { @@ -73,6 +73,10 @@ namespace OHOS { return g_pBPMainPresenter; } + void BPMainPresenter::ReSetPassflag() + { + passflag = 0; + } void BPMainPresenter::OnStart() { Presenter::OnStart(); @@ -118,7 +122,7 @@ namespace OHOS bool BPMainPresenter::OnClick(UIView &view, const ClickEvent &event) { - static int16_t passflag = 0; // 第几次校准成功标志位 + std::string viewId = view.GetViewId(); std::map> viewIdMap = { @@ -161,8 +165,8 @@ namespace OHOS } else { - //退出 - //passflag = 0; + // 退出 + // passflag = 0; } } else if (strcmp(view.GetViewId(), "SBPLeft") == 0) diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainView.cpp index ac232e0f1..e16dca570 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainView.cpp @@ -109,11 +109,14 @@ namespace OHOS container_->SetTouchable(true); container_->SetOnDragListener(presenter_); - if( BPModel::GetInstance()->GetCalibrationFlag() == 0) - // 切换到第一个界面 - ChangeView(MAX_BPVIEW, BPCALPOSREQVIEW); - else - ChangeView(MAX_BPVIEW, BPLASTCALIBRATIONTIME); + if (BPModel::GetInstance()->GetCalibrationFlag() == 0) + { + ChangeView(MAX_BPVIEW, BPCALPOSREQVIEW);// 切换到第一个界面 + BPMainPresenter::GetInstance()->ReSetPassflag();//重置校准成功按钮标志位 + } + + else + ChangeView(MAX_BPVIEW, BPLASTCALIBRATIONTIME); // 增加按键监听 RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::BPMainPresenter::GetInstance(); @@ -145,7 +148,6 @@ namespace OHOS return; } - bool BPMainView::ChangeBPUnderCalibrationView(int16_t thisView) { // 检查视图是否已初始化 @@ -164,7 +166,7 @@ namespace OHOS } return true; } - bool BPMainView::ChangeBPSecUnderCalibrationView(int16_t thisView) + bool BPMainView::ChangeBPSecUnderCalibrationView(int16_t thisView) { // 检查视图是否已初始化 if (group[thisView] == nullptr) @@ -245,7 +247,7 @@ namespace OHOS if (group[thisView] == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPCalibrationPassView"); - g_pBPCalibrationPassView = new BPCalibrationPassView(); + g_pBPCalibrationPassView = new BPCalibrationPassView(); if (g_pBPCalibrationPassView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView); @@ -258,13 +260,13 @@ namespace OHOS return true; } - bool BPMainView::ChangeBPCalibrationErrorView(int16_t thisView) + bool BPMainView::ChangeBPCalibrationErrorView(int16_t thisView) { // 检查视图是否已初始化 if (group[thisView] == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPCalibrationErrorView"); - g_pBPCalibrationErrorView = new BPCalibrationErrorView(); + g_pBPCalibrationErrorView = new BPCalibrationErrorView(); if (g_pBPCalibrationErrorView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView); @@ -283,7 +285,7 @@ namespace OHOS if (group[thisView] == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPCalibrationMindView"); - g_pBPCalibrationMindView = new BPCalibrationMindView(); + g_pBPCalibrationMindView = new BPCalibrationMindView(); if (g_pBPCalibrationMindView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView); @@ -302,7 +304,7 @@ namespace OHOS if (group[thisView] == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPResultAnalysisView"); - g_pBPResultAnalysisView = new BPResultAnalysisView(); + g_pBPResultAnalysisView = new BPResultAnalysisView(); if (g_pBPResultAnalysisView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView); @@ -315,7 +317,6 @@ namespace OHOS return true; } - /** * 视图映射结构体 - 将视图ID映射到对应的视图切换函数 */ @@ -377,4 +378,4 @@ namespace OHOS container_->Invalidate(); } - } +}