From 6f2d718d5794e2ad1ffa375b4992f2dad774ccf2 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Wed, 10 Jun 2026 11:05:55 +0800 Subject: [PATCH] =?utf8?q?=E5=85=8D=E8=B4=A3=E5=A3=B0=E6=98=8E=E9=80=BB?= =?utf8?q?=E8=BE=91=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../src/BPCalibFirstDoneView.cpp | 4 ++-- .../bloodpressure/src/BPHistoryView.cpp | 8 +++---- .../nativeui/bloodpressure/src/BPModel.cpp | 11 ++++++++-- .../nativeapp/nativeui/ecg/include/ECGModel.h | 2 ++ .../nativeui/ecg/include/ECGViewClickIds.h | 1 + .../nativeui/ecg/src/ECGInstructionView.cpp | 3 ++- .../nativeui/ecg/src/ECGMainPresenter.cpp | 10 ++++----- .../nativeui/ecg/src/ECGMainView.cpp | 6 ++++- .../nativeapp/nativeui/ecg/src/ECGModel.cpp | 22 +++++++++++++++++++ 9 files changed, 52 insertions(+), 15 deletions(-) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPCalibFirstDoneView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPCalibFirstDoneView.cpp index 8483465cd..1c2fa5d32 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPCalibFirstDoneView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPCalibFirstDoneView.cpp @@ -51,7 +51,7 @@ void BPCalibFirstDoneView::InitProgressBar() { progressBar_->SetValidHeight(BP_FIRST_DONE_PROGRESS_H); progressBar_->SetRange(100, 0); progressBar_->SetValue(BP_FIRST_DONE_PROGRESS_VALUE); - progressBar_->SetStyle(STYLE_BORDER_RADIUS, 4); + progressBar_->SetStyle(STYLE_BORDER_RADIUS, 10); progressBar_->EnableBackground(true); progressBar_->SetBackgroundStyle(STYLE_BACKGROUND_COLOR, BP_FIRST_DONE_PROGRESS_BG); progressBar_->SetBackgroundStyle(STYLE_BACKGROUND_OPA, 0xff); @@ -63,7 +63,7 @@ UIViewGroup *BPCalibFirstDoneView::InitView() { group_ = new UIViewGroup(); group_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); InitImageView(imageView_, 114, 50, 32, 32, "bp_first_done_image", BLOOD_PATH_FIRST_DONE); - InitLabel(titleLabel_, 114 + 32 + 8, 50, 198, 35, "bp_first_done_title", "第1轮校准完成", + InitLabel(titleLabel_, 114 + 32 + 8, 50, 230, 35, "bp_first_done_title", "第1轮校准完成", DEFAULT_VECTOR_FONT_FILENAME, 30); InitProgressBar(); InitLabel(noteLabel_, 83, 178, 300, 105, "bp_first_done_note", diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPHistoryView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPHistoryView.cpp index 55bfdfe0d..d42162922 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPHistoryView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPHistoryView.cpp @@ -509,16 +509,16 @@ void BPHistoryView::InitEmptyPage() { DEFAULT_VECTOR_FONT_FILENAME, 30); emptyTitleLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - InitImageView(emptyImage_, 174, 120, 118, 120, "bp_history_empty_image", BP_NO_RECORD_IMAGE); + InitImageView(emptyImage_, 174, 120, 80, 80, "bp_history_empty_image", BP_NO_RECORD_IMAGE); InitUILabel(emptyHintLabel_, 53, 260, 360, 70, "bp_history_empty_hint", - "完成一次测量后可在这里查看记录", DEFAULT_VECTOR_FONT_FILENAME, 28); + "完成一次测量后\n可在这里查看记录", DEFAULT_VECTOR_FONT_FILENAME, 28); emptyHintLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); emptyHintLabel_->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); InitLabelButton(startMeasureButton_, 93, 330, 280, 90, BP_CLICK_MEASURE, "开始测量", 30); - startMeasureButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff4fc34c); - startMeasureButton_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff4fc34c, UIButton::PRESSED); + startMeasureButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff0176ff); + startMeasureButton_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff0176ff, UIButton::PRESSED); startMeasureButton_->SetStyle(STYLE_BORDER_RADIUS, 45); startMeasureButton_->SetOnClickListener( static_cast(BPMainPresenter::GetInstance())); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPModel.cpp index 1fcb6b139..dc34646e4 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPModel.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/bloodpressure/src/BPModel.cpp @@ -59,11 +59,18 @@ BPModel *BPModel::GetInstance() { bool BPModel::IsFirstUse() const { char buf[8] = {0}; int len = UtilsGetValue(BP_KV_DISCLAIMER, buf, sizeof(buf)); - return len <= 0 || buf[0] != '1'; + if (len < 0) { + return true; + } + return buf[0] != '1'; } bool BPModel::MarkDisclaimerAccepted() { - return UtilsSetValue(BP_KV_DISCLAIMER, "1") == 0; + if (UtilsSetValue(BP_KV_DISCLAIMER, "1") != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BPModel MarkDisclaimerAccepted kv fail"); + return false; + } + return true; } bool BPModel::CreateBPDataDirectory() { diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/include/ECGModel.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/include/ECGModel.h index 5c9bf2df0..3364e8ca6 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/include/ECGModel.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/include/ECGModel.h @@ -27,6 +27,8 @@ public: static ECGModel *GetInstance(); void LoadData(); + bool IsFirstUse() const; + bool MarkDisclaimerAccepted(); ECGRecord GetLastRecord() const; bool HasHistory() const; const std::deque &GetHistoryRecords() const; diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/include/ECGViewClickIds.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/include/ECGViewClickIds.h index b95d7a99a..600a03e84 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/include/ECGViewClickIds.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/include/ECGViewClickIds.h @@ -6,6 +6,7 @@ #define ECG_CLICK_VIEW_ALL "ecg_click_view_all" #define ECG_CLICK_INSTRUCTION "ecg_click_instruction" #define ECG_CLICK_INSTRUCTION_BACK "ecg_click_instruction_back" +#define ECG_CLICK_DISCLAIMER_ACCEPT "ecg_disclaimer_accept" #define ECG_CLICK_MEASURE "ecg_click_measure" #define ECG_CLICK_STOP "ecg_click_stop" #define ECG_CLICK_RETRY "ecg_click_retry" diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGInstructionView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGInstructionView.cpp index a3a4d01ee..25414d3be 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGInstructionView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGInstructionView.cpp @@ -1,5 +1,6 @@ #include "ecg/include/ECGInstructionView.h" #include "ecg/include/ECGMainPresenter.h" +#include "ecg/include/ECGViewClickIds.h" #include "uicomponents/UIComponents.h" namespace OHOS { @@ -45,7 +46,7 @@ void ECGInstructionView::InitDisclaimer() { InitUILabel(noteLabel_, 0, 248, 466, 35, "ecg_disclaimer_note", "如有心脏相关疑虑,请咨询医生", DEFAULT_VECTOR_FONT_FILENAME, 30); noteLabel_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - InitLabelButton(agreeButton_, 93, 320, 280, 90, ECG_CLICK_MEASURE, "同意并继续", 26); + InitLabelButton(agreeButton_, 93, 320, 280, 90, ECG_CLICK_DISCLAIMER_ACCEPT, "同意并继续", 26); agreeButton_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff0176ff); agreeButton_->SetStyle(STYLE_BORDER_RADIUS, 100); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainPresenter.cpp index 591d93406..57767290b 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainPresenter.cpp @@ -273,6 +273,11 @@ bool ECGMainPresenter::OnClick(UIView &view, const ClickEvent &event) { mainView->ChangeView(ECG_INSTRUCTION_VIEW, ECG_ENTRY_VIEW); return true; } + if (viewId == ECG_CLICK_DISCLAIMER_ACCEPT) { + ECGModel::GetInstance()->MarkDisclaimerAccepted(); + mainView->ChangeView(ECG_INSTRUCTION_VIEW, ECG_ENTRY_VIEW); + return true; + } if (viewId == ECG_CLICK_INSTRUCTION) { mainView->ChangeView(ECG_ENTRY_VIEW, ECG_INSTRUCTION_VIEW, ECG_INSTRUCTION_TYPE_DISCLAIMER); return true; @@ -304,11 +309,6 @@ bool ECGMainPresenter::OnClick(UIView &view, const ClickEvent &event) { return true; } if (viewId == ECG_CLICK_MEASURE) { - if (current == ECG_INSTRUCTION_VIEW && - mainView->GetInstructionSubType() == ECG_INSTRUCTION_TYPE_DISCLAIMER) { - ShowWaitContact(mainView); - return true; - } if (current == ECG_ENTRY_VIEW || current == ECG_HISTORY_VIEW) { StartMeasureFlow(mainView); return true; diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainView.cpp index 1d516c352..c0aa819da 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGMainView.cpp @@ -56,7 +56,11 @@ void ECGMainView::OnStart() { AddViewToRootContainer(container_); } ECGModel::GetInstance()->LoadData(); - ChangeView(MAX_ECGVIEW, ECG_ENTRY_VIEW); + if (ECGModel::GetInstance()->IsFirstUse()) { + ChangeView(MAX_ECGVIEW, ECG_INSTRUCTION_VIEW, ECG_INSTRUCTION_TYPE_DISCLAIMER); + } else { + ChangeView(MAX_ECGVIEW, ECG_ENTRY_VIEW); + } RootView::GetInstance()->SetOnKeyActListener( static_cast(ECGMainPresenter::GetInstance())); Draw(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGModel.cpp index 227142b09..d595a5ee0 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGModel.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/ecg/src/ECGModel.cpp @@ -1,10 +1,15 @@ #include "ecg/include/ECGModel.h" +#include "kv_store.h" #include "securec.h" #include "wearable_log.h" #include namespace OHOS { +namespace { +static constexpr const char *ECG_KV_DISCLAIMER = "ecg.disclaimer"; +} // namespace + ECGModel::ECGModel() { LoadData(); } ECGModel::~ECGModel() {} @@ -14,6 +19,23 @@ ECGModel *ECGModel::GetInstance() { return &instance; } +bool ECGModel::IsFirstUse() const { + char buf[8] = {0}; + int len = UtilsGetValue(ECG_KV_DISCLAIMER, buf, sizeof(buf)); + if (len < 0) { + return true; + } + return buf[0] != '1'; +} + +bool ECGModel::MarkDisclaimerAccepted() { + if (UtilsSetValue(ECG_KV_DISCLAIMER, "1") != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ECGModel MarkDisclaimerAccepted kv fail"); + return false; + } + return true; +} + void ECGModel::LoadData() { historyRecords_.clear(); time_t now = time(nullptr); -- 2.17.1