-/***
- * @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/BloodResultView.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/BloodResultView.h
- */
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: bloodResult view
- * Author:
- * Create: 2021-08-01
- */
#ifndef BLOOD_Result_VIEW_H
#define BLOOD_Result_VIEW_H
UILabelExt *timeLabel = nullptr;
UILabel *bloodLabel = nullptr;
UILabelButtonExt *checkButton{nullptr};
+ UIScrollView *scrollView_ = nullptr;
};
}
static constexpr uint16_t IMAGE_POSITION_X = 143;
static constexpr uint16_t DETECTION_IMAGE_ANIMATORVIEW_SIZE = 30;
static constexpr uint16_t DETECTION_IMAGE_ANIMATORVIEW_SPEED = 40;
+ static const uint32_t BACK_GROUND_COLOR = 0xfff6f6f6;
static ImageAnimatorInfo g_imageAnimatorInfo_blood[30] = {
{PNG_CHECK_TIME_IMAGE_0, {IMAGE_POSITION_X, IMAGE_POSITION_Y}, IMAGE_SIZE, IMAGE_SIZE, IMG_SRC_FILE_PATH},
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodDetectionViewInit is begin");
/*初始化title*/
InitLabelExt(titleLabel, 83, 50, 300, 35, "title", STR_CHECKON, DEFAULT_VECTOR_FONT_FILENAME, 30);
- AddViewToRootContainer(titleLabel);
+ scrollView_->Add(titleLabel);
/* -------------------------------------------------------------------------- */
imageAnimator = new UIImageAnimatorView();
}
imageAnimator->SetImageAnimatorSrc(g_imageAnimatorInfo_blood, DETECTION_IMAGE_ANIMATORVIEW_SIZE, DETECTION_IMAGE_ANIMATORVIEW_SPEED);
imageAnimator->SetRepeat(true);
- AddViewToRootContainer(imageAnimator);
+ scrollView_->Add(imageAnimator);
/* -------------------------------------------------------------------------- */
/*初始化血氧值label*/
// InitUILabel(Spo2Text, 83, 83, 300, 300, "bloodtext", "--", GILROY_BOLD_FONT, 140);
- // AddViewToRootContainer(Spo2Text);
+ // scrollView_->Add(Spo2Text);
/* -------------------------------------------------------------------------- */
InitButtonExt(testButton, 93, 330, 280, 90, STOPCHECK, STR_CHECKSTOP, 30);
- AddViewToRootContainer(testButton);
+ scrollView_->Add(testButton);
/* -------------------------------------------------------------------------- */
UIView::OnClickListener *clickLeftListener = (UIView::OnClickListener *)OHOS::BloodDetectionPresenter::GetInstance();
void BloodDetectionView::OnStart()
{
+ scrollView_ = new UIScrollView();
+ if (scrollView_ == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "scrollView_ new fail");
+ return;
+ }
+ scrollView_->SetScrollBlankSize(35);
+ scrollView_->SetReboundSize(50);
+ scrollView_->SetPosition(0, 0, Screen::GetInstance().GetWidth(),
+ Screen::GetInstance().GetHeight());
+
+ scrollView_->SetTouchable(false);
+ scrollView_->SetDraggable(false);
+ scrollView_->SetStyle(STYLE_BACKGROUND_COLOR, BACK_GROUND_COLOR);
+ scrollView_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+
if (!BloodDetectionViewInit())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodDetectionView::InitBloodView fail");
imageAnimator->Start();
}
- RootView::GetInstance()->SetDraggable(true);
- RootView::GetInstance()->SetTouchable(true);
- RootView::GetInstance()->SetOnDragListener(presenter_);
-
- // 增加按键监听
- // presenter_->SetOnKeyActListener(keyactListener);
+ AddViewToRootContainer(scrollView_);
RootView::GetInstance()->SetOnKeyActListener(presenter_);
}
{
static BloodResultView *g_pBloodResultView{nullptr};
static const char *BLOODBACKPATH = "/user/res/Blood/beijing.bin";
-
+ static const uint32_t BACK_GROUND_COLOR = 0xfff6f6f6;
BloodResultView::BloodResultView()
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodResultView::BloodResultView");
UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::BloodResultPresenter::GetInstance();
checkButton->SetOnClickListener(clickListener);
- AddViewToRootContainer(checkButton);
+ scrollView_->Add(checkButton);
return true;
}
/***
UpSPO2Text();
- AddViewToRootContainer(titleLabel);
- AddViewToRootContainer(bloodLabel);
- AddViewToRootContainer(timeLabel);
+ scrollView_->Add(titleLabel);
+ scrollView_->Add(bloodLabel);
+ scrollView_->Add(timeLabel);
return true;
}
background->SetPosition(0, 0, 466, 466);
background->SetSrc(BLOODBACKPATH);
- AddViewToRootContainer(background);
+ scrollView_->Add(background);
return true;
}
/***
void BloodResultView::OnStart()
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodResultView::OnStart");
- View<BloodResultPresenter>::OnStart();
+ scrollView_ = new UIScrollView();
+ if (scrollView_ == nullptr) {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "scrollView_ new fail");
+ return;
+ }
+ scrollView_->SetScrollBlankSize(35);
+ scrollView_->SetReboundSize(50);
+ scrollView_->SetPosition(0, 0, Screen::GetInstance().GetWidth(),
+ Screen::GetInstance().GetHeight());
+
+ scrollView_->SetTouchable(false);
+ scrollView_->SetDraggable(false);
+ scrollView_->SetStyle(STYLE_BACKGROUND_COLOR, BACK_GROUND_COLOR);
+ scrollView_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
if (!BloodResultViewInit())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodResultView::InitBloodView fail");
}
- RootView::GetInstance()->SetDraggable(true);
- RootView::GetInstance()->SetTouchable(true);
- RootView::GetInstance()->SetOnDragListener(presenter_);
-
- // 增加按键监听
- // RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::BloodResultPresenter::GetInstance();
- //RootView::GetInstance()->SetOnKeyActListener(keyactListener);
+ AddViewToRootContainer(scrollView_);
RootView::GetInstance()->SetOnKeyActListener(presenter_);
}