#include "bloodpressure/include/BPMainPresenter.h"
#include "bloodpressure/include/BPModel.h"
#include "components/ui_button.h"
+#include "UiConfig.h"
+#include "color.h"
#include "common/image_cache_manager.h"
#include "common/screen.h"
#include "uicomponents/UIComponents.h"
namespace {
static constexpr uint32_t BP_COLOR_LINE = 0xff333333;
-static constexpr int16_t BP_RESULT_LEFT_X = 56;
-static constexpr int16_t BP_RESULT_RIGHT_X = 56+233;
+static constexpr int16_t BP_RESULT_LEFT_X = 26;
+static constexpr int16_t BP_RESULT_RIGHT_X = 26 + 233;
+static constexpr int16_t BP_HISTORY_MAX_ITEMS = 10;
static constexpr int16_t BP_HISTORY_PULL_X = 213;
static constexpr int16_t BP_HISTORY_PULL_Y = 360;
static constexpr int16_t BP_HISTORY_PULL_W = 40;
static constexpr int16_t BP_HISTORY_PULL_H = 40;
static constexpr int16_t BP_HISTORY_PULL_NUM = 70;
static constexpr int16_t BP_HISTORY_PULL_DELAY = 100;
-static constexpr int16_t BP_HISTORY_MAX_ITEMS = 10;
static constexpr const char *BP_PULLUP_PATH = "/user/res/weather/PullUp/PullUp_";
+static constexpr int16_t BP_HISTORY_BTN_X = 93;
+static constexpr int16_t BP_HISTORY_BTN_Y = 330;
+static constexpr int16_t BP_HISTORY_BTN_W = 280;
+static constexpr int16_t BP_HISTORY_BTN_H = 90;
static constexpr const char *BP_NO_RECORD_IMAGE = "/user/res/Training/modules/Norecord.bin";
+static constexpr const char *BP_PHONE_IMAGE = "/user/res/bloodpressure/phone-white.bin";
} // namespace
static BPHistoryView *g_pBPHistoryView = nullptr;
BPHistoryView::BPHistoryView() { g_pBPHistoryView = this; }
BPHistoryView::~BPHistoryView() {
- StopArrowAnimation();
- UnloadPullDownAnimator();
ClearRecordPages();
if (group_ != nullptr) {
group_->RemoveAll();
delete recordSwipeView_;
+ delete recentPage_;
delete emptyPage_;
delete dotEntry_;
delete dotHistory_;
delete group_;
recordSwipeView_ = nullptr;
+ recentPage_ = nullptr;
emptyPage_ = nullptr;
dotEntry_ = nullptr;
dotHistory_ = nullptr;
group_ = nullptr;
}
+ recentTitleLabel_ = nullptr;
+ recentTimeLabel_ = nullptr;
+ recentHlineTop_ = nullptr;
+ recentHlineBottom_ = nullptr;
+ recentVlineMid_ = nullptr;
+ recentSbpTitle_ = nullptr;
+ recentDbpTitle_ = nullptr;
+ recentSbpValue_ = nullptr;
+ recentDbpValue_ = nullptr;
+ recentSbpUnit_ = nullptr;
+ recentDbpUnit_ = nullptr;
+ historyButton_ = nullptr;
emptyTitleLabel_ = nullptr;
emptyImage_ = nullptr;
emptyHintLabel_ = nullptr;
startMeasureButton_ = nullptr;
- pullDownAnimator_ = nullptr;
g_pBPHistoryView = nullptr;
}
//开始箭头动画
void BPHistoryView::StartArrowAnimation() {
- const auto &records = BPModel::GetInstance()->GetHistoryRecords();
- if (records.empty() || currentRecordIndex_ + 1 >= records.size()) {
+ if (!showingHistoryScroll_) {
StopArrowAnimation();
return;
}
- if (!pullDownInited_) {
- InitPullDownAnimator();
- }
- if (pullDownAnimator_ != nullptr) {
- pullDownAnimator_->SetVisible(true);
- pullDownAnimator_->Start();
- }
+ UpdateArrowVisibility();
}
//停止箭头动画
pullDownAnimator_->SetVisible(false);
}
}
-//创建记录页面
+
+void BPHistoryView::UpdateArrowVisibility() {
+ if (pullDownAnimator_ == nullptr) {
+ return;
+ }
+ if (!showingHistoryScroll_) {
+ pullDownAnimator_->SetVisible(false);
+ pullDownAnimator_->Stop();
+ return;
+ }
+ size_t totalPages = recordPages_.size();
+ bool hasNext = totalPages > 0 && currentRecordIndex_ + 1 < totalPages;
+ pullDownAnimator_->SetVisible(hasNext);
+ if (hasNext) {
+ pullDownAnimator_->Start();
+ } else {
+ pullDownAnimator_->Stop();
+ }
+}
+
+void BPHistoryView::InitRecentPage() {
+ recentPage_ = new UIViewGroup();
+ if (recentPage_ == nullptr) {
+ return;
+ }
+ recentPage_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+ recentPage_->SetDraggable(true);
+ recentPage_->SetTouchable(true);
+ recentPage_->SetOnDragListener(
+ static_cast<UIView::OnDragListener *>(BPMainPresenter::GetInstance()));
+
+ InitUILabel(recentTitleLabel_, 0, 50, 466, 35, "bp_recent_title", "最新记录",
+ DEFAULT_VECTOR_FONT_FILENAME, 30);
+ recentTitleLabel_->SetTextColor(Color::GetColorFromRGBA(0x4f, 0xc3, 0x4c, 0xff));
+ recentTitleLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+
+ InitUILabel(recentTimeLabel_, 0, 93, 466, 33, "bp_recent_time", "--",
+ DEFAULT_VECTOR_FONT_FILENAME, 28);
+ recentTimeLabel_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
+ recentTimeLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+
+ recentHlineTop_ = new UIImageView();
+ if (recentHlineTop_ != nullptr) {
+ recentHlineTop_->SetPosition(0, 158, 466, 2);
+ recentHlineTop_->SetStyle(STYLE_BACKGROUND_COLOR, BP_COLOR_LINE);
+ recentHlineTop_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ }
+ recentHlineBottom_ = new UIImageView();
+ if (recentHlineBottom_ != nullptr) {
+ recentHlineBottom_->SetPosition(0, 308, 466, 2);
+ recentHlineBottom_->SetStyle(STYLE_BACKGROUND_COLOR, BP_COLOR_LINE);
+ recentHlineBottom_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ }
+ recentVlineMid_ = new UIImageView();
+ if (recentVlineMid_ != nullptr) {
+ recentVlineMid_->SetPosition(233, 188, 2, 90);
+ recentVlineMid_->SetStyle(STYLE_BACKGROUND_COLOR, BP_COLOR_LINE);
+ recentVlineMid_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+ }
+
+ InitLabel(recentSbpTitle_, 0, 158 + 30 + 5, 233, 35, "bp_recent_sbp_title", "收缩压",
+ DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(recentDbpTitle_, 233, 158 + 30 + 5, 233, 35, "bp_recent_dbp_title", "舒张压",
+ DEFAULT_VECTOR_FONT_FILENAME, 30);
+ recentSbpTitle_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ recentDbpTitle_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ recentSbpTitle_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));
+ recentDbpTitle_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));
+
+ InitUILabel(recentSbpValue_, BP_RESULT_LEFT_X, 235, 88, 40, "bp_recent_sbp", "--",
+ DEFAULT_VECTOR_FONT_FILENAME, 40);
+ InitUILabel(recentDbpValue_, BP_RESULT_RIGHT_X, 235, 88, 40, "bp_recent_dbp", "--",
+ DEFAULT_VECTOR_FONT_FILENAME, 40);
+ recentSbpValue_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
+ recentDbpValue_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
+
+ InitUILabel(recentSbpUnit_, BP_RESULT_LEFT_X + 4 + 88, 253, 62, 25, "bp_recent_sbp_unit", "mmHg",
+ DEFAULT_VECTOR_FONT_FILENAME, 20);
+ InitUILabel(recentDbpUnit_, BP_RESULT_RIGHT_X + 4 + 88, 253, 62, 25, "bp_recent_dbp_unit", "mmHg",
+ DEFAULT_VECTOR_FONT_FILENAME, 20);
+ recentSbpUnit_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ recentDbpUnit_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ recentSbpUnit_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
+ recentDbpUnit_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
+
+ InitLabelButton(historyButton_, BP_HISTORY_BTN_X, BP_HISTORY_BTN_Y, BP_HISTORY_BTN_W, BP_HISTORY_BTN_H,
+ BP_CLICK_VIEW_HISTORY, "查看历史", 30);
+ historyButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ historyButton_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+ historyButton_->SetStyle(STYLE_BORDER_RADIUS, 45);
+ historyButton_->SetOnClickListener(
+ static_cast<UIView::OnClickListener *>(BPMainPresenter::GetInstance()));
+
+ recentPage_->Add(recentTitleLabel_);
+ recentPage_->Add(recentTimeLabel_);
+ if (recentHlineTop_ != nullptr) {
+ recentPage_->Add(recentHlineTop_);
+ }
+ if (recentVlineMid_ != nullptr) {
+ recentPage_->Add(recentVlineMid_);
+ }
+ recentPage_->Add(recentSbpTitle_);
+ recentPage_->Add(recentDbpTitle_);
+ recentPage_->Add(recentSbpValue_);
+ recentPage_->Add(recentDbpValue_);
+ recentPage_->Add(recentSbpUnit_);
+ recentPage_->Add(recentDbpUnit_);
+ if (recentHlineBottom_ != nullptr) {
+ recentPage_->Add(recentHlineBottom_);
+ }
+ recentPage_->Add(historyButton_);
+}
+
+void BPHistoryView::UpdateRecentPage() {
+ const auto &records = BPModel::GetInstance()->GetHistoryRecords();
+ if (records.empty() || recentTimeLabel_ == nullptr || recentSbpValue_ == nullptr ||
+ recentDbpValue_ == nullptr) {
+ return;
+ }
+ const BPRecord &record = records[0];
+ recentTimeLabel_->SetText(FormatRecordTime(record.timestamp).c_str());
+ recentSbpValue_->SetText(std::to_string(record.sbp).c_str());
+ recentDbpValue_->SetText(std::to_string(record.dbp).c_str());
+ recentSbpValue_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));
+ recentDbpValue_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));
+ if (IsHighBloodPressure(record.sbp, record.dbp)) {
+ recentSbpValue_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
+ recentDbpValue_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
+ }
+}
+
UIViewGroup *BPHistoryView::CreateRecordPage(const BPRecord &record, size_t index) {
UIViewGroup *page = new UIViewGroup();
if (page == nullptr) {
vlineMid->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
}
- InitLabel(sbpTitle, 0, 158+30+5, 233, 35, "bp_history_sbp_title", "收缩压",
+ InitLabel(sbpTitle, 0, 158 + 30 + 5, 233, 35, "bp_history_sbp_title", "收缩压",
DEFAULT_VECTOR_FONT_FILENAME, 30);
- InitLabel(dbpTitle, 233, 158+30+5, 233, 35, "bp_history_dbp_title", "舒张压",
+ InitLabel(dbpTitle, 233, 158 + 30 + 5, 233, 35, "bp_history_dbp_title", "舒张压",
DEFAULT_VECTOR_FONT_FILENAME, 30);
sbpTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
dbpTitle->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
std::string sbpStr = std::to_string(record.sbp);
std::string dbpStr = std::to_string(record.dbp);
- InitUILabel(sbpValue, BP_RESULT_LEFT_X, 250, 58, 28, "bp_history_sbp", sbpStr.c_str(),
+ InitUILabel(sbpValue, BP_RESULT_LEFT_X, 235, 88, 40, "bp_history_sbp", sbpStr.c_str(),
DEFAULT_VECTOR_FONT_FILENAME, 40);
- InitUILabel(dbpValue, BP_RESULT_RIGHT_X, 250, 58, 28, "bp_history_dbp", dbpStr.c_str(),
+ InitUILabel(dbpValue, BP_RESULT_RIGHT_X, 235, 88, 40, "bp_history_dbp", dbpStr.c_str(),
DEFAULT_VECTOR_FONT_FILENAME, 40);
- sbpValue->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- dbpValue->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ sbpValue->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
+ dbpValue->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
if (IsHighBloodPressure(record.sbp, record.dbp)) {
sbpValue->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
dbpValue->SetTextColor(Color::GetColorFromRGBA(0xff, 0x5a, 0x36, 0xff));
}
- InitUILabel(sbpUnit, BP_RESULT_LEFT_X+4, 264, 62, 14, "bp_history_sbp_unit", "mmHg",
+ InitUILabel(sbpUnit, BP_RESULT_LEFT_X + 4 + 88, 253, 62, 25, "bp_history_sbp_unit", "mmHg",
DEFAULT_VECTOR_FONT_FILENAME, 20);
- InitUILabel(dbpUnit, BP_RESULT_RIGHT_X+4, 264, 62, 14, "bp_history_dbp_unit", "mmHg",
+ InitUILabel(dbpUnit, BP_RESULT_RIGHT_X + 4 + 88, 253, 62, 25, "bp_history_dbp_unit", "mmHg",
DEFAULT_VECTOR_FONT_FILENAME, 20);
sbpUnit->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
dbpUnit->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
return page;
}
-//重建记录页面
+UIViewGroup *BPHistoryView::CreateTipPage() {
+ UIViewGroup *page = new UIViewGroup();
+ if (page == nullptr) {
+ return nullptr;
+ }
+ page->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
+
+ UILabel *titleLabel = nullptr;
+ UIImageView *phoneIcon = nullptr;
+ UILabel *hintLine1 = nullptr;
+ UILabel *hintLine2 = nullptr;
+ UILabelButton *tipOkButton = nullptr;
+
+ InitUILabel(titleLabel, 0, 50, 466, 35, "bp_history_tip_title", "提示",
+ DEFAULT_VECTOR_FONT_FILENAME, 30);
+ titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+
+ InitImageView(phoneIcon, 193, 120, 80, 80, "bp_history_tip_phone", BP_PHONE_IMAGE);
+
+ InitUILabel(hintLine1, 53, 240, 360, 35, "bp_history_tip_hint1", "在APP中查看完整血压记录",
+ DEFAULT_VECTOR_FONT_FILENAME, 28);
+ hintLine1->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+
+ InitUILabel(hintLine2, 53, 280, 360, 35, "bp_history_tip_hint2", "手表仅保留最近记录",
+ DEFAULT_VECTOR_FONT_FILENAME, 28);
+ hintLine2->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+
+ InitLabelButton(tipOkButton, BP_HISTORY_BTN_X, BP_HISTORY_BTN_Y, BP_HISTORY_BTN_W, BP_HISTORY_BTN_H,
+ BP_CLICK_HISTORY_TIP_OK, "知道了", 30);
+ tipOkButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+ tipOkButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+ tipOkButton->SetStyle(STYLE_BORDER_RADIUS, 45);
+ tipOkButton->SetOnClickListener(
+ static_cast<UIView::OnClickListener *>(BPMainPresenter::GetInstance()));
+
+ page->Add(titleLabel);
+ if (phoneIcon != nullptr) {
+ page->Add(phoneIcon);
+ }
+ page->Add(hintLine1);
+ page->Add(hintLine2);
+ page->Add(tipOkButton);
+ return page;
+}
+
void BPHistoryView::RebuildRecordPages() {
if (recordSwipeView_ == nullptr) {
return;
recordSwipeView_->Add(page);
recordPages_.push_back(page);
}
+ UIViewGroup *tipPage = CreateTipPage();
+ if (tipPage != nullptr) {
+ tipPage->SetViewIndex(static_cast<uint16_t>(count));
+ recordSwipeView_->Add(tipPage);
+ recordPages_.push_back(tipPage);
+ }
recordSwipeView_->SetCurrentPage(0, false);
currentRecordIndex_ = 0;
}
-//初始化空页面
void BPHistoryView::InitEmptyPage() {
emptyPage_ = new UIViewGroup();
if (emptyPage_ == nullptr) {
emptyPage_->Add(startMeasureButton_);
}
-//更新箭头可见性
-void BPHistoryView::UpdateArrowVisibility() {
- if (pullDownAnimator_ == nullptr) {
- return;
- }
- const auto &records = BPModel::GetInstance()->GetHistoryRecords();
- size_t count = records.size();
- if (count > BP_HISTORY_MAX_ITEMS) {
- count = BP_HISTORY_MAX_ITEMS;
- }
- bool hasNext = count > 0 && currentRecordIndex_ + 1 < count;
- pullDownAnimator_->SetVisible(hasNext);
- if (hasNext) {
- pullDownAnimator_->Start();
- } else {
- pullDownAnimator_->Stop();
- }
-}
-
-//更新页面可见性
void BPHistoryView::UpdatePageVisibility() {
const auto &records = BPModel::GetInstance()->GetHistoryRecords();
bool hasRecords = !records.empty();
- if (recordSwipeView_ != nullptr) {
- recordSwipeView_->SetVisible(hasRecords);
+ if (recentPage_ != nullptr) {
+ recentPage_->SetVisible(hasRecords && !showingHistoryScroll_);
}
- if (pullDownAnimator_ != nullptr) {
- pullDownAnimator_->SetVisible(hasRecords);
+ if (recordSwipeView_ != nullptr) {
+ recordSwipeView_->SetVisible(hasRecords && showingHistoryScroll_);
+ recordSwipeView_->SetDraggable(hasRecords && showingHistoryScroll_);
}
if (emptyPage_ != nullptr) {
emptyPage_->SetVisible(!hasRecords);
}
if (dotEntry_ != nullptr && dotHistory_ != nullptr) {
- dotEntry_->SetVisible(!hasRecords);
- dotHistory_->SetVisible(!hasRecords);
+ bool showDots = hasRecords && !showingHistoryScroll_;
+ dotEntry_->SetVisible(showDots);
+ dotHistory_->SetVisible(showDots);
+ }
+ UpdateArrowVisibility();
+}
+
+void BPHistoryView::ShowRecentPage() {
+ showingHistoryScroll_ = false;
+ UpdateRecentPage();
+ UpdatePageVisibility();
+ if (recordSwipeView_ != nullptr) {
+ recordSwipeView_->SetCurrentPage(0, false);
+ }
+ currentRecordIndex_ = 0;
+ if (group_ != nullptr) {
+ group_->Invalidate();
+ }
+}
+
+void BPHistoryView::ShowHistoryScroll() {
+ showingHistoryScroll_ = true;
+ RebuildRecordPages();
+ UpdatePageVisibility();
+ StartArrowAnimation();
+ if (group_ != nullptr) {
+ group_->Invalidate();
}
}
-//记录页面改变
void BPHistoryView::OnRecordPageChanged(uint16_t pageIndex) {
currentRecordIndex_ = pageIndex;
UpdateArrowVisibility();
}
}
-//刷新页面
void BPHistoryView::RefreshView() {
+ showingHistoryScroll_ = false;
+ UpdateRecentPage();
RebuildRecordPages();
UpdatePageVisibility();
- UpdateArrowVisibility();
if (group_ != nullptr) {
group_->Invalidate();
}
}
-//初始化页面
UIViewGroup *BPHistoryView::InitView() {
group_ = new UIViewGroup();
if (group_ == nullptr) {
recordSwipeView_->SetPosition(0, 0, Screen::GetInstance().GetWidth(),
Screen::GetInstance().GetHeight());
recordSwipeView_->SetAnimatorTime(50);
- recordSwipeView_->SetDraggable(true);
+ recordSwipeView_->SetDraggable(false);
recordSwipeView_->SetTouchable(true);
+ recordSwipeView_->SetVisible(false);
auto *presenter = static_cast<BPMainPresenter *>(BPMainPresenter::GetInstance());
recordSwipeView_->SetOnDragListener(presenter);
recordSwipeView_->SetOnSwipeListener(presenter);
InitPullDownAnimator();
+ InitRecentPage();
InitEmptyPage();
InitPageIndicator();
if (pullDownAnimator_ != nullptr) {
group_->Add(pullDownAnimator_);
}
+ if (recentPage_ != nullptr) {
+ group_->Add(recentPage_);
+ }
if (emptyPage_ != nullptr) {
group_->Add(emptyPage_);
}
#include "bloodpressure/include/BPMainPresenter.h"
#include "bloodpressure/include/BPModel.h"
#include "bloodpressure/include/BPViewClickIds.h"
+#include "UiConfig.h"
+#include "color.h"
#include "securec.h"
#include "uicomponents/UIComponents.h"
#include <ctime>
namespace {
static constexpr uint32_t BP_COLOR_LINE = 0xff333333;
-static constexpr int16_t BP_RESULT_COL_W = 170;
-static constexpr int16_t BP_RESULT_LEFT_X = 58;
-static constexpr int16_t BP_RESULT_RIGHT_X = 238;
+static constexpr int16_t BP_RESULT_LEFT_X = 26;
+static constexpr int16_t BP_RESULT_RIGHT_X = 26 + 233;
} // namespace
static BPMeasureResultView *g_instance = nullptr;
InitDividerLines();
- InitLabel(sbpTitle_, BP_RESULT_LEFT_X, 140, BP_RESULT_COL_W, 30, "bp_result_sbp_title", "收缩压",
- DEFAULT_VECTOR_FONT_FILENAME, 22);
- InitLabel(dbpTitle_, BP_RESULT_RIGHT_X, 140, BP_RESULT_COL_W, 30, "bp_result_dbp_title", "舒张压",
- DEFAULT_VECTOR_FONT_FILENAME, 22);
+ InitLabel(sbpTitle_, 0, 158 + 30 + 5, 233, 35, "bp_result_sbp_title", "收缩压",
+ DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(dbpTitle_, 233, 158 + 30 + 5, 233, 35, "bp_result_dbp_title", "舒张压",
+ DEFAULT_VECTOR_FONT_FILENAME, 30);
sbpTitle_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
dbpTitle_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
sbpTitle_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));
dbpTitle_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));
- InitUILabel(sbpValue_, BP_RESULT_LEFT_X, 178, BP_RESULT_COL_W, 64, "bp_result_sbp", "--",
- DEFAULT_VECTOR_FONT_FILENAME, 56);
- InitUILabel(dbpValue_, BP_RESULT_RIGHT_X, 178, BP_RESULT_COL_W, 64, "bp_result_dbp", "--",
- DEFAULT_VECTOR_FONT_FILENAME, 56);
- sbpValue_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- dbpValue_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
-
- InitUILabel(sbpUnit_, BP_RESULT_LEFT_X, 248, BP_RESULT_COL_W, 28, "bp_result_sbp_unit", "mmHg",
- DEFAULT_VECTOR_FONT_FILENAME, 22);
- InitUILabel(dbpUnit_, BP_RESULT_RIGHT_X, 248, BP_RESULT_COL_W, 28, "bp_result_dbp_unit", "mmHg",
- DEFAULT_VECTOR_FONT_FILENAME, 22);
+ InitUILabel(sbpValue_, BP_RESULT_LEFT_X, 235, 88, 40, "bp_result_sbp", "--",
+ DEFAULT_VECTOR_FONT_FILENAME, 40);
+ InitUILabel(dbpValue_, BP_RESULT_RIGHT_X, 235, 88, 40, "bp_result_dbp", "--",
+ DEFAULT_VECTOR_FONT_FILENAME, 40);
+ sbpValue_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
+ dbpValue_->SetAlign(TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER);
+
+ InitUILabel(sbpUnit_, BP_RESULT_LEFT_X + 4 + 88, 253, 62, 25, "bp_result_sbp_unit", "mmHg",
+ DEFAULT_VECTOR_FONT_FILENAME, 20);
+ InitUILabel(dbpUnit_, BP_RESULT_RIGHT_X + 4 + 88, 253, 62, 25, "bp_result_dbp_unit", "mmHg",
+ DEFAULT_VECTOR_FONT_FILENAME, 20);
sbpUnit_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
dbpUnit_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
sbpUnit_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
dbpUnit_->SetTextColor(Color::GetColorFromRGBA(0x99, 0x99, 0x99, 0xff));
- InitLabel(statusLabel_, 0, 292, 466, 35, "bp_result_status", "血压处于正常范围",
- DEFAULT_VECTOR_FONT_FILENAME, 26);
+ InitLabel(statusLabel_, 0, 322, 466, 35, "bp_result_status", "血压处于正常范围",
+ DEFAULT_VECTOR_FONT_FILENAME, 30);
statusLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- InitLabelButton(confirmButton_, 93, 330, 280, 90, BP_CLICK_CONFIRM, "确定", 30);
- confirmButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
- confirmButton_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED);
- confirmButton_->SetStyle(STYLE_BORDER_RADIUS, 45);
- confirmButton_->SetOnClickListener(static_cast<UIView::OnClickListener *>(BPMainPresenter::GetInstance()));
+ confirmButton_ = new UILabelButtonExt();
+ if (confirmButton_ != nullptr) {
+ confirmButton_->SetPosition(0, 366, 466, 100);
+ confirmButton_->SetViewId(BP_CLICK_CONFIRM);
+ confirmButton_->SetText("确定");
+ confirmButton_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+ confirmButton_->SetTextColor(Color::GetColorFromRGBA(0xff, 0xff, 0xff, 0xff));
+ confirmButton_->SetImageSrc(PNG_BUTTON_466x100_IMAGE, PNG_BUTTON_466x100_IMAGE);
+ confirmButton_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0x00, UIButton::PRESSED);
+ confirmButton_->SetAlign(TEXT_ALIGNMENT_CENTER);
+ confirmButton_->SetOnClickListener(
+ static_cast<UIView::OnClickListener *>(BPMainPresenter::GetInstance()));
+ }
group_->Add(titleLabel_);
group_->Add(timeLabel_);
group_->Add(hlineBottom_);
}
group_->Add(statusLabel_);
- group_->Add(confirmButton_);
+ if (confirmButton_ != nullptr) {
+ group_->Add(confirmButton_);
+ }
UpdateText();
return group_;