心率:增加弹窗脱腕(待添加)
authorCaisking <3449750381@qq.com>
Mon, 21 Oct 2024 09:17:36 +0000 (17:17 +0800)
committerCaisking <3449750381@qq.com>
Mon, 21 Oct 2024 09:17:36 +0000 (17:17 +0800)
code/sdk/application/wearable/fd230app/CMakeLists.txt
code/sdk/application/wearable/fd230app/nativeui/heartrate/include/HeartNoteView.h [new file with mode: 0644]
code/sdk/application/wearable/fd230app/nativeui/heartrate/src/HeartNoteView.cpp [new file with mode: 0644]

index 4e48b3f..85bddc1 100644 (file)
@@ -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 (file)
index 0000000..667dfa9
--- /dev/null
@@ -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 (file)
index 0000000..d832a5e
--- /dev/null
@@ -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 <custom_utils.h>
+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<UIView::OnDragListener *>(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<UIView::OnClickListener *>(
+          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<UIView::OnClickListener *>(
+          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