From: xue <2144439972@qq.com> Date: Tue, 17 Jun 2025 07:05:21 +0000 (+0800) Subject: 校准完成界面 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=29eff7d2de58a519763c852097e0828b7f97c655;p=mirrors%2FFD230.git 校准完成界面 --- diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 73c38eb64..c960dfed9 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -231,6 +231,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPCalibrationPassView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPCalibrationErrorView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPCalibrationMindView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPSecUnderCalibrationView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPMainView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPMainPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPModel.cpp diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPCalibrationErrorView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPCalibrationErrorView.h new file mode 100644 index 000000000..d6d4eedd8 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPCalibrationErrorView.h @@ -0,0 +1,38 @@ + +#ifndef BP_CALIBRATIONERROR_VIEW_H +#define BP_CALIBRATIONERROR_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 BPCalibrationErrorView + { + public: + BPCalibrationErrorView(); + ~BPCalibrationErrorView(); + static BPCalibrationErrorView *GetInstance(); + UIViewGroup * BPCalibrationErrorInit(); + void DeInit(); + bool AddButton(); + bool InitLable(); + bool Initbackground(); + + void UpSPO2Text(void); + + private: + UIImageView *error = nullptr; + UILabelExt *titleLable = nullptr; + UILabelExt *resultremindLable = nullptr; + UILabelButton *checkButton{nullptr}; + UIViewGroup *group{nullptr}; + }; +} + +#endif // 校准失败界面 \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPCalibrationPassView.h b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPCalibrationPassView.h new file mode 100644 index 000000000..0171aa41c --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPCalibrationPassView.h @@ -0,0 +1,38 @@ + +#ifndef BP_CALIBRATIONPASS_VIEW_H +#define BP_CALIBRATIONPASS_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 BPCalibrationPassView + { + public: + BPCalibrationPassView(); + ~BPCalibrationPassView(); + static BPCalibrationPassView *GetInstance(); + UIViewGroup * BPCalibrationPassInit(); + void DeInit(); + bool AddButton(); + bool InitLable(); + bool Initbackground(); + + void UpSPO2Text(void); + + private: + UIImageView *pass = nullptr; + UILabelExt *titleLable = nullptr; + UILabelExt *resultremindLable = 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/BPCalibrationErrorView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPCalibrationErrorView.cpp new file mode 100644 index 000000000..c4a5ca33e --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPCalibrationErrorView.cpp @@ -0,0 +1,147 @@ +/*** + * @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/BPCalibrationErrorView.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/BPCalibrationErrorView.h" +namespace OHOS +{ + static BPCalibrationErrorView *g_pBPCalibrationErrorView{nullptr}; + static const char *BPBACKPATH = "/user/res/BPCalibration/error.bin"; + + BPCalibrationErrorView::BPCalibrationErrorView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPCalibrationErrorView::BPCalibrationErrorView"); + g_pBPCalibrationErrorView = this; + } + BPCalibrationErrorView::~BPCalibrationErrorView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPCalibrationErrorView::~BPCalibrationErrorView"); + DeInit(); + g_pBPCalibrationErrorView = nullptr; + } + BPCalibrationErrorView *BPCalibrationErrorView::GetInstance() + { + return g_pBPCalibrationErrorView; + } + void BPCalibrationErrorView::DeInit() + { + if(group) + { + group->RemoveAll(); + delete group; + group = nullptr; + } + if (error != nullptr) + { + delete error; + error = nullptr; + } + if (titleLable != nullptr) + { + delete titleLable; + titleLable = nullptr; + } + if (resultremindLable != nullptr) + { + delete resultremindLable; + resultremindLable= nullptr; + } + if (checkButton != nullptr) + { + delete checkButton; + checkButton = nullptr; + } + } + /* -------------------------------------------------------------------------- */ + void BPCalibrationErrorView::UpSPO2Text() + { + + } + /* -------------------------------------------------------------------------- */ + /*** + * @description: + * @return 添加按键是否成功 + */ + bool BPCalibrationErrorView::AddButton() + { + InitLabelButton(checkButton, 125, 365, 217, 63, "errorcheckButton", "重新校准", 35); + checkButton->SetViewId("errorcheckButton"); + 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 BPCalibrationErrorView::InitLable() + { + + InitLabel(titleLable, 165, 38, 165, 45, "titleLable", "校准失败", DEFAULT_VECTOR_FONT_FILENAME, 36); + InitLabel(resultremindLable, 64, 113, 337, 70, "resultremindLable", "校准失败,请重新校准", DEFAULT_VECTOR_FONT_FILENAME, 32); + resultremindLable->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + resultremindLable->SetTextColor(Color::Red()); + /*初始化检测时间*/ + group->Add(titleLable); + group->Add(resultremindLable); + + return true; + } + /*** + * @description: + * @return 初始化背景是否成功 + */ + bool BPCalibrationErrorView::Initbackground() + { + error = new UIImageView(); + error->SetPosition(125, 160, 200, 200); + error->SetSrc(BPBACKPATH); + group->Add(error); + return true; + } + /*** + * @description: + * @return 是否初始化成功 + */ + UIViewGroup *BPCalibrationErrorView::BPCalibrationErrorInit() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bool BPCalibrationErrorView::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; + } + +} diff --git a/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPCalibrationPassView.cpp b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPCalibrationPassView.cpp new file mode 100644 index 000000000..da7ac069f --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPCalibrationPassView.cpp @@ -0,0 +1,147 @@ +/*** + * @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/BPCalibrationPassView.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/BPCalibrationPassView.h" +namespace OHOS +{ + static BPCalibrationPassView *g_pBPCalibrationPassView{nullptr}; + static const char *BPBACKPATH = "/user/res/BPCalibration/right.bin"; + + BPCalibrationPassView::BPCalibrationPassView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPCalibrationPassView::BPCalibrationPassView"); + g_pBPCalibrationPassView = this; + } + BPCalibrationPassView::~BPCalibrationPassView() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPCalibrationPassView::~BPCalibrationPassView"); + DeInit(); + g_pBPCalibrationPassView = nullptr; + } + BPCalibrationPassView *BPCalibrationPassView::GetInstance() + { + return g_pBPCalibrationPassView; + } + void BPCalibrationPassView::DeInit() + { + if(group) + { + group->RemoveAll(); + delete group; + group = nullptr; + } + if (pass != nullptr) + { + delete pass; + pass = nullptr; + } + if (titleLable != nullptr) + { + delete titleLable; + titleLable = nullptr; + } + if (resultremindLable != nullptr) + { + delete resultremindLable; + resultremindLable= nullptr; + } + if (checkButton != nullptr) + { + delete checkButton; + checkButton = nullptr; + } + } + /* -------------------------------------------------------------------------- */ + void BPCalibrationPassView::UpSPO2Text() + { + + } + /* -------------------------------------------------------------------------- */ + /*** + * @description: + * @return 添加按键是否成功 + */ + bool BPCalibrationPassView::AddButton() + { + InitLabelButton(checkButton, 125, 365, 217, 63, "passcheckButton", "确认", 35); + checkButton->SetViewId("passcheckButton"); + 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 BPCalibrationPassView::InitLable() + { + + InitLabel(titleLable, 165, 38, 165, 45, "titleLable", "校准完成", DEFAULT_VECTOR_FONT_FILENAME, 36); + InitLabel(resultremindLable, 64, 113, 337, 70, "resultremindLable", "校准结果已上传,30天后可重新校准", DEFAULT_VECTOR_FONT_FILENAME, 32); + resultremindLable->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); + resultremindLable->SetTextColor(Color::Red()); + /*初始化检测时间*/ + group->Add(titleLable); + group->Add(resultremindLable); + + return true; + } + /*** + * @description: + * @return 初始化背景是否成功 + */ + bool BPCalibrationPassView::Initbackground() + { + pass = new UIImageView(); + pass->SetPosition(125, 160, 200, 200); + pass->SetSrc(BPBACKPATH); + group->Add(pass); + return true; + } + /*** + * @description: + * @return 是否初始化成功 + */ + UIViewGroup *BPCalibrationPassView::BPCalibrationPassInit() + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bool BPCalibrationPassView::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; + } + +}