From: xue <2144439972@qq.com> Date: Tue, 17 Jun 2025 07:11:00 +0000 (+0800) Subject: 增加界面 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=7757ea8cfc5ac5cf7b465328b82c5a156d618588;p=mirrors%2FFD230.git 增加界面 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPMainView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPMainView.h index b9eb71e4c..8d3aebb53 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPMainView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPMainView.h @@ -11,6 +11,7 @@ #include "bloodpressure/include/BPCalibrationMindView.h" #include "bloodpressure/include/BPCalibrationErrorView.h" #include "bloodpressure/include/BPUnderCalibrationView.h" +#include "bloodpressure/include/BPSecUnderCalibrationView.h" #include "bloodpressure/include/BPValueView.h" #include "bloodpressure/include/BPCalPosReqView.h" namespace OHOS @@ -19,6 +20,7 @@ namespace OHOS { BPCALIBRATIONVIEW = 0, // 主界面 BPUNDERCALIBRATIONVIEW, // BP校准界面 + BPSECUNDERCALIBRATIONVIEW, // 二次校准界面 BPVALUEVIEW, // 血压输入界面 BPCALIBRATIONPASSVIEW, //校准成功界面 BPCALIBRATIONERRORVIEW, //校准失败界面 @@ -41,6 +43,7 @@ namespace OHOS bool ChangeBPCalibrationView(int16_t); bool ChangeBPUnderCalibrationView(int16_t); + bool ChangeBPSecUnderCalibrationView(int16_t); bool ChangeBPValueView(int16_t); bool ChangeBPCalibrationPassView(int16_t); bool ChangeBPCalibrationErrorView(int16_t); @@ -54,6 +57,7 @@ namespace OHOS private: BPCalibrationView *p_BPCalibrationView{nullptr}; BPUnderCalibrationView *p_BPUnderCalibrationView{nullptr}; + BPSecUnderCalibrationView *p_SecBPUnderCalibrationView{nullptr}; BPValueView *g_pBPValueView{nullptr}; BPCalibrationPassView *g_pBPCalibrationPassView{nullptr}; BPCalibrationErrorView *g_pBPCalibrationErrorView{nullptr}; diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPValueView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPValueView.h index 7c45eff8b..4be0b9eac 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPValueView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPValueView.h @@ -9,6 +9,9 @@ #include "components/ui_view_group.h" #include "components/ui_scroll_view.h" #include "components/ui_label_button_ext.h" + +#define BP_VALUE 120 + namespace OHOS { @@ -38,7 +41,6 @@ namespace OHOS UIImageView *SBPRight{nullptr}; UIImageView *DBPLeft{nullptr}; UIImageView *DBPRight{nullptr}; - UIViewGroup *group{nullptr}; }; } 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 e62e0fc7a..a4fd377f9 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainView.cpp @@ -75,11 +75,17 @@ namespace OHOS { delete g_pBPCalibrationMindView; g_pBPCalibrationMindView = nullptr; + } if (p_BPCalPosReqView) { delete p_BPCalPosReqView; p_BPCalPosReqView = nullptr; } + if (g_pBPSecUnderCalibrationView) + { + delete g_pBPSecUnderCalibrationView; + g_pBPSecUnderCalibrationView = nullptr; + } } void BPMainView::OnStart() @@ -169,6 +175,24 @@ namespace OHOS } return true; } + bool BPMainView::ChangeSecBPUnderCalibrationView(int16_t thisView) + { + // 检查视图是否已初始化 + if (group[thisView] == nullptr) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeSecUnderInitialCalibrationView"); + p_SecBPUnderCalibrationView = new SecBPUnderCalibrationView(); + if (p_SecBPUnderCalibrationView == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView); + return false; + } + // 初始化视图并添加到视图组 + group[thisView] = p_SecBPUnderCalibrationView->SecBPUnderCalibrationInit(); + container_->Add(group[thisView]); + } + return true; + } bool BPMainView::ChangeBPValueView(int16_t thisView) { @@ -277,6 +301,7 @@ namespace OHOS static const BPViewMapper ViewMapper[] = { {BPCALIBRATIONVIEW, &BPMainView::ChangeBPCalibrationView}, {BPUNDERCALIBRATIONVIEW, &BPMainView::ChangeBPUnderCalibrationView}, + {SECBPUNDERCALIBRATIONVIEW, &BPMainView::ChangeSecBPUnderCalibrationView}, {BPVALUEVIEW, &BPMainView::ChangeBPValueView}, {BPCALIBRATIONPASSVIEW, &BPMainView::ChangeBPCalibrationPassView}, {BPCALIBRATIONERRORVIEW, &BPMainView::ChangeBPCalibrationErrorView}, 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 a4ce6b7f0..8dfc9c31f 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,8 @@ namespace OHOS static const char *BPBACKPATH = "/user/res/BPCalibration/calibration_background.bin"; static const char *LEFTPATH = "/user/res/BPCalibration/decrease_button.bin"; static const char *RIGHTPATH = "/user/res/BPCalibration/increase_button.bin"; - int16_t BPValueView::SBP=120; - int16_t BPValueView::DBP=120; + int16_t BPValueView::SBP=BP_VALUE; + int16_t BPValueView::DBP=BP_VALUE; BPValueView::BPValueView() @@ -93,38 +93,6 @@ namespace OHOS /* -------------------------------------------------------------------------- */ void BPValueView::UpSPO2Text() { - // // if (bloodLabel == nullptr || timeLabel == nullptr) - // // return; - - // // 更新血氧数据 - // uint16_t spo2 = BPModel::GetInstance()->GetSPO2data(); - // if (spo2 != 0) // 判断是否为默认数据 - // { - // // 更新数据 - // std::string bloodpressureStr = std::to_string(spo2) + "%"; - // // bloodLabel->SetText(bloodpressureStr.c_str()); - - // // 获取时间差 - // uint32_t time = BPMainPresenter::GetInstance()->GetCurrentTime(); - // uint32_t check_time = BPModel::GetInstance()->GetCheckTime(); - // int time_diff = BPMainPresenter::GetInstance()->GetTDOA(time, check_time); - - // if (time_diff == 0) - // { - // timeLabel->SetTextId(STR_CHECKNEW); - // } - // else if (time_diff <= 60) - // { - // UpdateLabel(timeLabel, time_diff, STR_CHECKTIME); - // } - // else - // { - // timeLabel->SetTextId(STR_CHECKLONG); - // } - // } - // else - // { - // } } /* -------------------------------------------------------------------------- */ /*** @@ -133,9 +101,9 @@ namespace OHOS */ bool BPValueView::AddButton() { - InitLabelButton(valuecheckButton, 125, 365, 217, 63, "checkButton", "确认", 35); + InitLabelButton(valuecheckButton, 125, 365, 217, 63, "value_check", "确认", 35); valuecheckButton->SetViewId("value_check"); - valuecheckButton->SetStyle(STYLE_BACKGROUND_COLOR, 0x19191919); // 设置按键颜色 + valuecheckButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); // 设置按键颜色 valuecheckButton->SetTextColor(Color::Red()); // 设置按键监听 UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance(); @@ -152,8 +120,8 @@ namespace OHOS { InitLabel(titleLabel, 109, 38, 239, 35, "title", "血压校准", DEFAULT_VECTOR_FONT_FILENAME, 35); - InitLabel(SBPLabel, 63, 163, 85, 29, "SBP", "收缩压", DEFAULT_VECTOR_FONT_FILENAME, 30); - InitLabel(DBPLabel, 63, 282, 85, 29, "DBP", "舒张压", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabel(SBPLabel, 63, 160, 100, 29, "SBP", "收缩压", DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabel(DBPLabel, 63, 280, 100, 29, "DBP", "舒张压", DEFAULT_VECTOR_FONT_FILENAME, 30); /*初始化检测时间*/ group->Add(titleLabel); group->Add(SBPLabel); @@ -173,15 +141,18 @@ namespace OHOS 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->SetTouchable(true); UIView::OnClickListener *clickListener_SBPRight = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance(); SBPRight->SetOnClickListener(clickListener_SBPRight); @@ -189,6 +160,7 @@ namespace OHOS 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); @@ -196,6 +168,7 @@ namespace OHOS DBPRight->SetPosition(385, 278, 31, 35); DBPRight->SetSrc(RIGHTPATH); DBPRight->SetViewId("DBPRight"); + DBPRight->SetTouchable(true); UIView::OnClickListener *clickListener_DBPRight = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance(); DBPRight->SetOnClickListener(clickListener_DBPRight); @@ -214,12 +187,14 @@ namespace OHOS { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bool BPValueView::InitView()"); group = new UIViewGroup(); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPValueInit 222"); if (group == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPopUpView::group null!"); return nullptr; } group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPValueInit 333"); if (!Initbackground()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Initbackground error!"); @@ -235,8 +210,10 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AddButton error!"); return nullptr; }; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPValueInit 111"); SBP=120; DBP=120; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPValueInit succss"); return group; }