${CMAKE_CURRENT_SOURCE_DIR}/nativeui/applist/src/ApplistPresenter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/applist/src/ApplistView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/clock/src/MainClockView.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/clock/src/DialUserView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodoxygen/src/BloodOxygenView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodoxygen/src/BloodBandoffView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp
VIEW_SYSTEM_FACTORY_RESET, // 系统:恢复出厂设置
VIEW_BRIGHTNESS_CONTROL, // 亮度调节
VIEW_SCREEN_DURATION, // 亮屏时长
+
VIEW_MAX_INTER_APP, // 在此之前添加native应用ID
VIEW_EXTERN_APP = 0xFFFE, // 三方应用
VIEW_INVALIDE_APP = 0xFFFF,
// 血氧
static constexpr const char *PNG_BLOOD_ERROR_IMAGE = APP_RES_PATH "/Blood/Error.bin";
static constexpr const char *PNG_BLOOD_NOTE_IMAGE = APP_RES_PATH "/Blood/boutton.bin";
-
+ //表盘切换
+ static constexpr const char *PNG_DIAL_USER_IMAGE = APP_RES_PATH "/Dial/Diallogo.bin";
static constexpr const char *PNG_PHONE_FINGER_IMAGE = APP_RES_PATH "/Save_Ele/finger.bin";
static constexpr const char *PNG_VOICE_ASSISTANT_IMAGE01 = APP_RES_PATH "/VOICE_ASSISTANT_01.bin";
static constexpr const char *PNG_VOICE_ASSISTANT_IMAGE02 = APP_RES_PATH "/VOICE_ASSISTANT_02.bin";
--- /dev/null
+#ifndef _BloodError_PRESENTER_H
+#define _BloodError_PRESENTER_H
+
+#include "Presenter.h"
+#include "BloodErrorView.h"
+
+namespace OHOS
+{
+ class BloodErrorView;
+
+ class BloodErrorPresenter : public Presenter<BloodErrorView>,
+ public UIView::OnClickListener,
+ public UIView::OnDragListener
+ {
+ public:
+ BloodErrorPresenter();
+ virtual ~BloodErrorPresenter();
+
+ void OnStart() override;
+ void OnPause() override;
+ void OnResume() override;
+ void OnStop() override;
+
+ static BloodErrorPresenter *GetInstance();
+
+ private:
+ // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ bool OnDrag(UIView &view, const DragEvent &event) override;
+ };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
--- /dev/null
+#ifndef _BloodError_VIEW_H
+#define _BloodError_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include <ui_scroll_view.h>
+#include "components/ui_view_group.h"
+#include "components/ui_label.h"
+#include "components/ui_image_view.h"
+#include "components/ui_button.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_label_button_ext.h"
+
+#include "BloodErrorPresenter.h"
+namespace OHOS
+{
+#define LABELBUTTONRE "labelButton1" // 重新检测
+#define LABELBUTTONSTOP "labelButton2" // 停止检测
+
+ class BloodErrorPresenter;
+ class BloodErrorView : public View<BloodErrorPresenter>
+ {
+
+ public:
+ BloodErrorView();
+ virtual ~BloodErrorView();
+ static BloodErrorView *GetInstance(void);
+
+ void OnStart() override;
+ void OnSetUpView() override;
+ void OnTearDownView() override;
+ void OnStop() override;
+ void Init();
+ void DeInit();
+
+ UIView *GetView();
+
+ private:
+ UIView::OnDragListener *draglistener{nullptr};
+ BloodErrorView(BloodErrorView &&) = delete;
+ BloodErrorView &operator=(BloodErrorView &&) = delete;
+
+ UIViewGroup *container_ = nullptr;
+ UIScrollView *scrollView1_ = nullptr;
+ UILabel *label1_ = nullptr;
+ UIImageView *image1_ = nullptr;
+ UILabel *label2_ = nullptr;
+ UILabel *label3_ = nullptr;
+ UILabel *label4_ = nullptr;
+ UIImageView *image2_ = nullptr;
+ UIImageView *image3_ = nullptr;
+ UILabelButtonExt *labelButton1_ = nullptr;
+ UILabelButtonExt *labelButton2_ = nullptr;
+ };
+} // namespace OHOS
+#endif // BloodError_PRESENTER_H
--- /dev/null
+#ifndef _BloodNote_PRESENTER_H
+#define _BloodNote_PRESENTER_H
+
+#include "Presenter.h"
+#include "BloodNoteView.h"
+
+namespace OHOS
+{
+ class BloodNoteView;
+
+ class BloodNotePresenter : public Presenter<BloodNoteView>,
+ public UIView::OnClickListener,
+ public UIView::OnDragListener
+ {
+ public:
+ BloodNotePresenter();
+ virtual ~BloodNotePresenter();
+
+ void OnStart() override;
+ void OnPause() override;
+ void OnResume() override;
+ void OnStop() override;
+
+ static BloodNotePresenter *GetInstance();
+
+ private:
+ // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承;
+ bool OnClick(UIView &view, const ClickEvent &event) override;
+ bool OnDrag(UIView &view, const DragEvent &event) override;
+ };
+} // namespace OHOS
+
+#endif // SLEEPDETAIL_PRESENTER_H
\ No newline at end of file
--- /dev/null
+#ifndef _BloodNote_VIEW_H
+#define _BloodNote_VIEW_H
+
+#include "BaseView.h"
+#include "View.h"
+#include <ui_scroll_view.h>
+#include "components/ui_view_group.h"
+#include "components/ui_label.h"
+#include "components/ui_image_view.h"
+#include "components/ui_button.h"
+#include "components/ui_image_animator.h"
+#include "components/ui_label_button_ext.h"
+
+#include "BloodNotePresenter.h"
+namespace OHOS
+{
+#define NOTEBUTTON "Button1" // 退出按键
+
+
+ class BloodNotePresenter;
+ class BloodNoteView : public View<BloodNotePresenter>
+ {
+
+ public:
+ BloodNoteView();
+ virtual ~BloodNoteView();
+ static BloodNoteView *GetInstance(void);
+
+ void OnStart() override;
+ void OnSetUpView() override;
+ void OnTearDownView() override;
+ void OnStop() override;
+ void Init();
+ void DeInit();
+
+ UIView *GetView();
+
+ private:
+ UIView::OnDragListener *draglistener{nullptr};
+ BloodNoteView(BloodNoteView &&) = delete;
+ BloodNoteView &operator=(BloodNoteView &&) = delete;
+
+ UIViewGroup *container_ = nullptr;
+ UILabel *label1_ = nullptr;
+ UIImageView *image1_ = nullptr;
+ UILabel *label3_ = nullptr;
+ UILabel *label2_ = nullptr;
+ UILabel *label4_ = nullptr;
+ UIButton *button1_ = nullptr;
+ };
+} // namespace OHOS
+#endif // BloodNote_PRESENTER_H
--- /dev/null
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include "/blood/include/BloodErrorPresenter.h"
+
+namespace OHOS
+{
+
+ // 当前Presenter属性实例化的内存指针
+ static BloodErrorPresenter *g_pBloodErrorPresenter = nullptr;
+
+ BloodErrorPresenter::BloodErrorPresenter()
+ {
+
+ g_pBloodErrorPresenter = this;
+ }
+
+ BloodErrorPresenter::~BloodErrorPresenter()
+ {
+
+ g_pBloodErrorPresenter = nullptr;
+ }
+
+ BloodErrorPresenter *BloodErrorPresenter::GetInstance()
+ {
+
+ return g_pBloodErrorPresenter;
+ }
+
+ void BloodErrorPresenter::OnStart()
+ {
+
+ Presenter<BloodErrorView>::OnStart();
+ }
+
+ void BloodErrorPresenter::OnPause(void)
+ {
+
+ Presenter<BloodErrorView>::OnPause();
+ }
+
+ void BloodErrorPresenter::OnResume(void)
+ {
+
+ Presenter<BloodErrorView>::OnResume();
+ }
+
+ void BloodErrorPresenter::OnStop(void)
+ {
+
+ Presenter<BloodErrorView>::OnStop();
+ }
+
+ bool BloodErrorPresenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+
+ // if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT)
+ // {
+ // printf("draglistene is ok!\n");
+ // NativeAbility::GetInstance().ChangeSlice(VIEW_PHONE);
+ // }
+ UNUSED(view);
+ return true;
+ }
+
+ bool BloodErrorPresenter::OnClick(UIView &view, const ClickEvent &event)
+ {
+ // 根据控件id查找是哪个控件触发了点击回调
+ if (strcmp(view.GetViewId(), LABELBUTTONRE) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_BLOODCHECK);
+ }
+ if (strcmp(view.GetViewId(), LABELBUTTONSTOP) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_BLOOD);
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
--- /dev/null
+
+
+#include "/blood/include/BloodErrorView.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+ static BloodErrorView *g_pBloodErrorView{nullptr};
+
+ BloodErrorView::BloodErrorView()
+ {
+
+ g_pBloodErrorView = this;
+ }
+
+ BloodErrorView::~BloodErrorView()
+ {
+ DeInit();
+ g_pBloodErrorView = nullptr;
+ }
+
+ BloodErrorView *BloodErrorView::GetInstance()
+ {
+
+ return g_pBloodErrorView;
+ }
+ void BloodErrorView::Init()
+ {
+ if (container_ == nullptr)
+ {
+ container_ = new UIViewGroup();
+ container_->SetPosition(0, 0, 466, 466);
+ container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+ }
+
+ // Add ScrollView to App
+ if (scrollView1_ == nullptr)
+ {
+ scrollView1_ = new UIScrollView();
+ }
+ scrollView1_->SetPosition(0, 0); // widget's left position and top position
+ scrollView1_->Resize(466, 466); // widget's width and height
+ scrollView1_->SetViewId("scrollView1"); // Set style
+ scrollView1_->SetStyle(STYLE_BACKGROUND_OPA, 0xff);
+
+ // Set additional property
+
+ // Add the CallBack about events
+ UIView::OnDragListener *scrollView1Drag = static_cast<UIView::OnDragListener *>(BloodErrorPresenter::GetInstance());
+ scrollView1_->SetOnDragListener(scrollView1Drag);
+ // Add to rootView
+ container_->Add(scrollView1_);
+ scrollView1_->SetVisible(true);
+
+ // Add Label to App
+ if (label1_ == nullptr)
+ {
+ label1_ = new UILabel();
+ }
+ label1_->SetPosition(143, 52); // widget's left position and top position
+ label1_->Resize(180, 35); // widget's width and height
+ label1_->SetViewId("label1"); // Set style
+ label1_->SetStyle(STYLE_TEXT_FONT, 30);
+
+ // Set additional property
+ label1_->SetText("检测不到结果");
+ label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label1_->SetRollSpeed(0);
+ label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ // Add to scrollView1
+ scrollView1_->Add(label1_);
+ label1_->SetVisible(true);
+
+ // Add ImageView to App
+ if (image1_ == nullptr)
+ {
+ image1_ = new UIImageView();
+ }
+ image1_->SetPosition(193, 111); // widget's left position and top position
+ image1_->Resize(80, 80); // widget's width and height
+ image1_->SetViewId("image1"); // Set style
+
+ // Set additional property
+#ifdef _WIN32
+ char *image1imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Blood/Error.bin";
+#else
+ const char *image1imagesPath = PNG_BLOOD_ERROR_IMAGE;
+#endif
+ image1_->SetSrc(image1imagesPath);
+
+ // Add to scrollView1
+ scrollView1_->Add(image1_);
+ image1_->SetVisible(true);
+
+ // Add Label to App
+ if (label2_ == nullptr)
+ {
+ label2_ = new UILabel();
+ }
+ label2_->SetPosition(58, 208); // widget's left position and top position
+ label2_->Resize(200, 60); // widget's width and height
+ label2_->SetViewId("label2"); // Set style
+ label2_->SetStyle(STYLE_TEXT_FONT, 30);
+
+ // Set additional property
+ label2_->SetText("请确认已带上手表,并保持");
+ label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label2_->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff));
+ label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label2_->SetRollSpeed(0);
+ label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ // Add to scrollView1
+ scrollView1_->Add(label2_);
+ label2_->SetVisible(true);
+
+ // Add Label to App
+ if (label3_ == nullptr)
+ {
+ label3_ = new UILabel();
+ }
+ label3_->SetPosition(43, 243); // widget's left position and top position
+ label3_->Resize(200, 60); // widget's width and height
+ label3_->SetViewId("label3"); // Set style
+ label3_->SetStyle(STYLE_TEXT_FONT, 30);
+
+ // Set additional property
+ label3_->SetText("静止,准备好后点击下方按钮");
+ label3_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label3_->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff));
+ label3_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label3_->SetRollSpeed(0);
+ label3_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ // Add to scrollView1
+ scrollView1_->Add(label3_);
+ label3_->SetVisible(true);
+
+ // Add Label to App
+ if (label4_ == nullptr)
+ {
+ label4_ = new UILabel();
+ }
+ label4_->SetPosition(148, 278); // widget's left position and top position
+ label4_->Resize(200, 60); // widget's width and height
+ label4_->SetViewId("label4"); // Set style
+ label4_->SetStyle(STYLE_TEXT_FONT, 30);
+
+ // Set additional property
+ label4_->SetText("进行重新检测");
+ label4_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label4_->SetTextColor(Color::GetColorFromRGBA(0xcc, 0xcc, 0xcc, 0xff));
+ label4_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label4_->SetRollSpeed(0);
+ label4_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ // Add to scrollView1
+ scrollView1_->Add(label4_);
+ label4_->SetVisible(true);
+
+ // Add LabelButtonExt to App
+ if (labelButton1_ == nullptr)
+ {
+ labelButton1_ = new UILabelButtonExt();
+ }
+ labelButton1_->SetPosition(118, 434); // widget's left position and top position
+ labelButton1_->Resize(230, 80); // widget's width and height
+ labelButton1_->SetViewId(LABELBUTTONSTOP); // Set style
+ labelButton1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
+
+ // Set additional property
+ labelButton1_->SetText("停止检测");
+ labelButton1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);
+ labelButton1_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+ labelButton1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+
+ // Add the CallBack about events
+ UIView::OnClickListener *labelButton1Click = static_cast<UIView::OnClickListener *>(BloodErrorPresenter::GetInstance());
+ labelButton1_->SetOnClickListener(labelButton1Click);
+ // Add to scrollView1
+ scrollView1_->Add(labelButton1_);
+ labelButton1_->SetVisible(true);
+
+ // Add LabelButtonExt to App
+ if (labelButton2_ == nullptr)
+ {
+ labelButton2_ = new UILabelButtonExt();
+ }
+ labelButton2_->SetPosition(110, 334); // widget's left position and top position
+ labelButton2_->Resize(230, 80); // widget's width and height
+ labelButton2_->SetViewId(LABELBUTTONRE); // Set style
+ labelButton2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xffff8a36);
+
+ // Set additional property
+ labelButton2_->SetText("重新检测");
+ labelButton2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26);
+ labelButton2_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+
+ // Add the CallBack about events
+ UIView::OnClickListener *labelButton2Click = static_cast<UIView::OnClickListener *>(BloodErrorPresenter::GetInstance());
+ labelButton2_->SetOnClickListener(labelButton2Click);
+ // Add to scrollView1
+ scrollView1_->Add(labelButton2_);
+ labelButton2_->SetVisible(true);
+ // Add ImageView to App
+ if (image2_ == nullptr)
+ {
+ image2_ = new UIImageView();
+ }
+ image2_->SetPosition(183, 550); // widget's left position and top position
+ image2_->Resize(100, 100); // widget's width and height
+ image2_->SetViewId("image2"); // Set style
+
+ // Set additional property
+
+ // Add to scrollView1
+ scrollView1_->Add(image2_);
+ image2_->SetVisible(true);
+ // Add ImageView to App
+ if (image3_ == nullptr)
+ {
+ image3_ = new UIImageView();
+ }
+ image3_->SetPosition(183, -100); // widget's left position and top position
+ image3_->Resize(100, 100); // widget's width and height
+ image3_->SetViewId("image3"); // Set style
+
+ // Set additional property
+
+ // Add to scrollView1
+ scrollView1_->Add(image3_);
+ image3_->SetVisible(true);
+ }
+
+ void BloodErrorView::DeInit()
+ {
+ if (container_ != nullptr)
+ {
+ container_->RemoveAll();
+ delete container_;
+ container_ = nullptr;
+ }
+ if (scrollView1_ != nullptr)
+ {
+ delete scrollView1_;
+ scrollView1_ = nullptr;
+ }
+ if (label1_ != nullptr)
+ {
+ delete label1_;
+ label1_ = nullptr;
+ }
+ if (image1_ != nullptr)
+ {
+ delete image1_;
+ image1_ = nullptr;
+ }
+ if (label2_ != nullptr)
+ {
+ delete label2_;
+ label2_ = nullptr;
+ }
+ if (label3_ != nullptr)
+ {
+ delete label3_;
+ label3_ = nullptr;
+ }
+ if (label4_ != nullptr)
+ {
+ delete label4_;
+ label4_ = nullptr;
+ }
+ if (labelButton1_ != nullptr)
+ {
+ delete labelButton1_;
+ labelButton1_ = nullptr;
+ }
+ if (labelButton2_ != nullptr)
+ {
+ delete labelButton2_;
+ labelButton2_ = nullptr;
+ }
+ }
+
+ UIView *BloodErrorView::GetView()
+ {
+ Init();
+ return container_;
+ }
+
+ void BloodErrorView::OnStart()
+ {
+ container_ = new UIViewGroup();
+ if (container_ == nullptr)
+ {
+ return;
+ }
+ container_->SetPosition(0, 0);
+ container_->SetWidth(Screen::GetInstance().GetWidth());
+ container_->SetHeight(Screen::GetInstance().GetHeight());
+
+ // 创建 draglistener 实例并设置为拖动监听器
+ UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(BloodErrorPresenter::GetInstance());
+ if (draglistener == nullptr)
+ {
+ return;
+ }
+ container_->SetOnDragListener(draglistener);
+
+ container_->SetTouchable(true);
+ container_->SetDraggable(true);
+
+ GetView();
+ RootView::GetInstance()->Add(container_);
+ }
+
+ void BloodErrorView::OnSetUpView()
+ {
+
+ View<BloodErrorPresenter>::OnSetUpView();
+ Draw();
+ }
+
+ void BloodErrorView::OnTearDownView()
+ {
+
+ View<BloodErrorPresenter>::OnTearDownView();
+ return;
+ }
+
+ void BloodErrorView::OnStop()
+ {
+ View<BloodErrorPresenter>::OnStop();
+ RootView::GetInstance()->RemoveAll();
+ return;
+ }
+}
--- /dev/null
+#include "AppViewIDs.h"
+#include "NativeAbility.h"
+
+#include "/blood/include/BloodNotePresenter.h"
+
+namespace OHOS
+{
+
+ // 当前Presenter属性实例化的内存指针
+ static BloodNotePresenter *g_pBloodNotePresenter = nullptr;
+
+ BloodNotePresenter::BloodNotePresenter()
+ {
+
+ g_pBloodNotePresenter = this;
+ }
+
+ BloodNotePresenter::~BloodNotePresenter()
+ {
+
+ g_pBloodNotePresenter = nullptr;
+ }
+
+ BloodNotePresenter *BloodNotePresenter::GetInstance()
+ {
+
+ return g_pBloodNotePresenter;
+ }
+
+ void BloodNotePresenter::OnStart()
+ {
+
+ Presenter<BloodNoteView>::OnStart();
+ }
+
+ void BloodNotePresenter::OnPause(void)
+ {
+
+ Presenter<BloodNoteView>::OnPause();
+ }
+
+ void BloodNotePresenter::OnResume(void)
+ {
+
+ Presenter<BloodNoteView>::OnResume();
+ }
+
+ void BloodNotePresenter::OnStop(void)
+ {
+
+ Presenter<BloodNoteView>::OnStop();
+ }
+
+ bool BloodNotePresenter::OnDrag(UIView &view, const DragEvent &event)
+ {
+
+ // if (event.GetDragDirection() == DragEvent::DIRECTION_RIGHT_TO_LEFT)
+ // {
+ // printf("draglistene is ok!\n");
+ // NativeAbility::GetInstance().ChangeSlice(VIEW_PHONE);
+ // }
+ UNUSED(view);
+ return true;
+ }
+
+ bool BloodNotePresenter::OnClick(UIView &view, const ClickEvent &event)
+ {
+ // 根据控件id查找是哪个控件触发了点击回调
+ if (strcmp(view.GetViewId(), NOTEBUTTON) == 0)
+ {
+ NativeAbility::GetInstance().ChangeSlice(VIEW_BLOOD);
+ }
+
+ return true;
+ }
+}
\ No newline at end of file
--- /dev/null
+
+
+#include "/blood/include/BloodNoteView.h"
+
+#include "common/image_cache_manager.h"
+#include "UiConfig.h"
+#include "ui_resource_image.h"
+#include <ui_scroll_view.h>
+#include "components/ui_button.h"
+namespace OHOS
+{
+ static BloodNoteView *g_pBloodNoteView{nullptr};
+
+ BloodNoteView::BloodNoteView()
+ {
+
+ g_pBloodNoteView = this;
+ }
+
+ BloodNoteView::~BloodNoteView()
+ {
+ DeInit();
+ g_pBloodNoteView = nullptr;
+ }
+
+ BloodNoteView *BloodNoteView::GetInstance()
+ {
+
+ return g_pBloodNoteView;
+ }
+ void BloodNoteView::Init()
+ {
+ if (container_ == nullptr)
+ {
+ container_ = new UIViewGroup();
+ container_->SetPosition(0, 0, 466, 466);
+ container_->SetStyle(STYLE_BACKGROUND_OPA, 0);
+ }
+
+ // Add Label to App
+ if (label1_ == nullptr)
+ {
+ label1_ = new UILabel();
+ }
+ label1_->SetPosition(173, 52); // widget's left position and top position
+ label1_->Resize(200, 60); // widget's width and height
+ label1_->SetViewId("label1"); // Set style
+ label1_->SetStyle(STYLE_TEXT_FONT, 30);
+
+ // Set additional property
+ label1_->SetText("血氧提醒");
+ label1_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label1_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label1_->SetRollSpeed(0);
+ label1_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ // Add to rootView
+ container_->Add(label1_);
+ label1_->SetVisible(true);
+
+ // Add ImageView to App
+ if (image1_ == nullptr)
+ {
+ image1_ = new UIImageView();
+ }
+ image1_->SetPosition(193, 121); // widget's left position and top position
+ image1_->Resize(100, 100); // widget's width and height
+ image1_->SetViewId("image1"); // Set style
+
+ // Set additional property
+#ifdef _WIN32
+ char *image1imagesPath = "c:/Users/caiking/project/image_converter_tool/output/Blood/error.bin";
+#else
+ const char *image1imagesPath = PNG_BLOOD_ERROR_IMAGE;
+#endif
+ image1_->SetSrc(image1imagesPath);
+
+ // Add to rootView
+ container_->Add(image1_);
+ image1_->SetVisible(true);
+
+ // Add Label to App
+ if (label3_ == nullptr)
+ {
+ label3_ = new UILabel();
+ }
+ label3_->SetPosition(341, 234); // widget's left position and top position
+ label3_->Resize(200, 60); // widget's width and height
+ label3_->SetViewId("label3"); // Set style
+ label3_->SetStyle(STYLE_TEXT_FONT, 30);
+
+ // Set additional property
+ label3_->SetText("95%");
+ label3_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label3_->SetTextColor(Color::GetColorFromRGBA(0xff, 0x8a, 0x36, 0xff));
+ label3_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label3_->SetRollSpeed(0);
+ label3_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ // Add to rootView
+ container_->Add(label3_);
+ label3_->SetVisible(true);
+
+ // Add Label to App
+ if (label2_ == nullptr)
+ {
+ label2_ = new UILabel();
+ }
+ label2_->SetPosition(67, 235); // widget's left position and top position
+ label2_->Resize(200, 60); // widget's width and height
+ label2_->SetViewId("label2"); // Set style
+ label2_->SetStyle(STYLE_TEXT_FONT, 30);
+
+ // Set additional property
+ label2_->SetText("当前血氧含量已低于\n");
+ label2_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label2_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label2_->SetRollSpeed(0);
+ label2_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ // Add to rootView
+ container_->Add(label2_);
+ label2_->SetVisible(true);
+
+ // Add Label to App
+ if (label4_ == nullptr)
+ {
+ label4_ = new UILabel();
+ }
+ label4_->SetPosition(128, 276); // widget's left position and top position
+ label4_->Resize(200, 60); // widget's width and height
+ label4_->SetViewId("label4"); // Set style
+ label4_->SetStyle(STYLE_TEXT_FONT, 30);
+
+ // Set additional property
+ label4_->SetText("请注意身体健康");
+ label4_->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
+ label4_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
+ label4_->SetRollSpeed(0);
+ label4_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
+
+ // Add to rootView
+ container_->Add(label4_);
+ label4_->SetVisible(true);
+
+ // Add Button to App
+ if (button1_ == nullptr)
+ {
+ button1_ = new UIButton();
+ }
+ button1_->SetPosition(0, 366); // widget's left position and top position
+ button1_->Resize(466, 100); // widget's width and height
+ button1_->SetViewId(NOTEBUTTON); // Set style
+ button1_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000);
+ button1_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
+
+ // Set additional property
+#ifdef _WIN32
+ char *button1defaultImgSrc = "c:/Users/caiking/project/image_converter_tool/output/Blood/boutton.bin";
+#else
+ const char *button1defaultImgSrc = PNG_BLOOD_NOTE_IMAGE;
+#endif
+ char *button1triggeredImgSrc = nullptr;
+ button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
+ button1_->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff000000, UIButton::PRESSED);
+ button1_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+
+ // Add the CallBack about events
+ UIView::OnClickListener *button1Click = static_cast<UIView::OnClickListener *>(BloodNotePresenter::GetInstance());
+ button1_->SetOnClickListener(button1Click);
+ // Add to rootView
+ container_->Add(button1_);
+ button1_->SetVisible(true);
+ }
+
+ void BloodNoteView::DeInit()
+ {
+ if (container_ != nullptr)
+ {
+ container_->RemoveAll();
+ delete container_;
+ container_ = nullptr;
+ }
+ if (label1_ != nullptr)
+ {
+ delete label1_;
+ label1_ = nullptr;
+ }
+ if (image1_ != nullptr)
+ {
+ delete image1_;
+ image1_ = nullptr;
+ }
+ if (label3_ != nullptr)
+ {
+ delete label3_;
+ label3_ = nullptr;
+ }
+ if (label2_ != nullptr)
+ {
+ delete label2_;
+ label2_ = nullptr;
+ }
+ if (label4_ != nullptr)
+ {
+ delete label4_;
+ label4_ = nullptr;
+ }
+ if (button1_ != nullptr)
+ {
+ delete button1_;
+ button1_ = nullptr;
+ }
+ }
+
+ UIView *BloodNoteView::GetView()
+ {
+ Init();
+ return container_;
+ }
+
+ void BloodNoteView::OnStart()
+ {
+ container_ = new UIViewGroup();
+ if (container_ == nullptr)
+ {
+ return;
+ }
+ container_->SetPosition(0, 0);
+ container_->SetWidth(Screen::GetInstance().GetWidth());
+ container_->SetHeight(Screen::GetInstance().GetHeight());
+
+ // 创建 draglistener 实例并设置为拖动监听器
+ UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(BloodNotePresenter::GetInstance());
+ if (draglistener == nullptr)
+ {
+ return;
+ }
+ container_->SetOnDragListener(draglistener);
+
+ container_->SetTouchable(true);
+ container_->SetDraggable(true);
+
+ GetView();
+ RootView::GetInstance()->Add(container_);
+ }
+
+ void BloodNoteView::OnSetUpView()
+ {
+
+ View<BloodNotePresenter>::OnSetUpView();
+ Draw();
+ }
+
+ void BloodNoteView::OnTearDownView()
+ {
+
+ View<BloodNotePresenter>::OnTearDownView();
+ return;
+ }
+
+ void BloodNoteView::OnStop()
+ {
+ View<BloodNotePresenter>::OnStop();
+ RootView::GetInstance()->RemoveAll();
+ return;
+ }
+}
#include "ActivityWeekView.h"
#include "CompassControlView.h"
#include "MainClockView.h"
+#include "DialUserView.h"
#include "PlayersView.h"
#include "MainPresenterSample.h"
#include "HeartRateView.h"
UICardPage *messageView{nullptr};
UILabel *messageLable{nullptr};
MainClockView *mainClockView{nullptr};
+ DialUserView *dialUserView{nullptr};
ActivityWeekView *activityWeekView{nullptr};
PlayersView *playersView{nullptr};
CompassControlView *compassControlView{nullptr};
} else if (swipeDirect == VERTICAL_SWIPE) {
vertical->OnDragEndEvent(event);
if (vertical->GetCurrentPage() == VER_MAIN_CLOCK_VIEW) {
- vertical->GetViewByIndex(pullIndex)->ClearBackgroundBlur();
+ vertical->GetViewByIndex(pullIndex)->ClearBackgroundBlur();
RootView::GetInstance()->Invalidate();
}
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "vertical->OnDragEndEvent, index: %d", vertical->GetCurrentPage());
UICardPage *MainViewSample::InitWatchFacePage(void)
{
+ #if 0
+ dialUserView = new DialUserView();
+ //dialUserView->PreLoad();
+ if ( dialUserView == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialUserView new fail");
+ return nullptr;
+ }
+ printf("creat dial succes!!\n");
+ return dialUserView;
+ #endif
+
+ #if 1
mainClockView = new MainClockView();
if (mainClockView == nullptr) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainClockView new fail");
return nullptr;
}
return mainClockView;
+ #endif
}
UICardPage *MainViewSample::InitHeartRatePage(void)