From: xue <2144439972@qq.com> Date: Tue, 17 Jun 2025 07:06:17 +0000 (+0800) Subject: 校准提醒界面 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=518f1a9dbcf746f2351111317a8d37a2c12c5453;p=mirrors%2FFD230.git 校准提醒界面 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPCalibrationMindView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPCalibrationMindView.h new file mode 100644 index 000000000..d7bd058c1 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPCalibrationMindView.h @@ -0,0 +1,39 @@ + +#ifndef BP_CALIBRATIONMIND_VIEW_H +#define BP_CALIBRATIONMIND_VIEW_H + +#include "components/ui_label.h" +#include "components/ui_label_ext.h" +#include "components/ui_button.h" +#include "components/ui_label_button.h" +#include "components/ui_view_group.h" +#include "components/ui_scroll_view.h" +#include "components/ui_label_button_ext.h" +namespace OHOS +{ + + class BPCalibrationMindView + { + public: + BPCalibrationMindView(); + ~BPCalibrationMindView(); + static BPCalibrationMindView *GetInstance(); + UIViewGroup *BPCalibrationMindInit(); + void DeInit(); + bool AddButton(); + bool InitLable(); + bool Initbackground(); + + void UpSPO2Text(void); + + private: + UIImageView *background = nullptr; + UIImageView *mind = nullptr; + UILabelExt *titleLabel = nullptr; + UILabelExt *mindLabel = nullptr; + UILabelButton *checkButton{nullptr}; + UIViewGroup *group{nullptr}; + }; +} + +#endif // 血压主界面 \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPCalibrationMindView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPCalibrationMindView.cpp new file mode 100644 index 000000000..bf13d0131 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPCalibrationMindView.cpp @@ -0,0 +1,155 @@ +/*** + * @Date: 2024-04-15 10:55:58 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-07-31 14:36:25 + * @FilePath: /FD230/code/sdk/application/wearable/fd230/nativeapp/nativeui/bloodpressure/src/BPCalibrationMindView.cpp + */ + +#include "ui_resource_image.h" +#include "UiConfig.h" +#include "wearable_log.h" +#include "uicomponents/UIComponents.h" +#include "bloodpressure/include/BPMainPresenter.h" +#include "bloodpressure/include/BPCalibrationMindView.h" +namespace OHOS +{ + static BPCalibrationMindView *g_pBPCalibrationMindView{nullptr}; + static const char *BPBACKPATH = "/user/res/BPCalibration/W.bin"; + static const char *MINDPATH = "/user/res/BPCalibration/Y.bin"; + BPCalibrationMindView::BPCalibrationMindView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPCalibrationMindView::BPCalibrationMindView"); + g_pBPCalibrationMindView = this; + } + BPCalibrationMindView::~BPCalibrationMindView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPCalibrationMindView::~BPCalibrationMindView"); + DeInit(); + g_pBPCalibrationMindView = nullptr; + } + BPCalibrationMindView *BPCalibrationMindView::GetInstance() + { + return g_pBPCalibrationMindView; + } + void BPCalibrationMindView::DeInit() + { + if(group) + { + group->RemoveAll(); + delete group; + group = nullptr; + } + if (background != nullptr) + { + delete background; + background = nullptr; + } + if (mind != nullptr) + { + delete mind; + mind = nullptr; + } + if (titleLabel != nullptr) + { + delete titleLabel; + titleLabel = nullptr; + } + if (mindLabel != nullptr) + { + delete mindLabel; + mindLabel = nullptr; + } + if (checkButton != nullptr) + { + delete checkButton; + checkButton = nullptr; + } + } + /* -------------------------------------------------------------------------- */ + void BPCalibrationMindView::UpSPO2Text() + { + } + /* -------------------------------------------------------------------------- */ + /*** + * @description: + * @return 添加按键是否成功 + */ + bool BPCalibrationMindView::AddButton() + { + InitLabelButton(checkButton, 125, 365, 217, 63, "mindcheckButton", "我已测完", 35); + checkButton->SetViewId("mindcheckButton"); + checkButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); // 设置按键颜色 + checkButton->SetTextColor(Color::White()); + // 设置按键监听 + UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance(); + checkButton->SetOnClickListener(clickListener); + + group->Add(checkButton); + return true; + } + /*** + * @description: + * @return 初始化标签是否成功 + */ + bool BPCalibrationMindView::InitLable() + { + + InitLabel(titleLabel, 83, 40, 300, 45, "calibration", "校准提醒", DEFAULT_VECTOR_FONT_FILENAME, 36); + InitLabel(mindLabel, 81, 101, 300, 70, "calibration", "请用传统血压计测量同一只手", DEFAULT_VECTOR_FONT_FILENAME, 32); + /*初始化检测时间*/ + group->Add(titleLabel); + group->Add(mindLabel); + + return true; + } + /*** + * @description: + * @return 初始化背景是否成功 + */ + bool BPCalibrationMindView::Initbackground() + { + background = new UIImageView(); + background->SetPosition(0, 62, 466,342); + background->SetSrc(BPBACKPATH); + + mind = new UIImageView(); + mind->SetPosition(73, 171 ,285, 176); + mind->SetSrc(MINDPATH); + + group->Add(background); + group->Add(mind); + return true; + } + /*** + * @description: + * @return 是否初始化成功 + */ + UIViewGroup *BPCalibrationMindView::BPCalibrationMindInit() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bool BPCalibrationMindView::InitView()"); + group = new UIViewGroup(); + if (group == nullptr) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPopUpView::group null!"); + return nullptr; + } + group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); + if (!Initbackground()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Initbackground error!"); + return nullptr; + }; + if (!InitLable()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLable error!"); + return nullptr; + }; + if (!AddButton()) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AddButton error!"); + return nullptr; + }; + return group; + } + +}