From 0058f08fb7c68c9f6d72ffb61933bdabc00341f9 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Mon, 21 Oct 2024 17:17:36 +0800 Subject: [PATCH] =?utf8?q?=E5=BF=83=E7=8E=87=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?utf8?q?=E5=BC=B9=E7=AA=97=E8=84=B1=E8=85=95=EF=BC=88=E5=BE=85=E6=B7=BB?= =?utf8?q?=E5=8A=A0=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../wearable/fd230app/CMakeLists.txt | 1 + .../heartrate/include/HeartNoteView.h | 63 ++++++++++ .../nativeui/heartrate/src/HeartNoteView.cpp | 115 ++++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartNoteView.h create mode 100644 code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartNoteView.cpp diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 4e48b3fb8..85bddc1cd 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -194,6 +194,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/heartrate/src/HeartChartView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/heartrate/src/HeartChartPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/heartrate/src/HeartRateCardView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/heartrate/src/HeartNoteView.cpp #BloodCheck ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodoxygen/src/BloodResultView.cpp diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartNoteView.h b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartNoteView.h new file mode 100644 index 000000000..667dfa935 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartNoteView.h @@ -0,0 +1,63 @@ +/*** + * @Date: 2024-04-15 10:55:58 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-07-30 11:46:23 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/HeartNoteView.h + */ +/*** + * @Date: 2024-04-15 10:55:58 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-05-07 18:51:13 + * @FilePath: /XTS_FD230/FD230/code/sdk/application/wearable/fd230app/nativeui/bloodoxygen/include/HeartNoteView.h + */ +/* + * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. + * Description: bloodResult view + * Author: + * Create: 2021-08-01 + */ + +#ifndef HEART_NOTE_VIEW_H +#define HEART_NOTE_VIEW_H + +#include "View.h" +#include "BaseView.h" +#include "wearable_log.h" +#include "UiConfig.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_image_animator.h" +#include "components/ui_circle_progress.h" +#include "components/ui_view_group.h" + +#include "components/ui_scroll_view.h" +#include "components/ui_label_button_ext.h" +namespace OHOS { + +#define CLICK_HEART_STOP "click_heart_stop" +#define CLICK_HEART_RESTART "click_heart_restart" + + class HeartNoteView + { + public: + HeartNoteView(); + virtual ~HeartNoteView(); + UIScrollView *CreateHeartNoteView(void); + + private: + bool CrearAllView(); + // 提醒图标 + UIImageView *noteimage = nullptr; + // 按键 + UILabelButtonExt *StButton = nullptr; + UILabelButtonExt *ReButton = nullptr; + // 提醒label + UILabelExt *titleLabel = nullptr; + UILabelExt *noteLabel = nullptr; + UIScrollView *heartNoteView = nullptr; + }; +} + +#endif // 血氧主界面 \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartNoteView.cpp b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartNoteView.cpp new file mode 100644 index 000000000..d832a5e02 --- /dev/null +++ b/code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartNoteView.cpp @@ -0,0 +1,115 @@ + +#include "heartrate/include/HeartNoteView.h" +#include "heartrate/include/HeartChartPresenter.h" +#include "ui_resource_string.h" +#include "uicomponents/UIComponents.h" +#include "wearable_log.h" +#include +namespace OHOS { + +static const char *ICON_PATH_NOTE = "/user/res/Blood/Error.bin"; + +HeartNoteView::HeartNoteView() { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartNoteView::HeartNoteView"); +} + +HeartNoteView::~HeartNoteView() { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartNoteView::~HeartNoteView"); + CrearAllView(); +} + +bool HeartNoteView::CrearAllView() { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartNoteView::CrearAllView"); + if (heartNoteView) { + heartNoteView->RemoveAll(); + if (noteimage) { + delete noteimage; + noteimage = nullptr; + } + if (StButton) { + delete StButton; + StButton = nullptr; + } + if (ReButton) { + delete ReButton; + ReButton = nullptr; + } + if (titleLabel) { + delete titleLabel; + titleLabel = nullptr; + } + if (noteLabel) { + delete noteLabel; + noteLabel = nullptr; + } + delete heartNoteView; + heartNoteView = nullptr; + } + return true; +} +UIScrollView *HeartNoteView::CreateHeartNoteView(void) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, + "CreateHeartNoteView::CreateHeartNoteView"); + /* -------------------------------------------------------------------------- + */ + if (heartNoteView == nullptr) { + heartNoteView = new UIScrollView(); + if (heartNoteView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "heartNoteView new fail"); + return nullptr; + } + } + heartNoteView->SetPosition(0, 0, 466, 466); + heartNoteView->SetScrollBlankSize(50); + heartNoteView->SetReboundSize(35); + heartNoteView->SetThrowDrag(true); + heartNoteView->SetMaxScrollDistance(1000); + heartNoteView->SetDirection(UIScrollView::VERTICAL); + // 设置拖拽监听器 + UIView::OnDragListener *dragListener = + static_cast(HeartChartPresenter::GetInstance()); + if (!dragListener) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, + "HeartChartPresenter::获取实例失败!"); + return nullptr; // 获取失败,返回空指针 + } + heartNoteView->SetOnDragListener(dragListener); + + /* 初始化图片 */ + InitImageView(noteimage, 193, 120, 80, 80, "image", ICON_PATH_NOTE); + + /*初始化title*/ + InitLabelExt(titleLabel, 83, 50, 300, 35, "title", STR_CHECKERROR, + DEFAULT_VECTOR_FONT_FILENAME, 30); + InitLabelExt(noteLabel, 53, 230, 360, 70, "time", STR_PWUWC, + DEFAULT_VECTOR_FONT_FILENAME, 30); + // 设置来回滚动属性 + noteLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION); + noteLabel->SetRollSpeed(70); + + /*初始化button*/ + InitButtonExt(StButton, 58, 320, 170, 90, CLICK_HEART_STOP, STR_STOP, 30); + StButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); // 设置按键颜色 + + UIView::OnClickListener *buttonClickst = + static_cast( + HeartChartPresenter::GetInstance()); + StButton->SetOnClickListener(buttonClickst); + + InitButtonExt(ReButton, 238, 320, 170, 90, CLICK_HEART_RESTART, STR_RECHECK, + 30); + ReButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffFF8A36); // 设置按键颜色 + UIView::OnClickListener *buttonClickre = + static_cast( + HeartChartPresenter::GetInstance()); + ReButton->SetOnClickListener(buttonClickre); + + heartNoteView->Add(noteimage); + heartNoteView->Add(titleLabel); + heartNoteView->Add(noteLabel); + heartNoteView->Add(StButton); + heartNoteView->Add(ReButton); + + return heartNoteView; +} +} // namespace OHOS \ No newline at end of file -- 2.17.1