From: Caisking <3449750381@qq.com> Date: Wed, 29 Nov 2023 06:08:13 +0000 (+0800) Subject: 增加心率监测提醒功能 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=ee6a7216f15fe97920ce27c6a9b42032cd71221d;p=mirrors%2FFD230.git 增加心率监测提醒功能 --- diff --git a/.vscode/settings.json b/.vscode/settings.json index d7c6654e4..ca85d76ca 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,6 +9,9 @@ "files.associations": { "pinctrl_porting.h": "c", "complex": "cpp", - "*.inc": "cpp" + "*.inc": "cpp", + "thread": "cpp", + "chrono": "cpp", + "iostream": "cpp" } } \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/CMakeLists.txt b/code/sdk/application/wearable/nativeapp/CMakeLists.txt index 72d907c39..45d69207d 100644 --- a/code/sdk/application/wearable/nativeapp/CMakeLists.txt +++ b/code/sdk/application/wearable/nativeapp/CMakeLists.txt @@ -238,6 +238,9 @@ set(SOURCES #���� ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/dial/src/DialView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/dial/src/DialPresenter.cpp + + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/heartrate/src/HeartRemindView.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/heartrate/src/HeartRemindPresenter.cpp #ָ���� ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/compass/src/CompassControlView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/compass/src/CompassCalibrationView.cpp diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h index 8639114de..ff30adfca 100644 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h @@ -47,16 +47,20 @@ typedef enum : uint16_t VIEW_UISAMPLE, // 实例 VIEW_GETPIC, // 手势拍照 VIEW_TAKEPIC, // 拍照 + VIEW_BLOOD, // 血氧 VIEW_BLOODSHOW, // 血氧说明 VIEW_BLOODCHECK, // 血氧检查 VIEW_BLOODERROR, // 血氧监测错误 VIEW_BLOODNOTE, // 血氧过低提醒 + VIEW_DIAL, // 表盘 VIEW_DIALSETUP, // 表盘安装 VIEW_DIALSUCCES, // 表盘安装成功 + VIEW_SAVEELE, // 省电模式 VIEW_SAVEBAT, // 省电模式界面 + VIEW_COMPASS, // 指南针 VIEW_COMPASS_PLACE_MAKER, // 指南针:放置标记点 VIEW_COMPASS_MAKER_POINT, // 指南针:标记点介绍 @@ -69,7 +73,9 @@ typedef enum : uint16_t VIEW_COMPASS_END_BACK_TRACKING, // 指南针:结束路径回溯 VIEW_COMPASS_END_BACK_TRACKING_EARLY, // 指南针:提前结束路径回溯 VIEW_SPORT, // 活动 - VIEW_HEARTRATE, // 心率 + + VIEW_HEARTRATEREMIND, // 心率提醒 + VIEW_TRAINING, // 训练 VIEW_TRAINING_RECORD, // 训练记录 VIEW_BLOODPRESSURE, // 昨日睡眠时间 diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h index 8ac739c10..321dde119 100644 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h @@ -55,6 +55,7 @@ public: void InitBloodErrorSlice(void); void InitBloodNoteSlice(void); void InitDialSlice(void); + void InitHeartRemindSlice(void); void InitPhoneSlice(void); void InitPhoneCallSlice(void); void InitPhoneDirSlice(void); diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp index 1326761a0..f9e3f6df6 100644 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp @@ -99,6 +99,8 @@ #include "blood/include/BloodNotePresenter.h" #include "dial/include/DialPresenter.h" #include "dial/include/DialView.h" +#include "heartrate/include/HeartRemindPresenter.h" +#include "heartrate/include/HeartRemindView.h" #include "displaybrightness/include/DisplayBrightnessPresenter.h" #include "displaybrightness/include/DisplayBrightnessView.h" #include "bluetoothofsetting/include/BlueToothOfSettingPresenter.h" @@ -207,6 +209,8 @@ static const AppViewMapper SLICE_MAPPER[] = { {VIEW_BLOODERROR, &NativeLauncher::InitBloodErrorSlice}, {VIEW_BLOODNOTE, &NativeLauncher::InitBloodNoteSlice}, {VIEW_DIAL, &NativeLauncher::InitDialSlice}, //表盘 + {VIEW_HEARTRATEREMIND, &NativeLauncher::InitHeartRemindSlice}, + {VIEW_DISPLAY_BRIGHTNESS,&NativeLauncher::InitUIDisplayBrightnessSlice}, //显示与亮度的实例化地址 {VIEW_CONNECT_BLUETOOTH,&NativeLauncher::InitBlueToothSettingSlice}, //蓝牙设置的实例化地址 {VIEW_BRIGHTNESS_CONTROL,&NativeLauncher::InitBrightnessControlSlice}, //调节亮度的实例化地址 @@ -752,6 +756,12 @@ void NativeLauncher::InitDialSlice(void) NativeAbility::GetInstance().AddSliceProxy(VIEW_DIAL, dialview); } +void NativeLauncher::InitHeartRemindSlice(void) +{ + SliceProxy *heartremindview = new AbilitySliceProxy; + NativeAbility::GetInstance().AddSliceProxy(VIEW_HEARTRATEREMIND, heartremindview); +} + //DisplayBrightness的实例化 void NativeLauncher::InitUIDisplayBrightnessSlice(void) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp index 6db07b14c..d92b1842a 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp @@ -33,7 +33,7 @@ namespace OHOS {VIEW_SPORT, PNG_APPLIST_SPORT_IMAGE, PNG_APPLIST_SPORT_IMAGE, "活动", nullptr}, {VIEW_GETPIC, PNG_APPLIST_GETPIC_IMAGE, PNG_APPLIST_GETPIC_IMAGE, "拍照", nullptr}, {VIEW_BLOOD, PNG_APPLIST_BLOOD_IMAGE, PNG_APPLIST_BLOOD_IMAGE, "血氧监测", nullptr}, - {VIEW_SPORT, PNG_APPLIST_HEARTRATE_IMAGE, PNG_APPLIST_HEARTRATE_IMAGE, "心率", nullptr}, + {VIEW_HEARTRATEREMIND, PNG_APPLIST_HEARTRATE_IMAGE, PNG_APPLIST_HEARTRATE_IMAGE, "心率", nullptr}, {VIEW_TRAINING, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_TRAINING_IMAGE, "训练", nullptr}, {VIEW_TRAINING_RECORD, PNG_APPLIST_TRAINING_RECORD_IMAGE, PNG_APPLIST_TRAINING_RECORD_IMAGE, "训练记录", nullptr}, {VIEW_BLOODPRESSURE, PNG_APPLIST_BLOODPRESSURE_IMAGE, PNG_APPLIST_BLOODPRESSURE_IMAGE, "睡眠", nullptr}, diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRateView.h b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRateView.h index 7934c1d70..d37143eda 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRateView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRateView.h @@ -50,6 +50,7 @@ public: void RefreshRestHeartRate(uint16_t value); // 刷新静息心率 void HeartbeatImageAnimatorStart(void); // 心形动画启动 void HeartbeatImageAnimatorStop(void); // 心形动画停止 + void GetHeartRate(void);//获取心率结果 void InitRefreshInterface(void); private: @@ -97,6 +98,7 @@ private: UILabel *restRate{nullptr}; UILabel *restRateText1{nullptr}; UILabel *restRateText2{nullptr}; + UIButton* button_ = nullptr; uint16_t maxRate; uint16_t minRate; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRemindPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRemindPresenter.h new file mode 100644 index 000000000..379ee8df3 --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRemindPresenter.h @@ -0,0 +1,33 @@ +#ifndef _HeartRemind_PRESENTER_H +#define _HeartRemind_PRESENTER_H + +#include "Presenter.h" +#include "HeartRemindView.h" + +namespace OHOS +{ + class HeartRemindView; + + class HeartRemindPresenter : public Presenter, + public UIView::OnClickListener, + public UIView::OnDragListener + { + public: + HeartRemindPresenter(); + virtual ~HeartRemindPresenter(); + + void OnStart() override; + void OnPause() override; + void OnResume() override; + void OnStop() override; + + static HeartRemindPresenter *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 diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRemindView.h b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRemindView.h new file mode 100644 index 000000000..cefc52125 --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRemindView.h @@ -0,0 +1,56 @@ +#ifndef _HeartRemind_VIEW_H +#define _HeartRemind_VIEW_H + +#include "BaseView.h" +#include "View.h" +#include +#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 "components/ui_chart.h" +#include "wearable_log.h" +#include "ohos_types.h" +#include "components/ui_card_page.h" + +#include "HeartRemindPresenter.h" +namespace OHOS +{ +#define NOTEBUTTON "Button1" // 退出按键 + + class HeartRemindPresenter; + class HeartRemindView : public View + { + + public: + HeartRemindView(); + virtual ~HeartRemindView(); + static HeartRemindView *GetInstance(void); + + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; + void Init(); + void DeInit(); + + UIView *GetView(); + + private: + int16 heartrate = 170; + UIView::OnDragListener *draglistener{nullptr}; + HeartRemindView(HeartRemindView &&) = delete; + HeartRemindView &operator=(HeartRemindView &&) = delete; + + UIViewGroup *container_ = nullptr; + UILabel *label1_ = nullptr; + UIImageView *image1_ = nullptr; + UILabel *label2_ = nullptr; + UILabel *label3_ = nullptr; + UILabel *label4_ = nullptr; + UIButton *button1_ = nullptr; + }; +} // namespace OHOS +#endif // HeartRemind_PRESENTER_H diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartModel.cpp index cee72e813..f2ae06bde 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartModel.cpp @@ -344,6 +344,7 @@ void HeartModel::RefreshHeartRateScreen(uint16_t perSec, uint16_t rest, uint16_t HeartRateView::GetInstance()->RefreshHeartRatePerSec(perSec); HeartRateView::GetInstance()->RefreshHeartRateMax(maxRate); HeartRateView::GetInstance()->RefreshHeartRateMin(minRate); + HeartRateView::GetInstance()->GetHeartRate();//获取心率结果 } } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRateView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRateView.cpp index 9304794ba..4f44d17b8 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRateView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRateView.cpp @@ -12,7 +12,16 @@ #include "ScreenModels.h" #include "ui_resource_image.h" #include "common/image_cache_manager.h" - +#include +#include +#include +#include +#include +#include +#include +#include +#include "MainViewSample.h" +#include "/heartrate/include/HeartRemindPresenter.h" namespace OHOS { static HeartRateView *g_pHeartRateView = nullptr; @@ -386,6 +395,26 @@ void HeartRateView::InsertTopAndBottomRateImage(void) imageViewBottom->SetWidth(BOTTOM_IMAGE_WIDTH); imageViewBottom->SetHeight(BOTTOM_IMAGE_HEIGHT); Add(imageViewBottom); + + // Add Button to App + if (button_ == nullptr) { + button_ = new UIButton(); + } + button_->SetPosition(0, 0); // widget's left position and top position + button_->Resize(466, 466); // widget's width and height + button_->SetViewId("Remind");// Set style + button_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); + button_->SetStyle(STYLE_BACKGROUND_OPA, 0x00); + + // Set additional property + button_->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + + // Add the CallBack about events + UIView::OnClickListener* button3Click = static_cast(HeartRemindPresenter::GetInstance()); + button_->SetOnClickListener(button3Click); + // Add to rootView + Add(button_); + button_->SetVisible(true); } void HeartRateView::UpdataTopAndBottomRate(void) @@ -577,6 +606,7 @@ bool HeartRateView::InitView(void) UpdataTopAndBottomRate(); HeartbeatImageAnimatorStop(); InitRefreshInterface(); + return true; } @@ -795,4 +825,10 @@ void HeartRateView::RefreshRestHeartRate(uint16_t value) } } } +void HeartRateView::GetHeartRate(void) +{ + // 模拟心率监测,等待20秒 + std::this_thread::sleep_for(std::chrono::seconds(20)); + NativeAbility::GetInstance().ChangeSlice(VIEW_HEARTRATEREMIND); +} } // namespace OHOS diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRemindPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRemindPresenter.cpp new file mode 100644 index 000000000..f31621d01 --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRemindPresenter.cpp @@ -0,0 +1,85 @@ +#include "AppViewIDs.h" +#include "NativeAbility.h" + +#include +#include +#include +#include "/heartrate/include/HeartRemindPresenter.h" +#include "HeartRateView.h" + +namespace OHOS +{ + + // 当前Presenter属性实例化的内存指针 + static HeartRemindPresenter *g_pHeartRemindPresenter = nullptr; + + HeartRemindPresenter::HeartRemindPresenter() + { + + g_pHeartRemindPresenter = this; + } + + HeartRemindPresenter::~HeartRemindPresenter() + { + + g_pHeartRemindPresenter = nullptr; + } + + HeartRemindPresenter *HeartRemindPresenter::GetInstance() + { + + return g_pHeartRemindPresenter; + } + + void HeartRemindPresenter::OnStart() + { + + Presenter::OnStart(); + } + + void HeartRemindPresenter::OnPause(void) + { + + Presenter::OnPause(); + } + + void HeartRemindPresenter::OnResume(void) + { + + Presenter::OnResume(); + } + + void HeartRemindPresenter::OnStop(void) + { + + Presenter::OnStop(); + } + + bool HeartRemindPresenter::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 HeartRemindPresenter::OnClick(UIView &view, const ClickEvent &event) + { + // 根据控件id查找是哪个控件触发了点击回调 + if (strcmp(view.GetViewId(), NOTEBUTTON) == 0) + { + NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); + } + if (strcmp(view.GetViewId(), "Remind") == 0) + { + // 模拟心率监测,等待20秒 + //std::this_thread::sleep_for(std::chrono::seconds(20)); + NativeAbility::GetInstance().ChangeSlice(VIEW_HEARTRATEREMIND); + } + return true; + } +} \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRemindView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRemindView.cpp new file mode 100644 index 000000000..21f82bb3c --- /dev/null +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRemindView.cpp @@ -0,0 +1,272 @@ +/*正常的心率范围:60~100*/ + +#include "/heartrate/include/HeartRemindView.h" + +#include "common/image_cache_manager.h" +#include "UiConfig.h" +#include "ui_resource_image.h" +#include +#include "components/ui_button.h" +namespace OHOS +{ + static HeartRemindView *g_pHeartRemindView{nullptr}; + + HeartRemindView::HeartRemindView() + { + + g_pHeartRemindView = this; + } + + HeartRemindView::~HeartRemindView() + { + DeInit(); + g_pHeartRemindView = nullptr; + } + + HeartRemindView *HeartRemindView::GetInstance() + { + + return g_pHeartRemindView; + } + void HeartRemindView::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 (label2_ == nullptr) + { + label2_ = new UILabel(); + } + label2_->SetPosition(50, 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 + if (heartrate > 100) + { + label2_->SetText("当前心率值高于 "); // 显示当前心率值高于 + + } + else if (heartrate < 40) + { + label2_->SetText("当前心率值低于 "); // 显示当前心率值低于 + + } + 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 (label3_ == nullptr) + { + label3_ = new UILabel(); + } + label3_->SetPosition(260, 235); // 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((std::to_string(heartrate) + "次/分钟").c_str()); // 显示心率值 + 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 (label4_ == nullptr) + { + label4_ = new UILabel(); + } + label4_->SetPosition(128, 277); // 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("Button1"); // Set style + + // 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_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + // Add the CallBack about events + UIView::OnClickListener *button1Click = static_cast(HeartRemindPresenter::GetInstance()); + button1_->SetOnClickListener(button1Click); + // Add to rootView + container_->Add(button1_); + button1_->SetVisible(true); + } + + void HeartRemindView::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 (label2_ != nullptr) + { + delete label2_; + label2_ = nullptr; + } + if (label3_ != nullptr) + { + delete label3_; + label3_ = nullptr; + } + if (label4_ != nullptr) + { + delete label4_; + label4_ = nullptr; + } + if (button1_ != nullptr) + { + delete button1_; + button1_ = nullptr; + } + } + + UIView *HeartRemindView::GetView() + { + Init(); + return container_; + } + void HeartRemindView::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(HeartRemindPresenter::GetInstance()); + if (draglistener == nullptr) + { + return; + } + container_->SetOnDragListener(draglistener); + + container_->SetTouchable(true); + container_->SetDraggable(true); + + GetView(); + RootView::GetInstance()->Add(container_); + } + + void HeartRemindView::OnSetUpView() + { + + View::OnSetUpView(); + Draw(); + } + + void HeartRemindView::OnTearDownView() + { + + View::OnTearDownView(); + return; + } + + void HeartRemindView::OnStop() + { + View::OnStop(); + RootView::GetInstance()->RemoveAll(); + return; + } +} diff --git a/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_api.a b/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_api.a index c4394567d..33be4cbaf 100644 Binary files a/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_api.a and b/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_api.a differ diff --git a/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_core.a b/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_core.a index e1e0d4a05..6ab3e8ed6 100644 Binary files a/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_core.a and b/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_core.a differ diff --git a/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_drv.a b/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_drv.a index ba45a18f1..1280d6abd 100644 Binary files a/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_drv.a and b/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_drv.a differ diff --git a/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_sample.a b/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_sample.a index 1c6f9fda9..b907aa4a6 100644 Binary files a/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_sample.a and b/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_sample.a differ diff --git a/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_vendor.a b/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_vendor.a index de0cdc313..37b97208d 100644 Binary files a/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_vendor.a and b/code/sdk/interim_binary/brandy/libs/audio/evb4_standard/liteos/libaudio_vendor.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_sample.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_sample.a index 39ed92808..bc441b478 100644 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_sample.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_sample.a differ diff --git a/code/sdk/interim_binary/brandy/libs/gpu/evb_standard/libgpu.a b/code/sdk/interim_binary/brandy/libs/gpu/evb_standard/libgpu.a index 3b90cd448..83dbb50ee 100644 Binary files a/code/sdk/interim_binary/brandy/libs/gpu/evb_standard/libgpu.a and b/code/sdk/interim_binary/brandy/libs/gpu/evb_standard/libgpu.a differ diff --git a/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_captuer.a b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_captuer.a index a152c48ab..fb801bc01 100644 Binary files a/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_captuer.a and b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_captuer.a differ diff --git a/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_player.a b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_player.a index 48ce9b55f..0749a8484 100644 Binary files a/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_player.a and b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_player.a differ diff --git a/code/sdk/tools/pkg/fwpkg/brandy/tempFiles/application.bin b/code/sdk/tools/pkg/fwpkg/brandy/tempFiles/application.bin index e46a4e1ee..d578042aa 100644 Binary files a/code/sdk/tools/pkg/fwpkg/brandy/tempFiles/application.bin and b/code/sdk/tools/pkg/fwpkg/brandy/tempFiles/application.bin differ