From db64b9ee00575531f10f1df3b2e65cf5ce9329f8 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Mon, 29 Jan 2024 11:42:48 +0800 Subject: [PATCH] =?utf8?q?=E8=A1=80=E6=B0=A7=E5=8A=A8=E7=94=BB=E5=90=8C?= =?utf8?q?=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativelauncher/include/UiConfig.h | 18 +++---- .../bloodoxygen/include/BloodBandoffView.h | 49 ++++++++++++------- .../bloodoxygen/src/BloodBandoffView.cpp | 45 +++++++++++------ .../bloodoxygen/src/BloodOxygenPresenter.cpp | 4 +- 4 files changed, 73 insertions(+), 43 deletions(-) diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h index 77bfa4f10..8f3f0b2b7 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h @@ -96,15 +96,15 @@ namespace OHOS static constexpr const char *PNG_BLOOD_FLOW_IMAGE_29 = APP_RES_PATH "/BLOOD_FLOW_IMAGE_31.bin"; static constexpr const char *PNG_BLOOD_FLOW_IMAGE_30 = APP_RES_PATH "/BLOOD_FLOW_IMAGE_32.bin"; /* -------------------------------- 血氧动画 ------------------------------------------------- */ - static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_0 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_01.bin"; - static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_1 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_02.bin"; - static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_2 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_03.bin"; - static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_3 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_04.bin"; - static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_4 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_05.bin"; - static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_5 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_06.bin"; - static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_6 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_07.bin"; - static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_7 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_08.bin"; - static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_8 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_09.bin"; + static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_0 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_1.bin"; + static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_1 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_2.bin"; + static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_2 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_3.bin"; + static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_3 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_4.bin"; + static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_4 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_5.bin"; + static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_5 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_6.bin"; + static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_6 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_7.bin"; + static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_7 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_8.bin"; + static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_8 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_9.bin"; static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_9 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_10.bin"; static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_10 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_11.bin"; static constexpr const char *PNG_COUNTDOWN_TIME_IMAGE_11 = APP_RES_PATH "/Blood/SPO2H/BLOOD_IMAGE_12.bin"; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodBandoffView.h b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodBandoffView.h index 874efe7a2..c9f0b3f28 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodBandoffView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodBandoffView.h @@ -1,3 +1,13 @@ +/*** + * @Author: Caisking 3449750381@qq.com + * @Date: 2023-12-13 19:33:14 + * @LastEditors: Caisking 3449750381@qq.com + * @LastEditTime: 2024-01-26 18:24:46 + * @FilePath: /FD230/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodBandoffView.h + * @Description: + * @ + * @Copyright (c) 2024 by Caisking , All Rights Reserved. + */ /* * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. * Description: bloodBandoff view @@ -11,28 +21,33 @@ #include "components/ui_label.h" #include "components/ui_view_group.h" #include "components/ui_image_animator.h" +#include "components/ui_button.h" +#include "components/ui_label_button.h" #include "BaseView.h" #include "View.h" #include "ohos_types.h" -namespace OHOS { -class BloodBandoffView { -public: - BloodBandoffView(); - virtual ~BloodBandoffView(); +namespace OHOS +{ + class BloodBandoffView + { + public: + BloodBandoffView(); + virtual ~BloodBandoffView(); - UIViewGroup *CreateUIViewGroup(); - static BloodBandoffView *GetInstance(void); + UIViewGroup *CreateUIViewGroup(); + static BloodBandoffView *GetInstance(void); - UIViewGroup *GetBandoffViewGroup(); - UIImageAnimatorView *GetImageAnimator(); -private: - UILabel *label; - UIViewGroup *group; - UIImageView *imageView; - UIImageAnimatorView *imageAnimator; -}; -} + UIViewGroup *GetBandoffViewGroup(); + UIImageAnimatorView *GetImageAnimator(); + private: + UILabel *label; + UILabelButton *testButton; + UIViewGroup *group; + UIImageView *imageView; + UIImageAnimatorView *imageAnimator; + }; +} -#endif // 血氧跳转界面 \ No newline at end of file +#endif // 血氧跳转界面 \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodBandoffView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodBandoffView.cpp index 260001582..6fec8f0bd 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodBandoffView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodBandoffView.cpp @@ -16,20 +16,20 @@ namespace OHOS static constexpr uint16_t IMAGE_POSITION_Y = 134; static constexpr uint16_t IMAGE_POSITION_X = 150; static constexpr uint16_t IMAGEANIMATOERVIEW_SIZE = 90; - static constexpr uint16_t IMAGEANIMATOERVIEW_SPEED = 40; + static constexpr uint16_t IMAGEANIMATOERVIEW_SPEED = 30; // 标签设置 - static constexpr uint16_t LABEL_POSITION_X = 87; - static constexpr uint16_t LABEL_POSITION_Y = 200; - static constexpr uint16_t LABEL_POSITION_WIDTH = 288; - static constexpr uint16_t LABEL_POSITION_HEIGHT = 50; + static constexpr uint16_t LABEL_POSITION_X = 173; + static constexpr uint16_t LABEL_POSITION_Y = 52; + static constexpr uint16_t LABEL_POSITION_WIDTH = 120; + static constexpr uint16_t LABEL_POSITION_HEIGHT = 35; // 图片设置 static constexpr uint16_t IMAGE_ENTER_POSITION_X = 131; static constexpr uint16_t IMAGE_ENTER_POSITION_Y = 70; static constexpr uint16_t TITLE_LABEL_DEFAULT_HEIGHT = 30; - static constexpr uint16_t FONT_DEFAULT_SIZE = 25; + static constexpr uint16_t FONT_DEFAULT_SIZE = 30; static constexpr uint16_t VIEW_DISTANCE_TO_LEFT_SIDE = 48; static constexpr uint16_t TEXT_DISTANCE_TO_LEFT_SIDE = 50; static constexpr uint16_t TEXT_DISTANCE_TO_TOP_SIDE = 11; @@ -187,7 +187,7 @@ namespace OHOS } group->Add(label); label->SetPosition(LABEL_POSITION_X, LABEL_POSITION_Y, LABEL_POSITION_WIDTH, LABEL_POSITION_HEIGHT); - label->SetText("偏紧佩戴,保持静止"); + label->SetText("正在检测"); label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_DEFAULT_SIZE); label->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); @@ -199,19 +199,34 @@ namespace OHOS } imageAnimator->SetImageAnimatorSrc(g_imageAnimatorInfo_Time, IMAGEANIMATOERVIEW_SIZE, IMAGEANIMATOERVIEW_SPEED); imageAnimator->Start(); - imageAnimator->SetRepeat(true); + imageAnimator->SetRepeat(false); group->Add(imageAnimator); - imageView = new UIImageView(); - if (imageView == nullptr) + if (testButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodBandoffView::new UIImageView fail"); - return nullptr; + testButton = new UILabelButton(); } - imageView->SetPosition(IMAGE_ENTER_POSITION_X, IMAGE_ENTER_POSITION_Y); // 30 : offset - imageView->SetSrc(PNG_BLOOD_ICON_ENTER); - group->Add(imageView); + testButton->SetPosition(118, 336); // widget's left position and top position + testButton->Resize(230, 80); // widget's width and height + testButton->SetViewId("labelButton"); // Set style + testButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); + + // Set additional property + testButton->SetText("停止检测"); + testButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 26); + testButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); + group->Add(testButton); +#if 0 + imageView = new UIImageView(); + if (imageView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodBandoffView::new UIImageView fail"); + return nullptr; + } + imageView->SetPosition(IMAGE_ENTER_POSITION_X, IMAGE_ENTER_POSITION_Y); // 30 : offset + imageView->SetSrc(PNG_BLOOD_ICON_ENTER); + group->Add(imageView); +#endif return group; } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp index ca35307ab..0949112c6 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp @@ -89,7 +89,7 @@ bool BloodOxygenPresenter::OnClick(UIView& view, const ClickEvent& event) BloodOxygenView::GetInstance()->GetBloodOxygenGroup()->SetVisible(false); BloodBandoffView::GetInstance()->GetBandoffViewGroup()->SetVisible(true); BloodBandoffView::GetInstance()->GetImageAnimator()->Stop(); - BloodBandoffView::GetInstance()->GetImageAnimator()->SetRepeat(true); + BloodBandoffView::GetInstance()->GetImageAnimator()->SetRepeat(false); BloodBandoffView::GetInstance()->GetImageAnimator()->Start(); BloodOxygenModel::GetInstance()->SetBloodBandoffViewStatus(true); BloodOxygenView::GetInstance()->GetTestButton()->SetTouchable(false); @@ -105,7 +105,7 @@ bool BloodOxygenPresenter::OnKeyAct(UIView& view, const KeyEvent& event) //如果是power键就返回上一级 if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) { - uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); + //uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); } return true; -- 2.17.1