From 4dc64fba19c0b3932c5f0545de7a01ae4fca068a Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Thu, 19 Jun 2025 10:39:37 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E5=86=85=E5=AD=98=E6=B3=84?= =?utf8?q?=E6=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../bloodpressure/src/BPValueView.cpp | 60 +++++++++---------- .../nativeui/settings/src/SettingModel.cpp | 2 +- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPValueView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPValueView.cpp index 2bb2fe5e7..4cb5ea0fc 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPValueView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPValueView.cpp @@ -17,8 +17,6 @@ namespace OHOS static const char *BPBACKPATH = "/user/res/BPCalibration/W.bin"; static const char *LEFTPATH = "/user/res/BPCalibration/decrease_button.bin"; static const char *RIGHTPATH = "/user/res/BPCalibration/increase_button.bin"; - - BPValueView::BPValueView() { @@ -37,8 +35,12 @@ namespace OHOS } void BPValueView::DeInit() { - if(group) + if (group) { + group->RemoveAll(); + delete group; + group = nullptr; + } if (background != nullptr) { delete background; @@ -64,22 +66,22 @@ namespace OHOS delete valuecheckButton; valuecheckButton = nullptr; } - if (SBPLeft != nullptr) + if (SBPLeft != nullptr) { delete SBPLeft; SBPLeft = nullptr; } - if (SBPRight != nullptr) + if (SBPRight != nullptr) { delete SBPRight; SBPRight = nullptr; } - if (DBPLeft != nullptr) + if (DBPLeft != nullptr) { delete DBPLeft; DBPLeft = nullptr; } - if (DBPRight != nullptr) + if (DBPRight != nullptr) { delete DBPRight; DBPRight = nullptr; @@ -94,10 +96,6 @@ namespace OHOS delete DBPValue; DBPValue = nullptr; } - group->RemoveAll(); - delete group; - group = nullptr; - } } /*** @@ -123,7 +121,7 @@ namespace OHOS */ bool BPValueView::InitLable() { - + InitLabel(titleLabel, 109, 38, 239, 35, "title", "请输入血压计量", DEFAULT_VECTOR_FONT_FILENAME, 30); InitLabel(SBPLabel, 63, 170, 100, 29, "SBP", "收缩压", DEFAULT_VECTOR_FONT_FILENAME, 30); InitLabel(DBPLabel, 63, 270, 100, 29, "DBP", "舒张压", DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -133,7 +131,6 @@ namespace OHOS SBPValue->SetTextColor(Color::Red()); DBPValue->SetTextColor(Color::Red()); - /*初始化检测时间*/ group->Add(titleLabel); group->Add(SBPLabel); @@ -147,7 +144,7 @@ namespace OHOS void BPValueView::UpDateVauleText(BP_VALUE_TYPE type) { - if(SBPValue == nullptr || DBPValue == nullptr) + if (SBPValue == nullptr || DBPValue == nullptr) { return; } @@ -172,37 +169,36 @@ namespace OHOS bool BPValueView::Initbackground() { background = new UIImageView(); - background->SetPosition(0, 62, 466,342); + background->SetPosition(0, 62, 466, 342); background->SetSrc(BPBACKPATH); SBPLeft = new UIImageView(); SBPLeft->SetPosition(199, 160, 31, 35); - SBPLeft->SetSrc(LEFTPATH); - SBPLeft->SetViewId("SBPLeft"); + SBPLeft->SetSrc(LEFTPATH); + SBPLeft->SetViewId("SBPLeft"); SBPLeft->SetTouchable(true); UIView::OnClickListener *clickListener_SBPLeft = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance(); - SBPLeft->SetOnClickListener(clickListener_SBPLeft); - + SBPLeft->SetOnClickListener(clickListener_SBPLeft); SBPRight = new UIImageView(); SBPRight->SetPosition(385, 160, 31, 35); - SBPRight->SetSrc(RIGHTPATH); - SBPRight->SetViewId("SBPRight"); + SBPRight->SetSrc(RIGHTPATH); + SBPRight->SetViewId("SBPRight"); SBPRight->SetTouchable(true); UIView::OnClickListener *clickListener_SBPRight = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance(); - SBPRight->SetOnClickListener(clickListener_SBPRight); + SBPRight->SetOnClickListener(clickListener_SBPRight); DBPLeft = new UIImageView(); - DBPLeft->SetPosition(199, 278, 31, 35); - DBPLeft->SetSrc(LEFTPATH); - DBPLeft->SetViewId("DBPLeft"); + DBPLeft->SetPosition(199, 278, 31, 35); + DBPLeft->SetSrc(LEFTPATH); + DBPLeft->SetViewId("DBPLeft"); DBPLeft->SetTouchable(true); UIView::OnClickListener *clickListener_DBPLeft = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance(); DBPLeft->SetOnClickListener(clickListener_DBPLeft); DBPRight = new UIImageView(); - DBPRight->SetPosition(385, 278, 31, 35); - DBPRight->SetSrc(RIGHTPATH); + DBPRight->SetPosition(385, 278, 31, 35); + DBPRight->SetSrc(RIGHTPATH); DBPRight->SetViewId("DBPRight"); DBPRight->SetTouchable(true); UIView::OnClickListener *clickListener_DBPRight = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance(); @@ -232,20 +228,20 @@ namespace OHOS if (!Initbackground()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Initbackground error!"); - return nullptr; + return nullptr; }; if (!InitLable()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "InitLable error!"); - return nullptr; + return nullptr; }; if (!AddButton()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AddButton error!"); - return nullptr; + return nullptr; }; - + return group; } - + } diff --git a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp index 98467b224..5d7bff03e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/settings/src/SettingModel.cpp @@ -35,7 +35,7 @@ namespace OHOS { int index = 0; settings[index++] = {VIEW_SETTING, nullptr, STR_SETTINGS, false};//标题:设置 - #if defined(BOARD_W9) || defined(BOARD_N9) || 1 + #if defined(BOARD_W9) || defined(BOARD_N9) settings[index++] = {VIEW_BLOOD_PRESSURE_CALIBRATION, PNG_APPLIST_BP_IMAGE, STR_BP_CALIBRATE, true};//血压检测 #endif settings[index++] = {VIEW_DISPLAY_BRIGHTNESS, PNG_SETTINGS_DISPLAY_BRIGHTNESS, STR_SCREEN_AND_BRIGHTNESS, true}; -- 2.17.1