${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPDetectBeginView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPDetectEndView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPCalPosReqView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodpressure/src/BPLastCalibrationTimeView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothDeviceCaseListAdapter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothDeviceListView.cpp
namespace OHOS
{
- static constexpr char *STARTCALIBRATIONBUTTON = "startCalibrationButton"; // 校准按钮
+ static constexpr const char *STARTCALIBRATIONBUTTON = "startCalibrationButton"; // 校准按钮
class BPCalPosReqView
{
public:
--- /dev/null
+#ifndef BPLASTCALIBRATIONTIMEVIEW_H
+#define BPLASTCALIBRATIONTIMEVIEW_H
+#include "components/ui_label_ext.h"
+#include "components/ui_button.h"
+#include "components/ui_label_button_ext.h"
+#include "components/ui_image_view.h"
+#include "components/ui_view_group.h"
+#include "components/ui_scroll_view.h"
+
+namespace OHOS
+{
+ static constexpr char *CALIBRATIONLATTERBUTTON = "CalibrationLatterButton"; // 稍后校准按钮
+ static constexpr char *CALIBRATIONBUTTON = "CalibrationButton"; // 去校准按钮
+ class BPLastCalibrationTimeView
+ {
+ public:
+ BPLastCalibrationTimeView();
+ ~BPLastCalibrationTimeView();
+ static BPLastCalibrationTimeView *GetInstance();
+ UIViewGroup *InitBPLastCalibrationTimeView();
+ void UpdateCalibrationTime(std::string time);
+
+ private:
+ void DeInit();
+ UIViewGroup *group{nullptr};
+ UILabelExt *titleLabel{nullptr};
+ UILabelExt *timeLabel{nullptr};
+ UILabelExt *label1{nullptr};
+ UILabelExt *label2{nullptr};
+ UILabelButtonExt *calibrationlatterbutton{nullptr}; // 稍后校准按钮
+ UILabelButtonExt *CalibrationButton{nullptr}; // 去校准按钮
+ };
+
+}
+#endif
\ No newline at end of file
#include "bloodpressure/include/BPSecUnderCalibrationView.h"
#include "bloodpressure/include/BPValueView.h"
#include "bloodpressure/include/BPCalPosReqView.h"
+#include "bloodpressure/include/BPLastCalibrationTimeView.h"
namespace OHOS
{
typedef enum : uint8_t
{
- BPCALIBRATIONVIEW = 0, // 主界面
- BPUNDERCALIBRATIONVIEW, // BP校准界面
- BPSECUNDERCALIBRATIONVIEW, // 二次校准界面
- BPVALUEVIEW, // 血压输入界面
- BPCALIBRATIONPASSVIEW, //校准成功界面
- BPCALIBRATIONERRORVIEW, //校准失败界面
- BPCALIBRATIONMINDVIEW, //校准提醒界面
- BPCALPOSREQVIEW, // 校准位置请求界面
+ BPCALIBRATIONVIEW = 0, // 主界面
+ BPUNDERCALIBRATIONVIEW, // BP校准界面
+ BPSECUNDERCALIBRATIONVIEW, // 二次校准界面
+ BPVALUEVIEW, // 血压输入界面
+ BPCALIBRATIONPASSVIEW, // 校准成功界面
+ BPCALIBRATIONERRORVIEW, // 校准失败界面
+ BPCALIBRATIONMINDVIEW, // 校准提醒界面
+ BPCALPOSREQVIEW, // 校准位置请求界面
+ BPLASTCALIBRATIONTIME, // 上次校准时间界面
MAX_BPVIEW,
} BPVIEWID;
bool ChangeBPCalibrationPassView(int16_t);
bool ChangeBPCalibrationErrorView(int16_t);
bool ChangeBPCalibrationMindView(int16_t);
-
bool ChangeBPCalPosReqView(int16_t);
+ bool ChangeBPLastCalibrationTimeView(int16_t);
bool ClickFunc(int16_t interface);
void ChangeView(int16_t hideView, int16_t showView);
BPCalibrationErrorView *g_pBPCalibrationErrorView{nullptr};
BPCalibrationMindView *g_pBPCalibrationMindView{nullptr};
BPCalPosReqView *p_BPCalPosReqView{nullptr};
+ BPLastCalibrationTimeView *p_BPLastCalibrationTimeView{nullptr};
private:
void DeInit();
--- /dev/null
+#include "bloodpressure/include/BPLastCalibrationTimeView.h"
+#include "bloodpressure/include/BPMainPresenter.h"
+#include "wearable_log.h"
+
+namespace OHOS
+{
+ static BPLastCalibrationTimeView *g_pBPLastCalibrationTimeView{nullptr};
+ BPLastCalibrationTimeView::BPLastCalibrationTimeView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPLastCalibrationTimeView::BPLastCalibrationTimeView");
+ g_pBPLastCalibrationTimeView = this;
+ }
+ BPLastCalibrationTimeView::~BPLastCalibrationTimeView()
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPLastCalibrationTimeView::~BPLastCalibrationTimeView");
+ DeInit();
+ g_pBPLastCalibrationTimeView = nullptr;
+ }
+
+ BPLastCalibrationTimeView *BPLastCalibrationTimeView::GetInstance()
+ {
+ return g_pBPLastCalibrationTimeView;
+ }
+
+ void BPLastCalibrationTimeView::DeInit()
+ {
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ delete titleLabel;
+ titleLabel = nullptr;
+ delete timeLabel;
+ timeLabel = nullptr;
+ delete label1;
+ label1 = nullptr;
+ delete label2;
+ label2 = nullptr;
+ delete calibrationlatterbutton;
+ calibrationlatterbutton = nullptr;
+ delete CalibrationButton;
+ CalibrationButton = nullptr;
+ }
+ }
+
+ // 更新校准时间
+ void BPLastCalibrationTimeView::UpdateCalibrationTime(std::string time)
+ {
+ if (timeLabel != nullptr)
+ {
+ std::string str = time;
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UpdateCalibrationTime: %s", str.c_str());
+ timeLabel->SetText(str.c_str());
+ timeLabel->Invalidate();
+ }
+ }
+
+ UIViewGroup *BPLastCalibrationTimeView::InitBPLastCalibrationTimeView()
+ {
+ if (group == nullptr)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group null!");
+ return nullptr;
+ }
+ }
+ group->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ UIView::OnDragListener *dragListener = (UIView::OnDragListener *)OHOS::BPMainPresenter::GetInstance();
+ group->SetOnDragListener(dragListener);
+ /* -------------------------------------------------------------------------- */
+ if (titleLabel == nullptr)
+ {
+ titleLabel = new UILabelExt();
+ if (titleLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "titleLabel null!");
+ return nullptr;
+ }
+ }
+ titleLabel->SetPosition((HORIZONTAL_RESOLUTION - 300) / 2, 50, 300, 35);
+ titleLabel->SetStyle(STYLE_TEXT_FONT, 30);
+ titleLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+ titleLabel->SetText("上次校准时间");
+ titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ titleLabel->SetRollSpeed(23);
+ titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ group->Add(titleLabel);
+ /* -------------------------------------------------------------------------- */
+ if (timeLabel == nullptr)
+ {
+ timeLabel = new UILabelExt();
+ if (timeLabel == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timeLabel null!");
+ return nullptr;
+ }
+ }
+ int y = titleLabel->GetY() + titleLabel->GetHeight() + 20;
+ timeLabel->SetPosition((HORIZONTAL_RESOLUTION - 300) / 2, y, 300, 30);
+ timeLabel->SetStyle(STYLE_TEXT_FONT, 26);
+ timeLabel->SetStyle(STYLE_LINE_HEIGHT, 35);
+ timeLabel->SetText("2025/05/21 09:59");
+ timeLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ timeLabel->SetRollSpeed(23);
+ timeLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ timeLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);
+ group->Add(timeLabel);
+ /* -------------------------------------------------------------------------- */
+ if (label1 == nullptr)
+ {
+ label1 = new UILabelExt();
+ if (label1 == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "label1 null!");
+ return nullptr;
+ }
+ }
+ label1->SetPosition((HORIZONTAL_RESOLUTION - 400) / 2, 180, 400, 35);
+ label1->SetStyle(STYLE_TEXT_FONT, 30);
+ label1->SetStyle(STYLE_LINE_HEIGHT, 35);
+ label1->SetText("建议每个月都重新校准!");
+ label1->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ label1->SetRollSpeed(23);
+ label1->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label1->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ group->Add(label1);
+ /* -------------------------------------------------------------------------- */
+ if (label2 == nullptr)
+ {
+ label2 = new UILabelExt();
+ if (label2 == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "label2 null!");
+ return nullptr;
+ }
+ }
+ int y1 = label1->GetY() + label1->GetHeight() + 5;
+ label2->SetPosition((HORIZONTAL_RESOLUTION - 400) / 2, y1, 400, 35);
+ label2->SetStyle(STYLE_TEXT_FONT, 30);
+ label2->SetStyle(STYLE_LINE_HEIGHT, 35);
+ label2->SetText("校准路径:设置-血压校准");
+ label2->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
+ label2->SetRollSpeed(23);
+ label2->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label2->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ group->Add(label2);
+ /* -------------------------------------------------------------------------- */
+ if (calibrationlatterbutton == nullptr)
+ {
+ calibrationlatterbutton = new UILabelButtonExt();
+ if (calibrationlatterbutton == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "calibrationlatterbutton null!");
+ return nullptr;
+ }
+ }
+ calibrationlatterbutton->SetPosition(58, 320, 170, 90);
+ calibrationlatterbutton->SetStyle(STYLE_TEXT_FONT, 30);
+ calibrationlatterbutton->SetStyle(STYLE_LINE_HEIGHT, 35);
+ calibrationlatterbutton->SetAlign(TEXT_ALIGNMENT_CENTER);
+ calibrationlatterbutton->SetText("取消");
+ calibrationlatterbutton->SetViewId(CALIBRATIONLATTERBUTTON);
+ calibrationlatterbutton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ calibrationlatterbutton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ calibrationlatterbutton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+ calibrationlatterbutton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ calibrationlatterbutton->SetOnClickListener((UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance());
+ group->Add(calibrationlatterbutton);
+ /* -------------------------------------------------------------------------- */
+ if (CalibrationButton == nullptr)
+ {
+ CalibrationButton = new UILabelButtonExt();
+ if (CalibrationButton == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "calibrationlatterbutton null!");
+ return nullptr;
+ }
+ }
+ CalibrationButton->SetPosition(238, 320, 170, 90);
+ CalibrationButton->SetStyle(STYLE_TEXT_FONT, 30);
+ CalibrationButton->SetStyle(STYLE_LINE_HEIGHT, 35);
+ CalibrationButton->SetAlign(TEXT_ALIGNMENT_CENTER);
+ CalibrationButton->SetText("校准");
+ CalibrationButton->SetViewId(CALIBRATIONBUTTON);
+ CalibrationButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffff8a36);
+ CalibrationButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ CalibrationButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+ CalibrationButton->SetStyleForState(STYLE_BACKGROUND_OPA, 0x00, UIButton::PRESSED);
+ CalibrationButton->SetOnClickListener((UIView::OnClickListener *)OHOS::BPMainPresenter::GetInstance());
+ group->Add(CalibrationButton);
+
+ return group;
+ }
+
+}
\ No newline at end of file
if (strcmp(view.GetViewId(), CLICK_BP) == 0)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CLICK_BP");
- BPMainView::GetInstance()->ChangeView(BPCALIBRATIONVIEW,BPUNDERCALIBRATIONVIEW);
-
+ BPMainView::GetInstance()->ChangeView(BPCALIBRATIONVIEW, BPUNDERCALIBRATIONVIEW);
}
- if (strcmp(view.GetViewId(), "value_check") == 0)
+ if (strcmp(view.GetViewId(), "value_check") == 0)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "value_check");
- BPMainView::GetInstance()->ChangeView(BPVALUEVIEW,BPCALIBRATIONPASSVIEW);
-
+ BPMainView::GetInstance()->ChangeView(BPVALUEVIEW, BPCALIBRATIONPASSVIEW);
}
- if (strcmp(view.GetViewId(), "SBPLeft") == 0)
+ if (strcmp(view.GetViewId(), "SBPLeft") == 0)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SBPLeft_BP");
-
+
BPValueView::SBP--;
-
}
- if (strcmp(view.GetViewId(),"SBPRight") == 0)
+ if (strcmp(view.GetViewId(), "SBPRight") == 0)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SBPRight");
-
+
BPValueView::SBP++;
-
}
- if (strcmp(view.GetViewId(),"DBPLeft") == 0)
+ if (strcmp(view.GetViewId(), "DBPLeft") == 0)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DBPLeft");
-
+
BPValueView::DBP--;
-
}
- if (strcmp(view.GetViewId(),"DBPRight") == 0)
+ if (strcmp(view.GetViewId(), "DBPRight") == 0)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DBPRight");
-
+
BPValueView::DBP++;
-
}
- if (strcmp(view.GetViewId(), "passcheckButton") == 0)
+ if (strcmp(view.GetViewId(), "passcheckButton") == 0)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "passcheckButton");
- BPMainView::GetInstance()->ChangeView(BPCALIBRATIONPASSVIEW,BPCALIBRATIONERRORVIEW);
-
+ BPMainView::GetInstance()->ChangeView(BPCALIBRATIONPASSVIEW, BPCALIBRATIONERRORVIEW);
}
if (strcmp(view.GetViewId(), "errorcheckButton") == 0)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "errorcheckButton");
- BPMainView::GetInstance()->ChangeView(BPCALIBRATIONERRORVIEW,BPCALIBRATIONMINDVIEW);
-
+ BPMainView::GetInstance()->ChangeView(BPCALIBRATIONERRORVIEW, BPCALIBRATIONMINDVIEW);
}
- if(strcmp(view.GetViewId(),STARTCALIBRATIONBUTTON) == 0)
+ if (strcmp(view.GetViewId(), STARTCALIBRATIONBUTTON) == 0)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "STARTCALIBRATIONBUTTON");
}
+ else if (strcmp(view.GetViewId(), CALIBRATIONLATTERBUTTON) == 0)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CALIBRATIONLATTERBUTTON");
+ }
+ else if (strcmp(view.GetViewId(), CALIBRATIONBUTTON) == 0)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CALIBRATIONBUTTON");
+ }
return true;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPPresenter::OnClick");
}
-
-
}
\ No newline at end of file
delete g_pBPSecUnderCalibrationView;
g_pBPSecUnderCalibrationView = nullptr;
}
+ if (p_BPLastCalibrationTimeView)
+ {
+ delete p_BPLastCalibrationTimeView;
+ p_BPLastCalibrationTimeView = nullptr;
+ }
}
void BPMainView::OnStart()
}
return true;
}
- bool BPMainView::ChangeBPSecUnderCalibrationView(int16_t thisView)
+ bool BPMainView::ChangeBPSecUnderCalibrationView(int16_t thisView)
{
// 检查视图是否已初始化
if (group[thisView] == nullptr)
// 检查视图是否已初始化
if (group[thisView] == nullptr)
{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeUnderInitialCalibrationView");
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPCalPosReqView");
p_BPCalPosReqView = new BPCalPosReqView();
if (p_BPCalPosReqView == nullptr)
{
return true;
}
+ bool BPMainView::ChangeBPLastCalibrationTimeView(int16_t thisView)
+ {
+ // 检查视图是否已初始化
+ if (group[thisView] == nullptr)
+ {
+ WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPLastCalibrationTimeView");
+ p_BPLastCalibrationTimeView = new BPLastCalibrationTimeView();
+ if (p_BPLastCalibrationTimeView == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView);
+ return false;
+ }
+ // 初始化视图并添加到视图组
+ group[thisView] = p_BPLastCalibrationTimeView->InitBPLastCalibrationTimeView();
+ container_->Add(group[thisView]);
+ }
+ return true;
+ }
+
bool BPMainView::ChangeBPCalibrationPassView(int16_t thisView)
{
// 检查视图是否已初始化
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);
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);
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);
return true;
}
-
/**
* 视图映射结构体 - 将视图ID映射到对应的视图切换函数
*/
{BPCALIBRATIONERRORVIEW, &BPMainView::ChangeBPCalibrationErrorView},
{BPCALIBRATIONMINDVIEW, &BPMainView::ChangeBPCalibrationMindView},
{BPCALPOSREQVIEW, &BPMainView::ChangeBPCalPosReqView},
+ {BPLASTCALIBRATIONTIME, &BPMainView::ChangeBPLastCalibrationTimeView},
};
bool BPMainView::ClickFunc(int16_t interface)
container_->Invalidate();
}
- }
+}