#include "components/ui_view_group.h"\r
#include "DialModelSPO2.h"\r
#include "DialModelHeartRate.h"\r
-#include "BloodOxygenModel.h"\r
-#include "BloodOxygenPresenter.h"\r
+\r
#include "UiConfig.h"\r
+#include "uicomponents/UIComponents.h"\r
+#include "MainPresenterSample.h"\r
+\r
+#include "bloodoxygen/include/BloodResultPresenter.h"\r
+#include "bloodoxygen/include/BloodOxygenModel.h"\r
namespace OHOS\r
{\r
static BloodCardView *g_pBloodCardView{nullptr};\r
if (spo2 != 0) // 判断是否为默认数据\r
{\r
// 更新数据\r
- std::string bloodoxygenStr = std::to_string(spo2);\r
+ std::string bloodoxygenStr = std::to_string(spo2) + "%";\r
bloodLabel->SetText(bloodoxygenStr.c_str());\r
\r
// 获取时间差\r
- uint32_t time = BloodOxygenPresenter::GetInstance()->GetCurrentTime();\r
+ uint32_t time = BloodResultPresenter::GetInstance()->GetCurrentTime();\r
uint32_t check_time = BloodOxygenModel::GetInstance()->GetCheckTime();\r
- int time_diff = BloodOxygenPresenter::GetInstance()->GetTDOA(time, check_time);\r
+ int time_diff = BloodResultPresenter::GetInstance()->GetTDOA(time, check_time);\r
\r
if (time_diff == 0)\r
{\r
*/\r
bool BloodCardView::AddButton()\r
{\r
+ InitButtonExt(checkButton, 118, 336, 230, 80, MAIN_CLICK_BLOOD, STR_CHECK, 30);\r
+ checkButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffFF5A36); // 设置按键颜色\r
+ // 设置按键监听\r
+ UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::MainPresenterSample::GetInstance();\r
+ checkButton->SetOnClickListener(clickListener);\r
+\r
+ Add(checkButton);\r
return true;\r
}\r
/***\r
*/\r
bool BloodCardView::InitLable()\r
{\r
- // Add Label to App\r
- if (bloodLabel == nullptr)\r
- {\r
- bloodLabel = new UILabel();\r
- }\r
- bloodLabel->SetPosition(83, 108); // widget's left position and top position\r
- bloodLabel->Resize(300, 250); // widget's width and height\r
- bloodLabel->SetViewId("label2"); // Set style\r
- bloodLabel->SetStyle(STYLE_TEXT_FONT, 150);\r
+ /*初始化title*/\r
+ InitLabelExt(titleLabel, 83, 50, 300, 35, "title", STR_BLOOD, DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+ /*初始化血氧值label*/\r
+ InitUILabel(bloodLabel, 83, 22, 300, 300, "bloodtext", "--", DEFAULT_VECTOR_FONT_FILENAME, 120);\r
+ /*初始化检测时间*/\r
+ InitLabelExt(timeLabel, 53, 260, 360, 35, "time", STR_CHECKNO, DEFAULT_VECTOR_FONT_FILENAME, 30);\r
+ // 设置来回滚动属性\r
+ timeLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);\r
+ timeLabel->SetRollSpeed(70);\r
\r
- // Set additional property\r
- bloodoxygen = BloodOxygenModel::GetInstance()->GetSPO2data();\r
- if (bloodoxygen != 0)\r
- {\r
- std::string bloodoxygenStr = std::to_string(bloodoxygen);\r
- bloodLabel->SetText(bloodoxygenStr.c_str());\r
- }\r
- else\r
- {\r
- bloodLabel->SetText("--");\r
- }\r
- bloodLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);\r
- bloodLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- bloodLabel->SetRollSpeed(0);\r
- bloodLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 150);\r
+ UpSPO2Text();\r
\r
- // Add to rootView\r
+ Add(titleLabel);\r
Add(bloodLabel);\r
-\r
- /* -------------------------------------------------------------------------- */\r
- timeLabel = new UILabelExt();\r
- if (timeLabel == nullptr)\r
- {\r
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::new timeLabel fail");\r
- return false;\r
- }\r
- timeLabel->SetPosition(90, 300); // widget's left position and top position\r
- timeLabel->Resize(280, 100); // widget's width and height\r
- timeLabel->SetViewId("label1"); // Set style\r
- timeLabel->SetStyle(STYLE_TEXT_FONT, 30);\r
- timeLabel->SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS);\r
- timeLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- timeLabel->SetRollSpeed(0);\r
- timeLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);\r
-\r
- // Add to rootView\r
Add(timeLabel);\r
\r
- UpSPO2Text();\r
-\r
- // Add Label to App\r
- if (titleLabel == nullptr)\r
- {\r
- titleLabel = new UILabel();\r
- }\r
- titleLabel->SetPosition(158, 70); // widget's left position and top position\r
- titleLabel->Resize(200, 90); // widget's width and height\r
- titleLabel->SetViewId("label3"); // Set style\r
- titleLabel->SetStyle(STYLE_TEXT_FONT, 28);\r
-\r
- // Set additional property\r
- titleLabel->SetText("血氧饱和度");\r
- titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);\r
- titleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);\r
- titleLabel->SetRollSpeed(0);\r
- titleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 28);\r
-\r
- // Add to rootView\r
- Add(titleLabel);\r
return true;\r
}\r
/***\r
*/\r
bool BloodCardView::Initbackground()\r
{\r
- // Add ImageView to App\r
- if (background == nullptr)\r
- {\r
- background = new UIImageView();\r
- }\r
+\r
+ background = new UIImageView();\r
+\r
background->SetPosition(0, 0); // widget's left position and top position\r
background->Resize(466, 466); // widget's width and height\r
background->SetViewId("image1"); // Set style\r
\r
- // Add to rootView\r
Add(background);\r
return true;\r
}\r
delete background;\r
background = nullptr;\r
}\r
- if (warnButton != nullptr)\r
- {\r
- delete warnButton;\r
- warnButton = nullptr;\r
- }\r
- if (monitorButton != nullptr)\r
- {\r
- delete monitorButton;\r
- monitorButton = nullptr;\r
- }\r
if (bloodLabel != nullptr)\r
{\r
delete bloodLabel;\r
resLoadStatus = true;\r
}\r
}\r
- \r
+\r
/*卸载血氧图片资源*/\r
void BloodCardView::UnLoadBloodImageRes(void)\r
{\r
-/*** \r
+/***\r
+ * @Date: 2024-06-28 16:08:09\r
+ * @LastEditors: Caisking 3449750381@qq.com\r
+ * @LastEditTime: 2024-07-29 11:48:50\r
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/heart_blood/BloodCardView.h\r
+ */\r
+/***\r
* @Date: 2024-06-26 16:13:19\r
* @LastEditors: Caisking 3449750381@qq.com\r
* @LastEditTime: 2024-06-26 16:52:01\r
#include "components/ui_image_animator.h"\r
#include "components/ui_label_button_ext.h"\r
#include "components/ui_card_page.h"\r
+#include "components/ui_label_button_ext.h"\r
\r
namespace OHOS\r
{\r
\r
-#define WARNING "button1"\r
-#define CHECK "button2"\r
+#define CHECK "buttoncheck"\r
\r
class BloodCardView : public UICardPage\r
{\r
private:\r
void PreLoadBloodImageRes(void);\r
void UnLoadBloodImageRes(void);\r
+\r
private:\r
UIView::OnDragListener *draglistener{nullptr};\r
BloodCardView(BloodCardView &&) = delete;\r
UIImageView *background = nullptr;\r
UIButton *warnButton = nullptr;\r
UILabelButton *monitorButton = nullptr;\r
- UILabel *titleLabel = nullptr;\r
- UILabel *bloodLabel = nullptr;\r
+ UILabelExt *titleLabel = nullptr;\r
UILabelExt *timeLabel = nullptr;\r
+ UILabel *bloodLabel = nullptr;\r
+\r
+ UILabelButtonExt *checkButton;\r
\r
bool viewiInitStatus{false};\r
bool resLoadStatus{false};\r