From ae720ebef5886099da708c7b8ea542cc2982c9e8 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Fri, 6 Mar 2026 14:19:49 +0800 Subject: [PATCH] =?utf8?q?1.=E5=88=A0=E9=99=A4n9=E9=A1=B9=E7=9B=AE?= =?utf8?q?=E6=97=A0=E7=94=A8slice=EF=BC=9A=E6=B8=A9=E5=BA=A6=202.Resume?= =?utf8?q?=E5=87=BD=E6=95=B0=E6=B7=BB=E5=8A=A0=E6=8C=89=E9=94=AE=E7=9B=91?= =?utf8?q?=E5=90=AC=E9=98=B2=E6=AD=A2=E6=8C=89=E9=94=AE=E7=9B=91=E5=90=AC?= =?utf8?q?=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../callerlog/include/CallerLogPresenter.h | 1 - .../callerlog/src/CallerLogPresenter.cpp | 5 - .../codedlock/include/CodedLockPresenter.h | 2 - .../codedlock/src/CodedLockPresenter.cpp | 14 +- .../include/DisplayBrightnessPresenter.h | 2 - .../src/DisplayBrightnessPresent.cpp | 15 +- .../phone/include/PhoneCallPresenter.h | 2 - .../nativeui/phone/src/PhoneCallPresenter.cpp | 17 +- .../nativeui/phone/src/PhoneCallView.cpp | 2 +- .../sleep/include/SleepControlPresenter.h | 2 - .../sleep/src/SleepControlPresenter.cpp | 12 +- .../src/SystemUpdatePresenter.cpp | 2 +- .../temperature/include/TempClickMea.h | 31 - .../temperature/include/TempContinueWarn.h | 31 - .../temperature/include/TempExitInter.h | 31 - .../temperature/include/TempExitPrompt.h | 30 - .../temperature/include/TempInitInter.h | 34 - .../temperature/include/TempJoinStudy.h | 32 - .../temperature/include/TempLittleTip.h | 29 - .../temperature/include/TempMainView.h | 82 --- .../temperature/include/TempMeaProcess.h | 38 -- .../temperature/include/TempMeasure.h | 34 - .../nativeui/temperature/include/TempModel.h | 28 - .../temperature/include/TempPresenter.h | 105 ---- .../temperature/include/TempPromptWear.h | 33 - .../temperature/include/TempRemindWear.h | 30 - .../nativeui/temperature/include/TempReport.h | 32 - .../temperature/include/TempStudyAbout.h | 29 - .../nativeui/temperature/include/TempWarn.h | 34 - .../nativeui/temperature/src/TempClickMea.cpp | 143 ----- .../temperature/src/TempContinueWarn.cpp | 158 ----- .../temperature/src/TempExitInter.cpp | 164 ----- .../temperature/src/TempExitPrompt.cpp | 127 ---- .../temperature/src/TempInitInter.cpp | 235 ------- .../temperature/src/TempJoinStudy.cpp | 186 ------ .../temperature/src/TempLittleTip.cpp | 173 ----- .../nativeui/temperature/src/TempMainView.cpp | 591 ------------------ .../temperature/src/TempMeaProcess.cpp | 177 ------ .../nativeui/temperature/src/TempMeasure.cpp | 182 ------ .../nativeui/temperature/src/TempModel.cpp | 38 -- .../temperature/src/TempPresenter.cpp | 330 ---------- .../temperature/src/TempPromptWear.cpp | 135 ---- .../temperature/src/TempRemindWear.cpp | 121 ---- .../nativeui/temperature/src/TempReport.cpp | 212 ------- .../temperature/src/TempStudyAbout.cpp | 147 ----- .../nativeui/temperature/src/TempWarn.cpp | 161 ----- .../traing/include/TraingEnddataPresenter.h | 2 - .../traing/include/TraingNomalPresenter.h | 2 - .../nativeui/traing/include/TraingPresenter.h | 2 - .../traing/src/TraingEnddataPresenter.cpp | 13 +- .../traing/src/TraingNomalPresenter.cpp | 13 +- .../nativeui/traing/src/TraingPresenter.cpp | 6 +- .../traing/src/TraingSetPresenter.cpp | 4 - .../training_GPS/include/TraingGPSPresenter.h | 2 - .../include/TraingGPSbackPresenter.h | 2 - .../include/TraingGPSlackPresenter.h | 2 - .../include/TraingGPSnotePresenter.h | 2 - .../include/TraingGPSsetPresenter.h | 2 - .../training_GPS/src/TraingGPSPresenter.cpp | 16 +- .../src/TraingGPSbackPresenter.cpp | 16 - .../src/TraingGPSlackPresenter.cpp | 17 - .../src/TraingGPSlostPresenter.cpp | 2 - .../src/TraingGPSnotePresenter.cpp | 17 +- .../src/TraingGPSsetPresenter.cpp | 17 +- .../include/TraingCardPresenter.h | 2 - .../training_card/src/TraingCardPresenter.cpp | 12 - .../config/target_config/brandy/config.py | 1 + .../frameworks/dock/pointer_input_device.cpp | 6 +- 68 files changed, 19 insertions(+), 4158 deletions(-) delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempClickMea.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempContinueWarn.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempExitInter.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempExitPrompt.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempInitInter.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempJoinStudy.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempLittleTip.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMainView.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMeaProcess.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMeasure.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempModel.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempPresenter.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempPromptWear.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempRemindWear.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempReport.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempStudyAbout.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempWarn.h delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempClickMea.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempContinueWarn.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempExitInter.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempExitPrompt.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempInitInter.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempJoinStudy.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempLittleTip.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMainView.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMeaProcess.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMeasure.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempModel.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempPresenter.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempPromptWear.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempRemindWear.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempReport.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempStudyAbout.cpp delete mode 100644 code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempWarn.cpp diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h index fc623681c..460fa6340 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h @@ -23,7 +23,6 @@ public: ~CallerLogPresenter() override; void OnStart() override; - void OnPause() override; void OnResume() override; void OnStop() override; diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp index 1d29b3ecb..beb0c5c49 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp @@ -36,18 +36,13 @@ CallerLogPresenter *CallerLogPresenter::GetInstance(void) void CallerLogPresenter::OnStart() { - Presenter::OnStart(); } void CallerLogPresenter::OnResume(void) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnResume()"); - return; } -void CallerLogPresenter::OnPause(void) {} - void CallerLogPresenter::OnStop(void) { if (hintsCounting != nullptr) { diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/include/CodedLockPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/include/CodedLockPresenter.h index f3d9bb776..208bb1749 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/include/CodedLockPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/include/CodedLockPresenter.h @@ -43,9 +43,7 @@ namespace OHOS virtual ~CodedLockPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static CodedLockPresenter *GetInstance(); void JudgeMatch(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/src/CodedLockPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/src/CodedLockPresenter.cpp index ce75982d0..84190655a 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/src/CodedLockPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/codedlock/src/CodedLockPresenter.cpp @@ -53,22 +53,10 @@ namespace OHOS /*重置密码状态*/ CodedLockModel::GetInstance()->ClearPassword(); CodedLockModel::GetInstance()->ResetLockState(); - Presenter::OnStart(); } - - void CodedLockPresenter::OnPause(void) - { - Presenter::OnPause(); - } - + void CodedLockPresenter::OnResume(void) { - Presenter::OnResume(); - } - - void CodedLockPresenter::OnStop(void) - { - Presenter::OnStop(); } void CodedLockPresenter::JudgeMatch() diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h index c454b00c8..cf86ff152 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/displaybrightness/include/DisplayBrightnessPresenter.h @@ -87,9 +87,7 @@ namespace OHOS virtual ~DisplayBrightnessPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static DisplayBrightnessPresenter *GetInstance(); void SetRaiseToBrightnessState(bool value); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp index 5adfefe27..9e1a233d9 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/displaybrightness/src/DisplayBrightnessPresent.cpp @@ -145,25 +145,12 @@ namespace OHOS void DisplayBrightnessPresenter::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessPresenter::OnStart"); - Presenter::OnStart(); - } - - void DisplayBrightnessPresenter::OnPause(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessPresenter::OnPause"); - Presenter::OnPause(); } void DisplayBrightnessPresenter::OnResume(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessPresenter::OnResume"); - Presenter::OnResume(); - } - - void DisplayBrightnessPresenter::OnStop(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "DisplayBrightnessPresenter::OnStop"); - Presenter::OnStop(); + RootView::GetInstance()->SetOnKeyActListener(this); } bool DisplayBrightnessPresenter::OnClick(UIView &view, const ClickEvent &event) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/include/PhoneCallPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/include/PhoneCallPresenter.h index 66fc97493..4dd464f13 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/include/PhoneCallPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/include/PhoneCallPresenter.h @@ -22,9 +22,7 @@ namespace OHOS virtual ~PhoneCallPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; void Invalidate(); void UpdatePhoneNumberView(const std::string &number); static PhoneCallPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallPresenter.cpp index 7426a1077..8a2b71f83 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallPresenter.cpp @@ -43,26 +43,11 @@ namespace OHOS void PhoneCallPresenter::OnStart() { - - Presenter::OnStart(); - } - - void PhoneCallPresenter::OnPause(void) - { - - Presenter::OnPause(); } void PhoneCallPresenter::OnResume(void) { - - Presenter::OnResume(); - } - - void PhoneCallPresenter::OnStop(void) - { - - Presenter::OnStop(); + RootView::GetInstance()->SetOnKeyActListener(this); } bool PhoneCallPresenter::OnDrag(UIView &view, const DragEvent &event) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallView.cpp index e16416ea5..0c7891421 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallView.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/phone/src/PhoneCallView.cpp @@ -262,7 +262,7 @@ namespace OHOS Init(); // 增加按键监听 RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::PhoneCallPresenter::GetInstance(); - RootView::GetInstance()->SetOnKeyActListener(keyactListener); + RootView::GetInstance()->SetOnKeyActListener(keyactListener); } diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/sleep/include/SleepControlPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/sleep/include/SleepControlPresenter.h index 998b9746f..4d4cad25b 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/sleep/include/SleepControlPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/sleep/include/SleepControlPresenter.h @@ -36,9 +36,7 @@ namespace OHOS virtual ~SleepControlPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static SleepControlPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/sleep/src/SleepControlPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/sleep/src/SleepControlPresenter.cpp index 724a4a22d..6caceffbf 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/sleep/src/SleepControlPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/sleep/src/SleepControlPresenter.cpp @@ -53,19 +53,9 @@ namespace OHOS Presenter::OnStart(); } - void SleepControlPresenter::OnPause(void) - { - Presenter::OnPause(); - } - void SleepControlPresenter::OnResume(void) { - Presenter::OnResume(); - } - - void SleepControlPresenter::OnStop(void) - { - Presenter::OnStop(); + RootView::GetInstance()->SetOnKeyActListener(this); } bool SleepControlPresenter::OnDrag(UIView &view, const DragEvent &event) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/systemupdate/src/SystemUpdatePresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/systemupdate/src/SystemUpdatePresenter.cpp index 149f918cf..df1eac3bb 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/systemupdate/src/SystemUpdatePresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/systemupdate/src/SystemUpdatePresenter.cpp @@ -51,7 +51,7 @@ namespace OHOS void SystemUpdatePresenter::OnResume(void) { - Presenter::OnResume(); + RootView::GetInstance()->SetOnKeyActListener(this); } void SystemUpdatePresenter::OnStop(void) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempClickMea.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempClickMea.h deleted file mode 100644 index 9197eb9f9..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempClickMea.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_CLICK_MEA_H -#define TEMP_CLICK_MEA_H - -#include "components/ui_label.h" -#include "components/ui_label_button.h" -#include "components/ui_scroll_view.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempClickMea : public UIScrollView { -public: - TempClickMea(); - ~TempClickMea() override; - bool InitClickMea(); - static TempClickMea *GetInstance(); - void RefreshClickMea(void); -private: - bool TempInitButton(void); - bool TempInitLabel(void); - UILabel *tempLabel{nullptr}; - UILabelButton *tempButton[SET_TWO]{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempContinueWarn.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempContinueWarn.h deleted file mode 100644 index 841c3f7f6..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempContinueWarn.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_CONTINUE_WARN_H -#define TEMP_CONTINUE_WARN_H - -#include "components/ui_image_view.h" -#include "components/ui_label.h" -#include "components/ui_view_group.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempContinueWarn : public UIViewGroup { -public: - TempContinueWarn(); - ~TempContinueWarn() override; - bool InitTempContinue(); - static TempContinueWarn *GetInstance(); - void RefreshTempContinue(void); -private: - bool TempInitLabel(void); - bool TempInitImage(void); - UIImageView *tempImage{nullptr}; - UILabel *tempLabel[SET_THREE]{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempExitInter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempExitInter.h deleted file mode 100644 index c709523d8..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempExitInter.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_EXIT_INTER_H -#define TEMP_EXIT_INTER_H - -#include "components/ui_image_view.h" -#include "components/ui_label.h" -#include "AppGroupView.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempExitInter : public AppGroupView { -public: - TempExitInter(); - ~TempExitInter() override; - static TempExitInter *GetInstance(); - bool InitView(void *caller) override; -private: - bool TempInitLabel(void); - bool TempInitImage(void); - bool InitSimilarImage(int16 num, int16 tempX, int16 tempY, const char* imageSrc); - UILabel *tempLabel[SET_TWO]{nullptr}; - UIImageView *tempImage[SET_FOUR]{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempExitPrompt.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempExitPrompt.h deleted file mode 100644 index a0ec7255b..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempExitPrompt.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_EXIT_PROMPT -#define TEMP_EXIT_PROMPT - -#include "components/ui_image_view.h" -#include "components/ui_label.h" -#include "components/ui_scroll_view.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempExitPrompt : public UIScrollView { -public: - TempExitPrompt(); - ~TempExitPrompt() override; - bool InitExitPrompt(); - static TempExitPrompt *GetInstance(); -private: - bool TempInitImage(void); - bool TempInitLabel(void); - UIImageView *tempImage[SET_TWO]{nullptr}; - UILabel *tempLabel{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempInitInter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempInitInter.h deleted file mode 100644 index 30781c5a0..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempInitInter.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_INIT_INTER_H -#define TEMP_INIT_INTER_H - -#include "components/ui_image_view.h" -#include "components/ui_label.h" -#include "components/ui_label_button.h" -#include "AppGroupView.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempInitInter : public AppGroupView { -public: - TempInitInter(); - ~TempInitInter() override; - static TempInitInter *GetInstance(); - bool InitView(void *caller) override; -private: - bool TempInitImage(void); - bool TempInitButton(void); - bool SetBasicLabel(void); - bool SetAppendLabel(void); - UIImageView *tempImage[SET_THREE]{nullptr}; - UILabel *tempLabel[TEMP_SET_SIX]{nullptr}; - UILabelButton *buttonTemp{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempJoinStudy.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempJoinStudy.h deleted file mode 100644 index 71bbec5dd..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempJoinStudy.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_JOIN_STUDY_H -#define TEMP_JOIN_STUDY_H - -#include "components/ui_label.h" -#include "components/ui_label_button.h" -#include "components/ui_scroll_view.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempJoinStudy : public UIScrollView { -public: - TempJoinStudy(); - ~TempJoinStudy() override; - bool InitJoinStudy(); - static TempJoinStudy *GetInstance(); -private: - bool TempInitLabel(void); - bool TempInitButton(void); - bool InitSimilarLabel(int16 num, int16 labelY, const char *labelText); - UILabel *tempTitle{nullptr}; - UILabel *tempLabel[SET_THREE]{nullptr}; - UILabelButton *tempButton[SET_TWO]{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempLittleTip.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempLittleTip.h deleted file mode 100644 index 7f34df36e..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempLittleTip.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_LITTLE_TIP -#define TEMP_LITTLE_TIP - -#include "components/ui_label.h" -#include "components/ui_scroll_view.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempLittleTip : public UIScrollView { -public: - TempLittleTip(); - ~TempLittleTip() override; - bool InitLittleTip(); - static TempLittleTip *GetInstance(); - void RefreshTip(void); -private: - bool SetBasicLabel(void); - bool SetAppendLabel(void); - UILabel *tempLabel[SET_NINE]{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMainView.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMainView.h deleted file mode 100644 index b6fa4453e..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMainView.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_MAIN_VIEW_H -#define TEMP_MAIN_VIEW_H - -#include -#include "View.h" -#include "components/ui_view_group.h" -#include "ChangeSliceListener.h" -#include "components/ui_swipe_view.h" -#include "temperature/include/TempPresenter.h" -#include "temperature/include/TempJoinStudy.h" -#include "temperature/include/TempMeasure.h" -#include "temperature/include/TempExitInter.h" -#include "temperature/include/TempPromptWear.h" -#include "temperature/include/TempClickMea.h" -#include "temperature/include/TempRemindWear.h" -#include "temperature/include/TempMeaProcess.h" -#include "temperature/include/TempInitInter.h" -#include "temperature/include/TempWarn.h" -#include "temperature/include/TempLittleTip.h" -#include "temperature/include/TempModel.h" -#include "temperature/include/TempStudyAbout.h" -#include "temperature/include/TempExitPrompt.h" -#include "temperature/include/TempContinueWarn.h" -#include "temperature/include/TempReport.h" - -namespace OHOS { -class TempMainView; -class TempMainView : public View { -public: - TempMainView(); - ~TempMainView() override; - static TempMainView *GetInstance(void); - void OnStart() override; - void ChangeView(int16 hideView, int16 showView); - void DropView(UIView& view); - int16 GetListenInter(void); - int16 GetWhichInter(void); - bool ChangeMeasure(int16 thisView); - bool ChangePrompt(int16 thisView); - bool ChangeClickMea(int16 thisView); - bool ChangeRemindWear(int16 thisView); - bool ChangeMeaProcess(int16 thisView); - bool ChangeTempInit(int16 thisView); - bool ChangeTempWarn(int16 thisView); - bool ChangeContinue(int16 thisView); - bool ChangeTempTip(int16 thisView); - bool ChangeStudyAbout(int16 thisView); - bool ChangeExitPrompt(int16 thisView); - bool ClickFunc(int16 interf); -private: - bool SetSwipeInter(int16 num); - void DeleteViceInter(void); - UIViewGroup *group{nullptr}; - UIViewGroup *container[11]{nullptr}; // 一共有11个界面 - UISwipeView *tempSwipeList[2]{nullptr}; // 下拉拖动的界面一共有2个 - TempJoinStudy *tempJoinStudy{nullptr}; - TempMeasure *tempMeasure{nullptr}; - TempExitInter *tempExitInter{nullptr}; - TempPromptWear *tempPromptWear{nullptr}; - TempClickMea *tempClickMea{nullptr}; - TempRemindWear *tempRemindWear{nullptr}; - TempMeaProcess *tempMeaProcess{nullptr}; - TempInitInter *tempInitInter{nullptr}; - TempWarn *tempWarn{nullptr}; - TempLittleTip *tempLittleTip{nullptr}; - TempContinueWarn *tempContinue{nullptr}; - TempExitPrompt *tempExitPrompt{nullptr}; - TempStudyAbout *tempStudyAbout{nullptr}; - TempReport *tempReport{nullptr}; - int16 interListen{-1}; // 监测上一个界面,-1用于还没获得监测界面时的初始化 - int16 tempWhichInter{0}; // 监测当前是哪一个温度界面 - int16 tempWhichMea{-1}; // 监测当前处于哪一个监测界面 -}; -} // namespace OHOS -#endif // MAIN_ALARM_VIEW_Ha \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMeaProcess.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMeaProcess.h deleted file mode 100644 index 2f13f8584..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMeaProcess.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_MEA_PROCESS_H -#define TEMP_MEA_PROCESS_H - -#include "components/ui_image_view.h" -#include "components/ui_label.h" -#include "components/ui_scroll_view.h" -#include "components/ui_circle_progress.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempMeaProcess : public UIScrollView { -public: - TempMeaProcess(); - ~TempMeaProcess() override; - static TempMeaProcess *GetInstance(); - bool InitMeaProcess(void); - void TempMeaDelayExit(void); - UICircleProgress *GetCircleProgress(void); - bool GetCircleStatus(void); - void SetCircleStatus(bool status); -private: - bool TempInitImage(void); - bool TempInitLabel(void); - bool TempCirCleProcess(void); - UICircleProgress *tempCircle{nullptr}; - UIImageView *imageMeasure{nullptr}; - UILabel *tempLabel{nullptr}; - bool circleStatus{false}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMeasure.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMeasure.h deleted file mode 100644 index 391931409..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempMeasure.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_MEASURE_H -#define TEMP_MEASURE_H - -#include "components/ui_image_view.h" -#include "components/ui_label.h" -#include "components/ui_label_button.h" -#include "AppGroupView.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempMeasure : public AppGroupView { -public: - TempMeasure(); - ~TempMeasure() override; - static TempMeasure *GetInstance(); - bool InitView(void *caller) override; -private: - bool TempInitImage(void); - bool TempInitLabel(void); - bool TempInitButton(void); - UILabel *labelMeasure{nullptr}; - UIImageView *imageMeasure[SET_THREE]{nullptr}; - UILabelButton *buttonMeasure{nullptr}; - UILabelButton *backgroudButton{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempModel.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempModel.h deleted file mode 100644 index 0c558818b..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempModel.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_MODEL_H -#define TEMP_MODEL_H - -#include "ohos_types.h" -#include "list.h" -#include "source.h" -#include "ChangeSliceListener.h" - -namespace OHOS { -class TempModel { -public: - TempModel(); - virtual ~TempModel(); - static TempModel *GetInstance(void); - void SetTempInterLis(int16 interListen); - int16 GetTempInterLis(void); -private: - int16 tempInterLis{0}; // 监测是否为首次进入体温应用 -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempPresenter.h deleted file mode 100644 index dbfb392c3..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempPresenter.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_PRESENTER_H -#define TEMP_PRESENTER_H - -#include "key/include/KeyInputListener.h" -#include "Presenter.h" -#include "UiConfig.h" -#include "components/ui_image_view.h" -#include "components/ui_swipe_view.h" -#include "wearable_log.h" -#include "color.h" -#include "ModelListenerSample.h" - -namespace OHOS { -constexpr char* TEMP_JOIN_STUDY = (char*)"tempjoinstudy"; -constexpr char* TEMP_INTER_JOIN = (char*)"tempjoin"; -constexpr char* TEMP_INTER_EXIT = (char*)"tempexit"; -constexpr char* TEMP_MEASURE_BUTTON = (char*)"measurebutton"; -constexpr char* TEMP_MEASURE_IMAGE = (char*)"measureimage"; -constexpr char* TEMP_MEASURE_PROCESS = (char*)"measureprocess"; -constexpr char* TEMP_PROMPT_NEXT = (char*)"temppromptnext"; -constexpr char* TEMP_MEA_EXIT = (char*)"tempmeaexit"; -constexpr char* TEMP_MEA_IN = (char*)"tempmeain"; -constexpr char* TEMP_MEA_AGAIN = (char*)"tempmeaagain"; -constexpr char* TEMP_WARN_BUTTON = (char*)"tempwarn"; -constexpr char* TEMP_IMAGE_LIT_TIP = (char*)"tempimagelietip"; -constexpr char* TEMP_EXIT_THIS = (char*)"tempexitstudy"; -constexpr char* TEMP_STUDY_THIS = (char*)"tempaboutstudy"; -constexpr char* TEMP_WARN_ID = (char*)"tempwarnid"; -constexpr char* TEMP_EXIT_DELETE = (char*)"tempexitdelete"; -constexpr char* TEMP_EXIT_TRUE = (char*)"tempexittrue"; -constexpr char* TEMP_SWIPE_EXIT = (char*)"tempswipeexit"; -constexpr int16 BACKGROUND_IMAGE_WIDTH = 190; -constexpr int16 SET_ZERO = 0; -constexpr int16 SET_ONE = 1; -constexpr int16 SET_TWO = 2; -constexpr int16 SET_THREE = 3; -constexpr int16 SET_FOUR = 4; -constexpr int16 SET_FIVE = 5; -constexpr int16 TEMP_SET_SIX = 6; -constexpr int16 SET_SEVEN = 7; -constexpr int16 SET_EIGHT = 8; -constexpr int16 SET_NINE = 9; -constexpr int16 SET_HUNDRED = 100; - -typedef enum { - JOIN_STUDY_INTER = 0, - MEASURE_INTER, - PROMPT_WEAR, - CLICK_MEA, - REMIND_WEAR, - MEASURE_ING, - MEASURE_INIT, - TEMP_WARN_INTER, - TEMP_TIP, - TEMP_EXIT_STUDY, - TEMP_STUDY -} tempInterfacesId; - -class TempMainView; -class TempPresenter : public Presenter, public UIView::OnClickListener, public UIView::OnDragListener, - public ModelListenerSample, public UISwipeView::OnSwipeListener { -public: - TempPresenter(); - ~TempPresenter() override; - void OnResume() override; - void OnStop() override; - void ClickTempJoin(); - void ClickPromptWear(); - void ClickPromptNext(); - void ClickExitMea(); - void ClickIfWear(); - void ClickMeaAgain(void); - void ClickMeasure(); - void ClickTempTip(void); - void ClickTempExit(void); - void ClickStudyTip(void); - void ClickWarnBack(void); - void ClickExitDelete(void); - void ClickExit(void); - void ClickExitTemp(void); - int8 GetTempListen(void); - ColorType CyanColor(void); - static TempPresenter *GetInstance(); - bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - bool ClickFuncId(const char *buttonName); - void OnSwipe(UISwipeView &view) override; - void ProgressNotify(void); - void SetTempCountMax(void); - void UpdateTempCount(void); - void Notify() override; -private: - uint8 wearListen{0}; - int8 tempListen{-1}; // 监测隐藏界面 - int16 countTemp{100}; // 体温进度条默认值为100 -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempPromptWear.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempPromptWear.h deleted file mode 100644 index 69ac5d2ac..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempPromptWear.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_PROMPT_WEAR_H -#define TEMP_PROMPT_WEAR_H - -#include "components/ui_image_view.h" -#include "components/ui_label.h" -#include "components/ui_label_button.h" -#include "components/ui_scroll_view.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempPromptWear : public UIScrollView { -public: - TempPromptWear(); - ~TempPromptWear() override; - bool InitPromptWear(); - static TempPromptWear *GetInstance(); -private: - bool TempInitLabel(void); - bool TempInitButton(void); - bool TempInitImage(void); - UILabel *tempLabel{nullptr}; - UILabelButton *tempButton{nullptr}; - UIImageView *tempImage{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempRemindWear.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempRemindWear.h deleted file mode 100644 index 48b5b6442..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempRemindWear.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_REMIND_WAER_H -#define TEMP_REMIND_WAER_H - -#include "components/ui_image_view.h" -#include "components/ui_label.h" -#include "components/ui_scroll_view.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempRemindWear : public UIScrollView { -public: - TempRemindWear(); - ~TempRemindWear() override; - bool InitRemindWear(); - static TempRemindWear *GetInstance(); -private: - bool TempInitImage(void); - bool TempInitLabel(void); - UIImageView *tempImage[SET_TWO]{nullptr}; - UILabel *tempLabel{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempReport.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempReport.h deleted file mode 100644 index 41ff67911..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempReport.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_REPORT_H -#define TEMP_REPORT_H - -#include "components/ui_image_view.h" -#include "components/ui_label.h" -#include "AppGroupView.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempReport : public AppGroupView { -public: - TempReport(); - ~TempReport() override; - static TempReport *GetInstance(); - bool InitView(void *caller) override; -private: - bool SetBasicLabel(void); - bool SetAppendLabel(void); - bool InitSimilarImage(int16 num, int16 tempX, int16 tempY, const char* imageSrc); - bool TempInitImage(void); - UILabel *tempLabel[TEMP_SET_SIX]{nullptr}; - UIImageView *tempImage[SET_FIVE]{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempStudyAbout.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempStudyAbout.h deleted file mode 100644 index c26d51aaf..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempStudyAbout.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_STUDY_ABOUT -#define TEMP_STUDY_ABOUT - -#include "components/ui_label.h" -#include "components/ui_scroll_view.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempStudyAbout : public UIScrollView { -public: - TempStudyAbout(); - ~TempStudyAbout() override; - bool InitStudyAbout(); - static TempStudyAbout *GetInstance(); - void RefreshStudy(void); -private: - bool SetBasicLabel(void); - bool SetAppendLabel(void); - UILabel *tempLabel[SET_FIVE]{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempWarn.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempWarn.h deleted file mode 100644 index 5d185b5c9..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/include/TempWarn.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#ifndef TEMP_WARN_H -#define TEMP_WARN_H - -#include "components/ui_image_view.h" -#include "components/ui_label.h" -#include "components/ui_label_button.h" -#include "components/ui_scroll_view.h" -#include "temperature/include/TempPresenter.h" - -namespace OHOS { -class TempWarn : public UIScrollView { -public: - TempWarn(); - ~TempWarn() override; - bool InitTempWarn(); - static TempWarn *GetInstance(); - void RefreshTempWarn(void); -private: - bool TempInitImage(void); - bool TempInitButton(void); - bool TempInitLabel(void); - UIImageView *tempImage{nullptr}; - UILabelButton *tempButton{nullptr}; - UILabel *tempLabel{nullptr}; -}; -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempClickMea.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempClickMea.cpp deleted file mode 100644 index c0c1c8682..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempClickMea.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include -#include "font/ui_font.h" -#include "temperature/include/TempClickMea.h" - -namespace OHOS { -static TempClickMea *g_tempClickMea = nullptr; - -static const int16 TEMP_LABEL_FIRST_X = 40; -static const int16 TEMP_LABEL_FIRST_Y = 100; -static const int16 TEMP_LABEL_FIRST_WIDTH = 350; -static const int16 TEMP_LABEL_FIRST_HEIGHT = 180; -static const int16 TEMP_BUTTON_X = 120; -static const int16 TEMP_BUTTON_FIRST_Y = 290; -static const int16 TEMP_BUTTON_SECOND_Y = 390; -static const int16 TEMP_BUTTON_WIDTH = 220; -static const int16 TEMP_BUTTON_HEIGHT = 80; -static const int16 TEMP_LABEL_FONT = 36; -static const char *TEMP_CLICK_MEA_LABEL = (char*)"为减少环境影响,建议在室内、无风、无冷/热源干扰条件下进行测量。"; -static const char *TEMP_BUTTON_INTER_LABEL = (char*)"立即测量"; -static const char *TEMP_BUTTON_CLOSE_LABEL = (char*)"稍后测量"; - -TempClickMea::TempClickMea() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempClickMea::TempClickMea"); - g_tempClickMea = this; -} - -TempClickMea::~TempClickMea() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempClickMea::~TempClickMea"); - RemoveAll(); - int num; - if (tempLabel != nullptr) { - delete tempLabel; - tempLabel = nullptr; - } - for (num = SET_ZERO; num < SET_TWO; num++) { - if (tempButton[num] != nullptr) { - delete tempButton[num]; - tempButton[num] = nullptr; - } - } - g_tempClickMea = nullptr; -} - -TempClickMea *TempClickMea::GetInstance(void) -{ - return g_tempClickMea; -} - -bool TempClickMea::TempInitButton(void) -{ - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - tempButton[SET_ZERO] = new UILabelButton(); - if (tempButton[SET_ZERO] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempClickMea::TempInitButton new tempButton[SET_ZERO] error"); - return false; - } - tempButton[SET_ZERO]->SetPosition(TEMP_BUTTON_X, TEMP_BUTTON_FIRST_Y, TEMP_BUTTON_WIDTH, TEMP_BUTTON_HEIGHT); - tempButton[SET_ZERO]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT); - tempButton[SET_ZERO]->SetText(TEMP_BUTTON_INTER_LABEL); - tempButton[SET_ZERO]->SetViewId(TEMP_MEA_IN); - tempButton[SET_ZERO]->SetOnClickListener(clickListener); - tempButton[SET_ZERO]->SetStyleForState(STYLE_BACKGROUND_COLOR, - TempPresenter::GetInstance()->CyanColor().full, UIButton::RELEASED); - tempButton[SET_ZERO]->SetStyleForState(STYLE_BACKGROUND_COLOR, - TempPresenter::GetInstance()->CyanColor().full, UIButton::PRESSED); - tempButton[SET_ZERO]->SetStyleForState(STYLE_BACKGROUND_COLOR, - TempPresenter::GetInstance()->CyanColor().full, UIButton::INACTIVE); - Add(tempButton[SET_ZERO]); - - tempButton[SET_ONE] = new UILabelButton(); - if (tempButton[SET_ONE] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitButton new tempButton[SET_ONE] error"); - return false; - } - tempButton[SET_ONE]->SetPosition(TEMP_BUTTON_X, TEMP_BUTTON_SECOND_Y, TEMP_BUTTON_WIDTH, TEMP_BUTTON_HEIGHT); - tempButton[SET_ONE]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT); - tempButton[SET_ONE]->SetText(TEMP_BUTTON_CLOSE_LABEL); - tempButton[SET_ONE]->SetViewId(TEMP_MEA_EXIT); - tempButton[SET_ONE]->SetOnClickListener(clickListener); - tempButton[SET_ONE]->SetTextColor(OHOS::TempPresenter::GetInstance()->CyanColor()); - tempButton[SET_ONE]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::RELEASED); - tempButton[SET_ONE]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::PRESSED); - tempButton[SET_ONE]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::INACTIVE); - Add(tempButton[SET_ONE]); - - return true; -} - -bool TempClickMea::TempInitLabel(void) -{ - tempLabel = new UILabel(); - if (tempLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempClickMea::TempInitLabel new label fail"); - return false; - } - tempLabel->SetText(TEMP_CLICK_MEA_LABEL); - tempLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT); - tempLabel->SetPosition(TEMP_LABEL_FIRST_X, TEMP_LABEL_FIRST_Y, TEMP_LABEL_FIRST_WIDTH, TEMP_LABEL_FIRST_HEIGHT); - Add(tempLabel); - return true; -} - -bool TempClickMea::InitClickMea(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempClickMea::InitClickMea"); - SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempClickMea::InitClickMea TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetScrollBlankSize(50); // 50:font size - SetOnDragListener(listener); - SetDraggable(true); - SetTouchable(true); - - if (!TempInitLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempClickMea::InitClickMea TempInitLabel() false"); - return false; - } - if (!TempInitButton()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempClickMea::InitClickMea TempInitButton() false"); - return false; - } - return true; -} - -void TempClickMea::RefreshClickMea(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempClickMea::RefreshClickMea"); - ScrollBy(0, TEMP_LABEL_FIRST_Y - tempLabel->GetY()); -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempContinueWarn.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempContinueWarn.cpp deleted file mode 100644 index 8d11e3a5b..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempContinueWarn.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include -#include "temperature/include/TempContinueWarn.h" - -namespace OHOS { -static TempContinueWarn *g_tempContinueWarn = nullptr; - -static const int16 TEMP_IMAGE_X = 182; -static const int16 TEMP_IMAGE_Y = 30; -static const int16 TEMP_LABEL_ONE_X = 190; -static const int16 TEMP_LABEL_ONE_Y = 130; -static const int16 TEMP_LABEL_ONE_WIDTH = 100; -static const int16 TEMP_LABEL_ONE_HEIGHT = 35; -static const int16 TEMP_LABEL_ONE_FONT = 35; -static const int16 TEMP_LABEL_TWO_X = 155; -static const int16 TEMP_LABEL_TWO_Y = 200; -static const int16 TEMP_LABEL_TWO_WIDTH = 200; -static const int16 TEMP_LABEL_TWO_HEIGHT = 45; -static const int16 TEMP_LABEL_TWO_FONT = 40; -static const int16 TEMP_LABEL_THREE_X = 70; -static const int16 TEMP_LABEL_THREE_Y = 265; -static const int16 TEMP_LABEL_THREE_WIDTH = 290; -static const int16 TEMP_LABEL_THREE_HEIGHT = 60; -static const char *TEMP_LABEL_ONE_TEXT = (char*)"体温"; -static const char *TEMP_HOT_WARN = (char*)"体温过高"; -static const char *TEMP_COLD_WARN = (char*)"体温过低"; -static const char *TEMP_HOT_WARN_LABEL = (char*)"最近10分钟体温高于37.2"; -static const char *TEMP_COLD_WARN_LABEL = (char*)"最近10分钟体温低于35.5"; - -TempContinueWarn::TempContinueWarn() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::TempContinueWarn"); - g_tempContinueWarn = this; -} - -TempContinueWarn::~TempContinueWarn() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::~TempContinueWarn"); - RemoveAll(); - int16 num; - if (tempImage != nullptr) { - delete tempImage; - tempImage = nullptr; - } - for (num = SET_ZERO; num < SET_THREE; num++) { - if (tempLabel[num] != nullptr) { - delete tempLabel[num]; - tempLabel[num] = nullptr; - } - } - g_tempContinueWarn = nullptr; -} - -TempContinueWarn *TempContinueWarn::GetInstance(void) -{ - return g_tempContinueWarn; -} - -bool TempContinueWarn::TempInitLabel(void) -{ - tempLabel[SET_ZERO] = new UILabel(); - if (tempLabel[SET_ZERO] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::TempInitLabel new tempLabel[SET_ZERO] fail"); - return false; - } - tempLabel[SET_ZERO]->SetPosition(TEMP_LABEL_ONE_X, TEMP_LABEL_ONE_Y, TEMP_LABEL_ONE_WIDTH, TEMP_LABEL_ONE_HEIGHT); - tempLabel[SET_ZERO]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_ONE_FONT); - tempLabel[SET_ZERO]->SetText(TEMP_LABEL_ONE_TEXT); - tempLabel[SET_ZERO]->SetTextColor(Color::Gray()); - tempLabel[SET_ZERO]->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - Add(tempLabel[SET_ZERO]); - - tempLabel[SET_ONE] = new UILabel(); - if (tempLabel[SET_ONE] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::TempInitLabel new tempLabel[SET_ONE] fail"); - return false; - } - tempLabel[SET_ONE]->SetPosition(TEMP_LABEL_TWO_X, TEMP_LABEL_TWO_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT); - tempLabel[SET_ONE]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_TWO_FONT); - Add(tempLabel[SET_ONE]); - - tempLabel[SET_TWO] = new UILabel(); - if (tempLabel[SET_TWO] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::TempInitLabel new tempLabel[2] fail"); - return false; - } - tempLabel[SET_TWO]->SetPosition(TEMP_LABEL_THREE_X, TEMP_LABEL_THREE_Y, TEMP_LABEL_THREE_WIDTH, - TEMP_LABEL_THREE_HEIGHT); - tempLabel[SET_TWO]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_ONE_FONT); - tempLabel[SET_TWO]->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - tempLabel[SET_TWO]->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - Add(tempLabel[SET_TWO]); - - return true; -} - -bool TempContinueWarn::TempInitImage(void) -{ - tempImage = new UIImageView(); - if (tempImage == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::TempInitImage new tempImage fail"); - return false; - } - tempImage->SetPosition(TEMP_IMAGE_X, TEMP_IMAGE_Y); - tempImage->SetSrc(TEMP_LITTLE_MEASURE); - Add(tempImage); - - return true; -} - -bool TempContinueWarn::InitTempContinue(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::InitTempContinue"); - SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::InitTempContinue TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetOnDragListener(listener); - SetDraggable(true); - SetTouchable(true); - - if (!TempInitImage()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::InitTempContinue TempInitImage() error"); - return false; - } - if (!TempInitLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::InitTempContinue TempInitLabel() error"); - return false; - } - return true; -} - -void TempContinueWarn::RefreshTempContinue(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::RefreshTempContinue"); - int8 tempListener = TempPresenter::GetInstance()->GetTempListen(); - if (tempListener == 0) { - tempLabel[SET_ONE]->SetText(TEMP_COLD_WARN); - tempLabel[SET_ONE]->SetTextColor(Color::Blue()); - tempLabel[SET_TWO]->SetText(TEMP_HOT_WARN_LABEL); - } else if (tempListener == 1) { - tempLabel[SET_ONE]->SetText(TEMP_HOT_WARN); - tempLabel[SET_ONE]->SetTextColor(Color::Orange()); - tempLabel[SET_TWO]->SetText(TEMP_COLD_WARN_LABEL); - } - return; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempExitInter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempExitInter.cpp deleted file mode 100644 index 8ea18ecd5..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempExitInter.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include "layout/grid_layout.h" -#include "font/ui_font.h" -#include -#include "temperature/include/TempExitInter.h" - -namespace OHOS { -static TempExitInter *g_tempExitInter = nullptr; - -static const int16 EXIT_LABEL_X = 40; -static const int16 EXIT_LABEL_Y_FIRST = 140; -static const int16 EXIT_THIS_Y_FIRST = 155; -static const int16 EXIT_LABEL_Y_SECOND = 265; -static const int16 EXIT_THIS_Y_SECOND = 275; -static const int16 EXIT_IMAGE_X = 65; -static const int16 EXIT_IMAGE_THIS_X = 325; -static const int16 EXIT_IMAGE_EXIT_Y = 145; -static const int16 EXIT_IMAGE_STUDY_Y = 270; -static const int16 EXIT_LABEL_WIDTH = 400; -static const int16 EXIT_LABEL_HEIGHT = 80; -static const int16 EXIT_LABEL_GROUP_WIDTH = 390; -static const int16 EXIT_LABEL_GROUP_HEIGHT = 110; -static const int16 EXIT_GROUP_ONE_X = 40; -static const int16 EXIT_GROUP_ONE_Y = 140; -static const int16 EXIT_GROUP_TWO_Y = 265; -static const int16 EXIT_LABEL_FONT = 35; -static const char *EXIT_LABEL_TEXT_FIRST = (char*)"退出研究"; -static const char *EXIT_LABEL_TEXT_SECOND = (char*)"关于研究"; - -TempExitInter::TempExitInter() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempExitInter::TempExitInter"); - g_tempExitInter = this; -} - -TempExitInter::~TempExitInter() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempExitInter::~TempExitInter"); - RemoveAll(); - for (int32_t labelNum = SET_ZERO; labelNum < SET_TWO; labelNum++) { - if (tempLabel[labelNum] != nullptr) { - delete tempLabel[labelNum]; - tempLabel[labelNum] = nullptr; - } - } - for (int32_t ImageNum = SET_ZERO; ImageNum < SET_FOUR; ImageNum++) { - if (tempImage[ImageNum] != nullptr) { - delete tempImage[ImageNum]; - tempImage[ImageNum] = nullptr; - } - } - g_tempExitInter = nullptr; -} - -TempExitInter *TempExitInter::GetInstance(void) -{ - return g_tempExitInter; -} - -bool TempExitInter::TempInitLabel(void) -{ - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - tempLabel[SET_ZERO] = new UILabel(); - if (tempLabel[SET_ZERO] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::InitExit new tempLabel[SET_ZERO] fail"); - return false; - } - tempLabel[SET_ZERO]->SetPosition(EXIT_LABEL_X, EXIT_LABEL_Y_FIRST, EXIT_LABEL_WIDTH, EXIT_LABEL_HEIGHT); - tempLabel[SET_ZERO]->SetText(EXIT_LABEL_TEXT_FIRST); - tempLabel[SET_ZERO]->SetViewId(TEMP_EXIT_THIS); - tempLabel[SET_ZERO]->SetTouchable(true); - tempLabel[SET_ZERO]->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - tempLabel[SET_ZERO]->SetOnClickListener(clickListener); - tempLabel[SET_ZERO]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, EXIT_LABEL_FONT); - Add(tempLabel[SET_ZERO]); - - tempLabel[SET_ONE] = new UILabel(); - if (tempLabel[SET_ONE] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::InitExit new tempLabel[SET_ONE] fail"); - return false; - } - tempLabel[SET_ONE]->SetPosition(EXIT_LABEL_X, EXIT_LABEL_Y_SECOND, EXIT_LABEL_WIDTH, EXIT_LABEL_HEIGHT); - tempLabel[SET_ONE]->SetText(EXIT_LABEL_TEXT_SECOND); - tempLabel[SET_ONE]->SetViewId(TEMP_STUDY_THIS); - tempLabel[SET_ONE]->SetTouchable(true); - tempLabel[SET_ONE]->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - tempLabel[SET_ONE]->SetOnClickListener(clickListener); - tempLabel[SET_ONE]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, EXIT_LABEL_FONT); - Add(tempLabel[SET_ONE]); - - return true; -} - -bool TempExitInter::InitSimilarImage(int16 num, int16 tempX, int16 tempY, const char* imageSrc) -{ - tempImage[num] = new UIImageView(); - if (tempImage[num] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::InitSimilarImage new tempImage[%d] fail", num); - return false; - } - tempImage[num]->SetPosition(tempX, tempY); - tempImage[num]->SetSrc(imageSrc); - Add(tempImage[num]); - - return true; -} - -bool TempExitInter::TempInitImage(void) -{ - if (!InitSimilarImage(SET_ZERO, EXIT_IMAGE_X, EXIT_IMAGE_EXIT_Y, TEMP_EXIT)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::TempInitImage new tempImage[SET_ZERO] fail"); - return false; - } - if (!InitSimilarImage(SET_ONE, EXIT_IMAGE_X, EXIT_IMAGE_STUDY_Y, TEMP_ABOUT_STUDY)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::TempInitImage new tempImage[SET_ONE] fail"); - return false; - } - if (!InitSimilarImage(SET_TWO, EXIT_IMAGE_THIS_X, EXIT_THIS_Y_FIRST, PNG_SETTTING_BUTTON_IMAGE)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::TempInitImage new tempImage[SET_TWO] fail"); - return false; - } - if (!InitSimilarImage(SET_THREE, EXIT_IMAGE_THIS_X, EXIT_THIS_Y_SECOND, PNG_SETTTING_BUTTON_IMAGE)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::TempInitImage new tempImage[SET_THREE] fail"); - return false; - } - - return true; -} - -bool TempExitInter::InitView(void *caller) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempExitInter::InitExit"); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::InitView TempPresenter::GetInstance() nullptr"); - return false; - } - UNUSED(caller); - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - - SetOnDragListener(listener); - SetViewId(TEMP_SWIPE_EXIT); - SetDraggable(true); - SetTouchable(true); - - if (!TempInitLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::InitView TempInitLabel() false"); - return false; - } - if (!TempInitImage()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::InitView TempInitImage() false"); - return false; - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempExitPrompt.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempExitPrompt.cpp deleted file mode 100644 index 600b97f40..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempExitPrompt.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include "layout/grid_layout.h" -#include -#include "temperature/include/TempExitPrompt.h" - -namespace OHOS { -static TempExitPrompt *g_tempExitPrompt = nullptr; - -static const int16 EXIT_PROMPT_LABEL_X = 40; -static const int16 EXIT_PROMPT_LABEL_Y = 90; -static const int16 EXIT_PROMPT_LABEL_WEIGHT = 380; -static const int16 EXIT_PROMPT_LABEL_HEIGHT = 320; -static const int16 EXIT_PROMPT_DELETE_X = 80; -static const int16 EXIT_PROMPT_TRUE_X = 290; -static const int16 EXIT_PROMPT_IMAGE_Y = 325; -static const int16 EXIT_PROMPT_LABEL_FONT = 35; -static const char *EXIT_PROMPT_LABEL = (char*)"退出研究后,您的历史相关数据将被清除,且无法继续使用该应用。若需体验,需重新加入体温研究。是否退出?"; - -TempExitPrompt::TempExitPrompt() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempExitPrompt::TempExitPrompt"); - g_tempExitPrompt = this; -} - -TempExitPrompt::~TempExitPrompt() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempExitPrompt::~TempExitPrompt"); - RemoveAll(); - int num; - if (tempLabel != nullptr) { - delete tempLabel; - tempLabel = nullptr; - } - for (num = SET_ZERO; num < SET_TWO; num++) { - if (tempImage[num] != nullptr) { - delete tempImage[num]; - tempImage[num] = nullptr; - } - } - g_tempExitPrompt = nullptr; -} - -TempExitPrompt *TempExitPrompt::GetInstance(void) -{ - return g_tempExitPrompt; -} - -bool TempExitPrompt::TempInitImage(void) -{ - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - tempImage[SET_ZERO] = new UIImageView(); - if (tempImage[SET_ZERO] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::TempInitImage new tempImage[SET_ZERO] fail"); - return false; - } - tempImage[SET_ZERO]->SetPosition(EXIT_PROMPT_DELETE_X, EXIT_PROMPT_IMAGE_Y); - tempImage[SET_ZERO]->SetSrc(TEMP_DELETE); - tempImage[SET_ZERO]->SetOnClickListener(clickListener); - tempImage[SET_ZERO]->SetViewId(TEMP_EXIT_DELETE); - tempImage[SET_ZERO]->SetTouchable(true); - Add(tempImage[SET_ZERO]); - - tempImage[SET_ONE] = new UIImageView(); - if (tempImage[SET_ONE] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::TempInitImage new tempImage[SET_ONE] fail"); - return false; - } - tempImage[SET_ONE]->SetPosition(EXIT_PROMPT_TRUE_X, EXIT_PROMPT_IMAGE_Y); - tempImage[SET_ONE]->SetSrc(TEMP_TRUE); - tempImage[SET_ONE]->SetOnClickListener(clickListener); - tempImage[SET_ONE]->SetViewId(TEMP_EXIT_TRUE); - tempImage[SET_ONE]->SetTouchable(true); - Add(tempImage[SET_ONE]); - - return true; -} - -bool TempExitPrompt::TempInitLabel(void) -{ - tempLabel = new UILabel(); - if (tempLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitPrompt::TempInitLabel new tempLabel fail"); - return false; - } - tempLabel->SetPosition(EXIT_PROMPT_LABEL_X, EXIT_PROMPT_LABEL_Y, - EXIT_PROMPT_LABEL_WEIGHT, EXIT_PROMPT_LABEL_HEIGHT); - tempLabel->SetText(EXIT_PROMPT_LABEL); - tempLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, EXIT_PROMPT_LABEL_FONT); - tempLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - Add(tempLabel); - - return true; -} - -bool TempExitPrompt::InitExitPrompt(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempExitPrompt::InitExitPrompt"); - SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - SetThrowDrag(true); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitPrompt::InitExitPrompt TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetOnDragListener(listener); - SetDraggable(true); - SetTouchable(true); - - if (!TempInitLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitPrompt::InitExitPrompt TempInitLabel() false"); - return false; - } - if (!TempInitImage()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitPrompt::InitExitPrompt TempInitImage() false"); - return false; - } - - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempInitInter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempInitInter.cpp deleted file mode 100644 index 19a076c2a..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempInitInter.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include -#include "temperature/include/TempInitInter.h" - -namespace OHOS { -static TempInitInter *g_tempInitInter = nullptr; - -static const int16 TEMP_INIT_DROP_X = 200; -static const int16 TEMP_INIT_DROP_Y = 405; -static const int16 TEMP_INIT_DROP_WIDTH = 45; -static const int16 TEMP_INIT_BUTTON_X = 110; -static const int16 TEMP_INIT_BUTTON_Y = 330; -static const int16 TEMP_INIT_BUTTON_WIDTH = 220; -static const int16 TEMP_INIT_BUTTON_HEIGHT = 80; -static const int16 TEMP_INIT_BUTTON_FONT = 35; -static const int16 LABEL_ONE_X = 90; -static const int16 LABEL_TWO_X = 265; -static const int16 TEMP_INIT_LABEL_THREE_X = 105; -static const int16 TEMP_INIT_LABEL_THREE_Y = 80; -static const int16 TEMP_INIT_IMAGE_TIP_X = 255; -static const int16 TEMP_INIT_IMAGE_TIP_Y = 85; -static const int16 TEMP_INIT_IMAGE_TIP_WIDTH = 35; -static const int16 TEMP_INIT_IMAGE_TIP_HEIGHT = 35; -static const int16 LABEL_THREE_WIDTH = 300; -static const int16 TEMP_INIT_LABEL_FOUR_X = 180; -static const int16 TEMP_INIT_LABEL_FOUR_Y = 120; -static const int16 TEMP_INIT_LABEL_TIME_X = 200; -static const int16 TEMP_INIT_LABEL_TIME_Y = 120; -static const int16 LABEL_FIVE_X = 80; -static const int16 TEMP_INIT_LABEL_FIVE_Y = 275; -static const int16 LABEL_FIVE_WIDTH = 320; -static const int16 LABEL_FIVE_HEIGHT = 50; -static const int16 TEMP_INIT_LABEL_TEMP_Y = 160; -static const int16 TITLE_WIDTH = 90; -static const int16 TITLE_HEIGHT = 50; -static const int16 TEMP_INIT_LABEL_WIDTH = 120; -static const int16 TEMP_INIT_LABEL_HEIGHT = 60; -static const int16 TEMP_INIT_LABEL_SKIN_Y = 220; -static const int16 TEMP_INIT_LABEL_SKIN_HEIGHT = 25; -static const int16 TEMP_INIT_TEMP_FONT = 55; -static const int16 TEMP_INIT_TEMP_SKIN_FONT = 20; -static const int16 TEMP_INIT_TEMP_TITLE_FONT = 35; -static const int16 TEMP_LABEL_MAX = 6; -static const char *TEMP_INIT_BUTTON = (char *)"再次测量"; -static const char *TEMP_INIT_TEMP_LABEL = (char *)"36.5"; -static const char *TEMP_INIT_SKIN_TEMP_LABEL = (char *)"34.5"; -static const char *TEMP_INIT_SKIN_SMALL_LABEL = (char *)"体温(℃) 皮肤温度(℃)"; -static const char *TEMP_INIT_TITLE = (char *)"体温"; -static const char *TEMP_INIT_TITLE_TIME = (char *)"刚刚"; -static const char *TEMP_INIT_LABEL_TIP = (char *)"佩戴不足10分钟,可能影响到温度精确性,数据仅供参考"; - -TempInitInter::TempInitInter() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempInitInter::TempInitInter"); - g_tempInitInter = this; -} - -TempInitInter::~TempInitInter() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempInitInter::~TempInitInter"); - RemoveAll(); - for (int8_t stNum = SET_ZERO; stNum < SET_THREE; stNum++) { - if (tempImage[stNum] != nullptr) { - delete tempImage[stNum]; - tempImage[stNum] = nullptr; - } - } - for (int8_t ndNum = SET_ZERO; ndNum < TEMP_LABEL_MAX; ndNum++) { - if (tempLabel[ndNum] != nullptr) { - delete tempLabel[ndNum]; - tempLabel[ndNum] = nullptr; - } - } - if (buttonTemp != nullptr) { - delete buttonTemp; - buttonTemp = nullptr; - } - g_tempInitInter = nullptr; -} - -TempInitInter *TempInitInter::GetInstance(void) -{ - return g_tempInitInter; -} - -bool TempInitInter::TempInitImage(void) -{ - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - tempImage[SET_ZERO] = new UIImageView(); - if (tempImage[SET_ZERO] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::TempInitImage new tempImage[SET_ZERO] fail"); - return false; - } - tempImage[SET_ZERO]->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - tempImage[SET_ZERO]->SetSrc(TEMP_BACKGROUND); - Add(tempImage[SET_ZERO]); - - tempImage[SET_ONE] = new UIImageView(); - if (tempImage[SET_ONE] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitMeasure new image[SET_ONE] fail"); - return false; - } - tempImage[SET_ONE]->SetPosition(TEMP_INIT_DROP_X, TEMP_INIT_DROP_Y, TEMP_INIT_DROP_WIDTH, TEMP_INIT_DROP_WIDTH); - tempImage[SET_ONE]->SetSrc(TEMP_UP_DROP); - Add(tempImage[SET_ONE]); - - tempImage[SET_TWO] = new UIImageView(); - if (tempImage[SET_TWO] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitMeasure new image[SET_TWO] fail"); - return false; - } - tempImage[SET_TWO]->SetPosition(TEMP_INIT_IMAGE_TIP_X, - TEMP_INIT_IMAGE_TIP_Y, TEMP_INIT_IMAGE_TIP_WIDTH, TEMP_INIT_IMAGE_TIP_HEIGHT); - tempImage[SET_TWO]->SetTouchable(true); - tempImage[SET_TWO]->SetViewId(TEMP_IMAGE_LIT_TIP); - tempImage[SET_TWO]->SetSrc(TEMP_LIT_TIP); - tempImage[SET_TWO]->SetOnClickListener(clickListener); - tempImage[SET_TWO]->SetTouchable(true); - Add(tempImage[SET_TWO]); - - return true; -} - -typedef struct { - int16 labelNum; - int16 x; - int16 y; - int16 width; - int16 height; - char* name; - int16 font; - const char* text; -} TempInitItem; - -static const TempInitItem tempInitItem[] = { - { SET_ZERO, LABEL_ONE_X, TEMP_INIT_LABEL_TEMP_Y, TEMP_INIT_LABEL_WIDTH, TEMP_INIT_LABEL_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_FONT, TEMP_INIT_TEMP_LABEL }, - { SET_ONE, LABEL_TWO_X, TEMP_INIT_LABEL_TEMP_Y, TEMP_INIT_LABEL_WIDTH, TEMP_INIT_LABEL_WIDTH, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_FONT, TEMP_INIT_SKIN_TEMP_LABEL }, - { SET_TWO, TEMP_INIT_LABEL_THREE_X, TEMP_INIT_LABEL_SKIN_Y, LABEL_THREE_WIDTH, TITLE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_SKIN_FONT, TEMP_INIT_SKIN_SMALL_LABEL }, - { SET_THREE, TEMP_INIT_LABEL_FOUR_X, TEMP_INIT_LABEL_THREE_Y, TITLE_WIDTH, TITLE_WIDTH, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_TITLE_FONT, TEMP_INIT_TITLE }, - { SET_FOUR, TEMP_INIT_LABEL_TIME_X, TEMP_INIT_LABEL_TIME_Y, TITLE_WIDTH, TITLE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_SKIN_FONT, TEMP_INIT_TITLE_TIME }, - { SET_FIVE, LABEL_FIVE_X, TEMP_INIT_LABEL_FIVE_Y, LABEL_FIVE_WIDTH, LABEL_FIVE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_SKIN_FONT, TEMP_INIT_LABEL_TIP }, -}; - -bool TempInitInter::SetBasicLabel(void) -{ - for (int num = 0; num <= SET_FIVE; num++) { - tempLabel[tempInitItem[num].labelNum] = new UILabel(); - if (tempLabel[tempInitItem[num].labelNum] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::SetBasicLabel new tempLabel[%d] fail", - tempInitItem[num].labelNum); - return false; - } - tempLabel[tempInitItem[num].labelNum]->SetPosition(tempInitItem[num].x, tempInitItem[num].y, - tempInitItem[num].width, tempInitItem[num].height); - tempLabel[tempInitItem[num].labelNum]->SetFont(tempInitItem[num].name, tempInitItem[num].font); - tempLabel[tempInitItem[num].labelNum]->SetText(tempInitItem[num].text); - Add(tempLabel[tempInitItem[num].labelNum]); - } - return true; -} - -bool TempInitInter::SetAppendLabel(void) -{ - tempLabel[SET_ZERO]->SetTextColor(TempPresenter::GetInstance()->CyanColor()); - tempLabel[SET_TWO]->SetTextColor(Color::Gray()); - tempLabel[SET_FOUR]->SetTextColor(Color::Gray()); - tempLabel[SET_FIVE]->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - tempLabel[SET_FIVE]->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - - return true; -} - -bool TempInitInter::TempInitButton(void) -{ - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - buttonTemp = new UILabelButton(); - if (buttonTemp == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::TempInitButton new label fail"); - return false; - } - buttonTemp->SetPosition(TEMP_INIT_BUTTON_X, TEMP_INIT_BUTTON_Y, TEMP_INIT_BUTTON_WIDTH, TEMP_INIT_BUTTON_HEIGHT); - buttonTemp->SetText(TEMP_INIT_BUTTON); - buttonTemp->SetViewId(TEMP_MEA_AGAIN); - buttonTemp->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_BUTTON_FONT); - buttonTemp->SetTextColor(OHOS::TempPresenter::GetInstance()->CyanColor()); - buttonTemp->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::RELEASED); - buttonTemp->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::PRESSED); - buttonTemp->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::INACTIVE); - buttonTemp->SetOnClickListener(clickListener); - Add(buttonTemp); - return true; -} - -bool TempInitInter::InitView(void *caller) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempInitInter::InitView"); - UNUSED(caller); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::InitView TempPresenter::GetInstance() nullptr"); - return false; - } - - if (!TempInitImage()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::InitView TempInitImage() false"); - return false; - } - if (!SetBasicLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::InitView TempInitLabel() false"); - return false; - } - if (!SetAppendLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::InitView TempLowLabel() false"); - return false; - } - if (!TempInitButton()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::InitView TempInitButton() false"); - return false; - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempJoinStudy.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempJoinStudy.cpp deleted file mode 100644 index 9dce7455d..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempJoinStudy.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include "layout/grid_layout.h" -#include -#include "temperature/include/TempJoinStudy.h" - -namespace OHOS { -static TempJoinStudy *g_tempJoinStudy = nullptr; -static const int16 TEMP_TITLE_X = 150; -static const int16 TEMP_TITLE_Y = 50; -static const int16 TEMP_TITLE_WIDTH = 150; -static const int16 TEMP_TITLE_HEIGHT = 45; -static const int16 TEMP_TITLE_FONT = 36; -static const int16 TEMP_FIRST_LABEL_FONT = 35; -static const int16 TEMP_LABEL_FIRST_X = 45; -static const int16 TEMP_LABEL_FIRST_Y = 120; -static const int16 TEMP_LABEL_SECOND_Y = 350; -static const int16 TEMP_LABEL_THIRD_Y = 650; -static const int16 TEMP_LABEL_FIRST_WIDTH = 350; -static const int16 TEMP_LABEL_FIRST_HEIGHT = 400; -static const int16 TEMP_BUTTON_X = 120; -static const int16 TEMP_BUTTON_FIRST_Y = 940; -static const int16 TEMP_BUTTON_SECOND_Y = 1040; -static const int16 TEMP_BUTTON_WEDITH = 220; -static const int16 TEMP_BUTTON_HEIGHT = 80; -static const int16 TEMP_LABEL_MAX = 3; -static const int16 TEMP_BUTTON_MAX = 2; -static const char *TEMP_TITLE_TEXT = (char*)"体温研究"; -static const char *TEMP_LABEL_ONE = (char*)"本功能通过内置温度传感器测量腕部皮肤温度,主要研究腕部皮肤温度和体温的关系。"; -static const char *TEMP_LABEL_TWO = (char*)"本功能用于18岁以上健康人群测量运动过程,及之后腕部皮肤温度和体温的变化,请加入研究,以便及时观察运动前后身体的变化。"; -static const char *TEMP_LABEL_THREE = (char*)"测量需佩戴10分钟以上,且容易受到环境因素影响。目前达不到水银体温计的精度,测量结果仅供参考,不作为医疗诊断依据。"; -static const char *TEMP_BUTTON_ONE = (char*)"加入研究"; -static const char *TEMP_BUTTON_TWO = (char*)"退出"; - -TempJoinStudy::TempJoinStudy() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempJoinStudy"); - g_tempJoinStudy = this; -} - -TempJoinStudy::~TempJoinStudy() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::~TempJoinStudy"); - RemoveAll(); - if (tempTitle != nullptr) { - delete tempTitle; - tempTitle = nullptr; - } - for (int32_t numLabel = SET_ZERO; numLabel < TEMP_LABEL_MAX; numLabel++) { - if (tempLabel[numLabel] != nullptr) { - delete tempLabel[numLabel]; - tempLabel[numLabel] = nullptr; - } - } - for (int32_t numButton = SET_ZERO; numButton < TEMP_BUTTON_MAX; numButton++) { - if (tempButton[numButton] != nullptr) { - delete tempButton[numButton]; - tempButton[numButton] = nullptr; - } - } - g_tempJoinStudy = nullptr; -} - -TempJoinStudy *TempJoinStudy::GetInstance(void) -{ - return g_tempJoinStudy; -} - -bool TempJoinStudy::InitSimilarLabel(int16 num, int16 labelY, const char *labelText) -{ - tempLabel[num] = new UILabel(); - if (tempLabel[num] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitLabel new tempLabel[%d] error", num); - return false; - } - tempLabel[num]->SetPosition(TEMP_LABEL_FIRST_X, labelY, TEMP_LABEL_FIRST_WIDTH, TEMP_LABEL_FIRST_HEIGHT); - tempLabel[num]->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - tempLabel[num]->SetText(labelText); - tempLabel[num]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_FIRST_LABEL_FONT); - Add(tempLabel[num]); - - return true; -} - -bool TempJoinStudy::TempInitLabel(void) -{ - tempTitle = new UILabel(); - if (tempTitle == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitLabel new tempTitle error"); - return false; - } - tempTitle->SetPosition(TEMP_TITLE_X, TEMP_TITLE_Y, TEMP_TITLE_WIDTH, TEMP_TITLE_HEIGHT); - tempTitle->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_TITLE_FONT); - tempTitle->SetText(TEMP_TITLE_TEXT); - Add(tempTitle); - - if (!InitSimilarLabel(SET_ZERO, TEMP_LABEL_FIRST_Y, TEMP_LABEL_ONE)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitLabel new tempLabel[SET_ZERO] error"); - return false; - } - if (!InitSimilarLabel(SET_ONE, TEMP_LABEL_SECOND_Y, TEMP_LABEL_TWO)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitLabel new tempLabel[SET_ONE] error"); - return false; - } - if (!InitSimilarLabel(SET_TWO, TEMP_LABEL_THIRD_Y, TEMP_LABEL_THREE)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitLabel new tempLabel[SET_ONE] error"); - return false; - } - - return true; -} - -bool TempJoinStudy::TempInitButton(void) -{ - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - tempButton[SET_ZERO] = new UILabelButton(); - if (tempButton[SET_ZERO] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitButton new tempButton[SET_ZERO] error"); - return false; - } - tempButton[SET_ZERO]->SetPosition(TEMP_BUTTON_X, TEMP_BUTTON_FIRST_Y, TEMP_BUTTON_WEDITH, TEMP_BUTTON_HEIGHT); - tempButton[SET_ZERO]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_TITLE_FONT); - tempButton[SET_ZERO]->SetText(TEMP_BUTTON_ONE); - tempButton[SET_ZERO]->SetViewId(TEMP_INTER_JOIN); - tempButton[SET_ZERO]->SetOnClickListener(clickListener); - tempButton[SET_ZERO]->SetStyleForState(STYLE_BACKGROUND_COLOR, - OHOS::TempPresenter::GetInstance()->CyanColor().full, UIButton::RELEASED); - tempButton[SET_ZERO]->SetStyleForState(STYLE_BACKGROUND_COLOR, - OHOS::TempPresenter::GetInstance()->CyanColor().full, UIButton::PRESSED); - tempButton[SET_ZERO]->SetStyleForState(STYLE_BACKGROUND_COLOR, - OHOS::TempPresenter::GetInstance()->CyanColor().full, UIButton::INACTIVE); - Add(tempButton[SET_ZERO]); - - tempButton[SET_ONE] = new UILabelButton(); - if (tempButton[SET_ONE] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitButton new tempButton[SET_ONE] error"); - return false; - } - tempButton[SET_ONE]->SetPosition(TEMP_BUTTON_X, TEMP_BUTTON_SECOND_Y, TEMP_BUTTON_WEDITH, TEMP_BUTTON_HEIGHT); - tempButton[SET_ONE]->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_TITLE_FONT); - tempButton[SET_ONE]->SetText(TEMP_BUTTON_TWO); - tempButton[SET_ONE]->SetViewId(TEMP_INTER_EXIT); - tempButton[SET_ONE]->SetOnClickListener(clickListener); - tempButton[SET_ONE]->SetTextColor(OHOS::TempPresenter::GetInstance()->CyanColor()); - tempButton[SET_ONE]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::RELEASED); - tempButton[SET_ONE]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::PRESSED); - tempButton[SET_ONE]->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::INACTIVE); - Add(tempButton[SET_ONE]); - - return true; -} - -bool TempJoinStudy::InitJoinStudy(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::InitJoinStudy"); - SetViewId(TEMP_JOIN_STUDY); - SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - SetThrowDrag(true); - SetScrollBlankSize(50); // 50:font size - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::InitJoinStudy TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetOnDragListener(listener); - SetDraggable(true); - SetTouchable(true); - - if (!TempInitLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::InitJoinStudy TempInitLabel() false"); - return false; - } - if (!TempInitButton()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::InitJoinStudy TempInitButton() false"); - return false; - } - - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempLittleTip.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempLittleTip.cpp deleted file mode 100644 index b4e737874..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempLittleTip.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include -#include "temperature/include/TempLittleTip.h" - -namespace OHOS { -static TempLittleTip *g_tempJoinStudy = nullptr; - -static const int16 TEMP_TIP_LABEL_ONE_X = 180; -static const int16 TEMP_TIP_LABEL_ONE_Y = 45; -static const int16 TEMP_TIP_LABEL_TITLE_WIDTH = 230; -static const int16 TEMP_TIP_LABEL_TITLE_HEIGHT = 70; -static const int16 TEMP_TIP_LABEL_X = 45; -static const int16 TEMP_TIP_LABEL_TWO_Y = 130; -static const int16 TEMP_TIP_LABEL_THREE_Y = 610; -static const int16 TEMP_TIP_LABEL_FOUR_Y = 670; -static const int16 TEMP_TIP_LABEL_FIVE_Y = 1070; -static const int16 TEMP_TIP_LABEL_SIX_Y = 1120; -static const int16 TEMP_TIP_LABEL_SIX_HEIGHT = 300; -static const int16 TEMP_TIP_LABEL_SEVEN_Y = 1340; -static const int16 TEMP_TIP_LABEL_SEVEN_HEIGHT = 480; -static const int16 TEMP_TIP_LABEL_EIGHT_Y = 2030; -static const int16 TEMP_TIP_LABEL_NIGHT_Y = 2330; -static const int16 TEMP_TIP_LABEL_TITLE_X = 160; -static const int16 TEMP_LABEL_WIDTH = 350; -static const int16 TEMP_LABEL_HEIGHT = 420; -static const int16 TEMP_TIP_TITLE_FONT = 38; -static const int16 TEMP_TIP_TEXT_FONT = 34; -static const int16 TEMP_LABEL_MAX = 9; -static const int16 SET_SIX = 6; -static const char *TEMP_TIP_LABEL_ONE = (char *)"体温"; -static const char *TEMP_TIP_LABEL_TWO = (char *)"人体内部的温度称体温。保持恒定的体温,是保持新陈代谢和生命活动的正常进行的必要条件。正常的体温不是一个温度点,\ -而是一个体温的范围,大概在36℃-37℃之间(腋窝)通常人体低于35℃为低体温,高于37.2℃为发热。"; -static const char *TEMP_TIP_LABEL_THREE = (char *)"皮肤温度"; -static const char *TEMP_TIP_LABEL_FOUR = (char *)"皮肤温度是指皮肤表面的温度。人体各部位的皮肤温度不同,且受环境、生理因素等影响显著。室内环境下,\ -人体腕部皮肤温度大概在32-34℃,维持舒适的皮肤温度是保证人体热舒适的重要条件"; -static const char *TEMP_TIP_LABEL_FIVE = (char *)"测量须知"; -static const char *TEMP_TIP_LABEL_SIX = (char *)"● 本设备支持的测量范围为:体温:34-42℃皮肤温度:20-42℃"; -static const char *TEMP_TIP_LABEL_SEVEN = (char *)"● 受周围环境影响,测量精度可能会下降。注意以下事项,有助于减少误差:·确保偏紧佩戴10分钟以上,\ -在室温(25℃左右)安静状态下测量;·确保手腕处没有水、酒精等液体;·运动、洗澡、室内室外环境切换时,请等待30分钟后在测量;·请避免在阳光直射,有风,又冷/热源的环境下进行测量。"; -static const char *TEMP_TIP_LABEL_EIGHT = (char *)"● 穿戴设备在未佩戴、环境温度过低(< 35℃)、过高(> 37.2℃)等条件下会进行出值限制。"; -static const char *TEMP_TIP_LABEL_NINE = (char *)"● 测量结果仅供参考,不作为医疗诊断依据"; - -TempLittleTip::TempLittleTip() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempLittleTip::TempLittleTip"); - g_tempJoinStudy = this; -} - -TempLittleTip::~TempLittleTip() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempLittleTip::~TempLittleTip"); - RemoveAll(); - int8 num; - for (num = 0; num < TEMP_LABEL_MAX; num++) { - if (tempLabel[num] != nullptr) { - delete tempLabel[num]; - tempLabel[num] = nullptr; - } - } - g_tempJoinStudy = nullptr; -} - -TempLittleTip *TempLittleTip::GetInstance(void) -{ - return g_tempJoinStudy; -} - -typedef struct { - int16 labelNum; - int16 x; - int16 y; - int16 width; - int16 height; - char* name; - int16 font; - const char* text; -} TempTipItem; - -static const TempTipItem tempTipItem[] = { - { SET_ZERO, TEMP_TIP_LABEL_ONE_X, TEMP_TIP_LABEL_ONE_Y, TEMP_TIP_LABEL_TITLE_WIDTH, TEMP_TIP_LABEL_TITLE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TITLE_FONT, TEMP_TIP_LABEL_ONE }, - { SET_ONE, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_TWO_Y, TEMP_LABEL_WIDTH, TEMP_LABEL_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_TWO }, - { SET_TWO, TEMP_TIP_LABEL_TITLE_X, TEMP_TIP_LABEL_THREE_Y, TEMP_TIP_LABEL_TITLE_WIDTH, - TEMP_TIP_LABEL_TITLE_HEIGHT, (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TITLE_FONT, TEMP_TIP_LABEL_THREE }, - { SET_THREE, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_FOUR_Y, TEMP_LABEL_WIDTH, TEMP_LABEL_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_FOUR }, - { SET_FOUR, TEMP_TIP_LABEL_TITLE_X, TEMP_TIP_LABEL_FIVE_Y, TEMP_TIP_LABEL_TITLE_WIDTH, - TEMP_TIP_LABEL_TITLE_HEIGHT, (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TITLE_FONT, TEMP_TIP_LABEL_FIVE }, - { SET_FIVE, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_SIX_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SIX_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_SIX }, - { SET_SIX, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_SEVEN_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SEVEN_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_SEVEN }, - { SET_SEVEN, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_EIGHT_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SIX_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_EIGHT }, - { SET_EIGHT, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_NIGHT_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SIX_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_NINE }, -}; - -bool TempLittleTip::SetBasicLabel(void) -{ - for (int num = 0; num <= SET_EIGHT; num++) { - tempLabel[tempTipItem[num].labelNum] = new UILabel(); - if (tempLabel[tempTipItem[num].labelNum] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempLittleTip::SetBasicLabel new tempLabel[%d] fail", - tempTipItem[num].labelNum); - return false; - } - tempLabel[tempTipItem[num].labelNum]->SetPosition(tempTipItem[num].x, tempTipItem[num].y, - tempTipItem[num].width, tempTipItem[num].height); - tempLabel[tempTipItem[num].labelNum]->SetFont(tempTipItem[num].name, tempTipItem[num].font); - tempLabel[tempTipItem[num].labelNum]->SetText(tempTipItem[num].text); - Add(tempLabel[tempTipItem[num].labelNum]); - } - return true; -} - -bool TempLittleTip::SetAppendLabel(void) -{ - for (int num = 0; num <= SET_EIGHT; num++) { - if (tempLabel[tempTipItem[num].labelNum] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempLittleTip::SetAppendLabel tempTipItem[%d] nullptr", - tempTipItem[num].labelNum); - return false; - } - if (num == SET_ZERO || num == SET_TWO || num == SET_FOUR) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempLittleTip::SetAppendLabel continue"); - continue; - } - tempLabel[tempTipItem[num].labelNum]->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - } - return true; -} - -bool TempLittleTip::InitLittleTip(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempLittleTip::InitLittleTip"); - SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - SetThrowDrag(true); - SetScrollBlankSize(50); // 50:font size - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempLittleTip::InitLittleTip TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetOnDragListener(listener); - SetDraggable(true); - SetTouchable(true); - - if (!SetBasicLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempLittleTip::InitLittleTip SetLabel() false"); - return false; - } - if (!SetAppendLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempLittleTip::InitLittleTip SetAppendLabel() false"); - return false; - } - return true; -} - -void TempLittleTip::RefreshTip(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempLittleTip::RefreshTip"); - ScrollBy(0, TEMP_TIP_LABEL_ONE_Y - tempLabel[0]->GetY()); -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMainView.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMainView.cpp deleted file mode 100644 index 61cd2b6b0..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMainView.cpp +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "temperature/include/TempMainView.h" -#include "UiConfig.h" -#include "temperature/include/TempMeaProcess.h" -#include "temperature/include/TempWarn.h" -#include "temperature/include/TempExitPrompt.h" - - -namespace OHOS { -static TempMainView *g_tempMainView = nullptr; - -static const int16 FIRST_TIME_JOIN = 0; -static const int16 SECOND_TIME_JOIN = 1; -static const int16 LABEL_FIRST_X = 200; -static const int16 LABEL_FIRST_Y = 60; -static const int16 LABEL_FIRST_WIDTH = 150; -static const int16 LABEL_FIRST_HEIGHT = 45; -static const int16 LABEL_FIRST_FONT = 35; -static const int16 INTERFACES_MAX = 10; - -TempMainView::TempMainView() -{ - g_tempMainView = this; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::TempMainView"); -} - -TempMainView::~TempMainView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::~TempMainView"); - for (int16_t numGroup = SET_ZERO; numGroup <= INTERFACES_MAX; numGroup++) { - if (container[numGroup] != nullptr) { - container[numGroup] = nullptr; - } - } - for (int16_t numSwipe = SET_ZERO; numSwipe < SET_TWO; numSwipe++) { - if (tempSwipeList[numSwipe] != nullptr) { - tempSwipeList[numSwipe]->RemoveAll(); - delete tempSwipeList[numSwipe]; - tempSwipeList[numSwipe] = nullptr; - } - } - DeleteViceInter(); - group = nullptr; - g_tempMainView = nullptr; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::~TempMainView"); -} - -TempMainView *TempMainView::GetInstance(void) -{ - return g_tempMainView; -} - -void TempMainView::OnStart() -{ - - int16 tempInterListen = TempModel::GetInstance()->GetTempInterLis(); - if (tempInterListen == FIRST_TIME_JOIN) { - tempJoinStudy = new TempJoinStudy(); - if (tempJoinStudy == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: OnStart tempJoinStudy null error!"); - return; - } - container[0] = tempJoinStudy; - tempJoinStudy->InitJoinStudy(); - tempWhichInter = JOIN_STUDY_INTER; - group = container[0]; - } else if (tempInterListen == SECOND_TIME_JOIN) { - AppGroupView *view[SET_TWO] = {nullptr}; - if (!SetSwipeInter(0)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::OnStart SetSwipeInter[0] null error!"); - return; - } - tempMeasure = new TempMeasure(); - if (tempMeasure == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: OnStart tempMeasure null error!"); - return; - } - view[0] = tempMeasure; - view[0]->InitView(this); - - tempExitInter = new TempExitInter(); - if (tempExitInter == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: OnStart tempExitInter null error!"); - return; - } - view[1] = tempExitInter; - view[1]->InitView(this); - tempSwipeList[0]->Add(view[0]); - tempSwipeList[0]->Add(view[1]); - container[MEASURE_INTER] = tempSwipeList[0]; - group = container[MEASURE_INTER]; - tempWhichInter = MEASURE_INTER; - } - AddViewToRootContainer(group); - return; -} - -void TempMainView::DeleteViceInter(void) -{ - if (tempJoinStudy != nullptr) { - delete tempJoinStudy; - tempJoinStudy = nullptr; - } - if (tempMeasure != nullptr) { - delete tempMeasure; - tempMeasure = nullptr; - } - if (tempExitInter != nullptr) { - delete tempExitInter; - tempExitInter = nullptr; - } - if (tempPromptWear != nullptr) { - delete tempPromptWear; - tempPromptWear = nullptr; - } - if (tempClickMea != nullptr) { - delete tempClickMea; - tempClickMea = nullptr; - } - if (tempRemindWear != nullptr) { - delete tempRemindWear; - tempRemindWear = nullptr; - } - if (tempMeaProcess != nullptr) { - delete tempMeaProcess; - tempMeaProcess = nullptr; - } - if (tempInitInter != nullptr) { - delete tempInitInter; - tempInitInter = nullptr; - } - if (tempWarn != nullptr) { - delete tempWarn; - tempWarn = nullptr; - } - if (tempLittleTip != nullptr) { - delete tempLittleTip; - tempLittleTip = nullptr; - } - if (tempExitPrompt != nullptr) { - delete tempExitPrompt; - tempExitPrompt = nullptr; - } - if (tempStudyAbout != nullptr) { - delete tempStudyAbout; - tempStudyAbout = nullptr; - } -} - -int16 TempMainView::GetWhichInter(void) -{ - return tempWhichInter; -} - -bool TempMainView::SetSwipeInter(int16 num) -{ - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: SetSwipeInter TempPresenter null!"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - UISwipeView::OnSwipeListener* onSwipeListener = - static_cast(OHOS::TempPresenter::GetInstance()); - tempSwipeList[num] = new UISwipeView(UISwipeView::VERTICAL); - if (tempSwipeList[num] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "tempSwipeList[num] new fail"); - return false; - } - tempSwipeList[num]->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); - tempSwipeList[num]->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - tempSwipeList[num]->SetOnDragListener(listener); - tempSwipeList[num]->SetOnSwipeListener(onSwipeListener); - tempSwipeList[num]->SetDraggable(true); - tempSwipeList[num]->SetTouchable(true); - tempSwipeList[num]->SetAnimatorTime(50); // 50 animator drag time(ms) - - return true; -} - -int16 TempMainView::GetListenInter(void) -{ - return interListen; -} - -void TempMainView::DropView(UIView& view) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::DropView"); - if (&view == container[PROMPT_WEAR]) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::DropView::container[PROMPT_WEAR]"); - ChangeView(PROMPT_WEAR, MEASURE_INTER); - } else if (&view == container[CLICK_MEA]) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::DropView::container[CLICK_MEA]"); - ChangeView(CLICK_MEA, PROMPT_WEAR); - } else if (&view == container[REMIND_WEAR]) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::DropView::container[REMIND_WEAR]"); - ChangeView(REMIND_WEAR, CLICK_MEA); - } else if (&view == container[TEMP_EXIT_STUDY]) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::DropView::container[TEMP_EXIT_STUDY]"); - ChangeView(TEMP_EXIT_STUDY, tempWhichMea); - } else if (&view == container[TEMP_WARN_INTER]) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::DropView::container[TEMP_WARN_INTER]"); - ChangeView(TEMP_WARN_INTER, MEASURE_INTER); - } else if (&view == container[TEMP_STUDY]) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::DropView::container[TEMP_STUDY] tempWhichMea = %d", tempWhichMea); - ChangeView(TEMP_STUDY, tempWhichMea); - } else if (&view == container[TEMP_TIP]) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::DropView::container[TEMP_TIP]"); - ChangeView(TEMP_TIP, MEASURE_INIT); - } else if (&view == container[MEASURE_ING]) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::DropView::container[MEASURE_ING]"); - if (interListen == CLICK_MEA) { - ChangeView(MEASURE_ING, CLICK_MEA); - } else if (interListen == MEASURE_INIT) { - ChangeView(MEASURE_ING, MEASURE_INIT); - } - if (TempMeaProcess::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::GetInstance() null error!"); - return; - } - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::GetInstance() null error!"); - return; - } - TempMeaProcess::GetInstance()->SetCircleStatus(false); - TempPresenter::GetInstance()->SetTempCountMax(); - } else { - NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); - } - return; -} - -bool TempMainView::ChangePrompt(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangePrompt"); - if (container[thisView] == nullptr) { - tempPromptWear = new TempPromptWear(); - if (tempPromptWear == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: OnStart tempPromptWear null error!"); - return false; - } - container[thisView] = tempPromptWear; - tempPromptWear->InitPromptWear(); - AddViewToRootContainer(container[thisView]); - } - tempWhichInter = thisView; - return true; -} - -bool TempMainView::ChangeMeasure(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure"); - if (container[thisView] == nullptr) { - AppGroupView *view[SET_THREE] = {nullptr}; - if (!SetSwipeInter(SET_ZERO)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure SetSwipeInter[0] null error!"); - return false; - } - tempMeasure = new TempMeasure(); - if (tempMeasure == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure tempMeasure null error!"); - return false; - } - view[SET_ZERO] = tempMeasure; - if (!view[SET_ZERO]->InitView(this)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure view [0] InitView null error!"); - return false; - } - - tempExitInter = new TempExitInter(); - if (tempExitInter == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure tempExitInter null error!"); - return false; - } - view[SET_ONE] = tempExitInter; - if (!view[SET_ONE]->InitView(this)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure view [1] InitView null error!"); - return false; - } - tempSwipeList[SET_ZERO]->Add(view[SET_ZERO]); - tempSwipeList[SET_ZERO]->Add(view[SET_ONE]); - container[thisView] = tempSwipeList[SET_ZERO]; - - AddViewToRootContainer(container[thisView]); - TempModel::GetInstance()->SetTempInterLis(SECOND_TIME_JOIN); - } - tempWhichInter = thisView; - tempWhichMea = thisView; - return true; -} - -bool TempMainView::ChangeClickMea(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeClickMea"); - if (container[thisView] == nullptr) { - tempClickMea = new TempClickMea(); - if (tempClickMea == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeClickMea tempClickMea null error!"); - return false; - } - container[thisView] = tempClickMea; - if (!tempClickMea->InitClickMea()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeClickMea InitClickMea error!"); - return false; - } - AddViewToRootContainer(container[thisView]); - } - if (TempClickMea::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempClickMea:: GetInstance error!"); - return false; - } - TempClickMea::GetInstance()->RefreshClickMea(); - tempWhichInter = thisView; - return true; -} - -bool TempMainView::ChangeRemindWear(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeRemindWear"); - if (container[thisView] == nullptr) { - tempRemindWear = new TempRemindWear(); - if (tempRemindWear == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: OnStart tempRemindWear null error!"); - return false; - } - container[thisView] = tempRemindWear; - if (!tempRemindWear->InitRemindWear()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeRemindWear InitRemindWear error!"); - return false; - } - AddViewToRootContainer(container[thisView]); - } - tempWhichInter = thisView; - return true; -} - -bool TempMainView::ChangeMeaProcess(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeaProcess"); - if (container[thisView] == nullptr) { - tempMeaProcess = new TempMeaProcess(); - if (tempMeaProcess == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: OnStart tempMeaProcess null error!"); - return false; - } - container[thisView] = tempMeaProcess; - if (!tempMeaProcess->InitMeaProcess()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeaProcess InitMeaProcess error!"); - return false; - } - AddViewToRootContainer(container[thisView]); - } - if (TempMeaProcess::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess:: GetInstance error!"); - return false; - } - TempMeaProcess::GetInstance()->SetCircleStatus(true); - tempWhichInter = thisView; - return true; -} - -bool TempMainView::ChangeTempInit(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeTempInit"); - if (container[thisView] == nullptr) { - AppGroupView *view[SET_THREE] = {nullptr}; - if (!SetSwipeInter(SET_ONE)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure SetSwipeInter[1] null error!"); - return false; - } - tempInitInter = new TempInitInter(); - if (tempInitInter == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: OnStart tempInitInter null error!"); - return false; - } - view[SET_ZERO] = tempInitInter; - if (!view[SET_ZERO]->InitView(this)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeTempInit view [0] InitView null error!"); - return false; - } - - tempExitInter = new TempExitInter(); - if (tempExitInter == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: OnStart tempExitInter null error!"); - return false; - } - view[SET_ONE] = tempExitInter; - if (!view[SET_ONE]->InitView(this)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeTempInit view [1] InitView null error!"); - return false; - } - - tempReport = new TempReport(); - if (tempReport == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure tempReport null error!"); - return false; - } - view[SET_TWO] = tempReport; - if (!view[SET_TWO]->InitView(this)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure view [2] InitView null error!"); - return false; - } - tempSwipeList[SET_ONE]->Add(view[SET_ZERO]); - tempSwipeList[SET_ONE]->Add(view[SET_ONE]); - tempSwipeList[SET_ONE]->Add(view[SET_TWO]); - container[thisView] = tempSwipeList[SET_ONE]; - - AddViewToRootContainer(container[thisView]); - } - tempWhichInter = thisView; - tempWhichMea = thisView; - return true; -} - -bool TempMainView::ChangeTempWarn(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeTempWarn"); - if (container[thisView] == nullptr) { - tempWarn = new TempWarn(); - if (tempWarn == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeTempWarn tempWarn null error!"); - return false; - } - container[thisView] = tempWarn; - if (!tempWarn->InitTempWarn()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::InitTempWarn tempWarn null error!"); - return false; - } - AddViewToRootContainer(container[thisView]); - } - if (TempWarn::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::GetInstance null error!"); - return false; - } - TempWarn::GetInstance()->RefreshTempWarn(); - tempWhichInter = thisView; - return true; -} - -bool TempMainView::ChangeContinue(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeContinue"); - if (container[thisView] == nullptr) { - tempContinue = new TempContinueWarn(); - if (tempContinue == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeTempWarn tempContinue null error!"); - return false; - } - container[thisView] = tempContinue; - if (!tempContinue->InitTempContinue()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::InitTempWarn tempContinue null error!"); - return false; - } - AddViewToRootContainer(container[thisView]); - } - if (TempContinueWarn::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::GetInstance null error!"); - return false; - } - tempWhichInter = thisView; - return true; -} - -bool TempMainView::ChangeTempTip(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeTempTip"); - if (container[thisView] == nullptr) { - tempLittleTip = new TempLittleTip(); - if (tempLittleTip == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: ChangeTempTip tempLittleTip null error!"); - return false; - } - container[thisView] = tempLittleTip; - if (!tempLittleTip->InitLittleTip()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: ChangeTempTip InitLittleTip null error!"); - return false; - } - AddViewToRootContainer(container[thisView]); - } - if (TempLittleTip::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempLittleTip:: GetInstance error!"); - return false; - } - TempLittleTip::GetInstance()->RefreshTip(); - tempWhichInter = thisView; - return true; -} - -bool TempMainView::ChangeExitPrompt(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeExitPrompt"); - if (container[thisView] == nullptr) { - tempExitPrompt = new TempExitPrompt(); - if (tempExitPrompt == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: ChangeExitPrompt tempExitPrompt null error!"); - return false; - } - container[thisView] = tempExitPrompt; - if (!tempExitPrompt->InitExitPrompt()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: ChangeExitPrompt InitExitPrompt null error!"); - return false; - } - AddViewToRootContainer(container[thisView]); - } - tempWhichInter = thisView; - return true; -} - -bool TempMainView::ChangeStudyAbout(int16 thisView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeStudyAbout"); - if (container[thisView] == nullptr) { - tempStudyAbout = new TempStudyAbout(); - if (tempStudyAbout == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: ChangeStudyAbout tempStudyAbout null error!"); - return false; - } - container[thisView] = tempStudyAbout; - if (!tempStudyAbout->InitStudyAbout()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: ChangeStudyAbout InitStudyAbout null error!"); - return false; - } - AddViewToRootContainer(container[thisView]); - } - if (TempStudyAbout::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempStudyAbout:: GetInstance error!"); - return false; - } - TempStudyAbout::GetInstance()->RefreshStudy(); - tempWhichInter = thisView; - return true; -} - -struct TempViewMapper { - const int16 viewId; - bool (TempMainView::*func)(int16 thisView); -}; - -static const TempViewMapper ViewMapper[] = { - {MEASURE_INTER, &TempMainView::ChangeMeasure}, - {PROMPT_WEAR, &TempMainView::ChangePrompt}, - {CLICK_MEA, &TempMainView::ChangeClickMea}, - {REMIND_WEAR, &TempMainView::ChangeRemindWear}, - {MEASURE_ING, &TempMainView::ChangeMeaProcess}, - {MEASURE_INIT, &TempMainView::ChangeTempInit}, - {TEMP_WARN_INTER, &TempMainView::ChangeTempWarn}, - {TEMP_TIP, &TempMainView::ChangeTempTip}, - {TEMP_EXIT_STUDY, &TempMainView::ChangeExitPrompt}, - {TEMP_STUDY, &TempMainView::ChangeStudyAbout}, -}; - -bool TempMainView::ClickFunc(int16 interf) -{ - int funcSize = sizeof(ViewMapper) / sizeof(ViewMapper[0]); - for (int i = 0; i < funcSize; i++) { - if (interf == ViewMapper[i].viewId) { - bool jug = (this->*(ViewMapper[i].func))(interf); - if (!jug) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: ChangeInterFace[%d] false", interf); - return false; - } - return true; - } - } - return false; -} - -void TempMainView::ChangeView(int16 hideView, int16 showView) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeView hideView = %d, showView = %d", hideView, showView); - if (hideView > INTERFACES_MAX) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeView Overstep ones bounds"); - return; - } - interListen = hideView; - if (!ClickFunc(showView)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeView ClickFunc error"); - return; - } - container[hideView]->SetVisible(false); - container[showView]->SetVisible(true); - - Draw(); - return; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMeaProcess.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMeaProcess.cpp deleted file mode 100644 index 7bb6460c7..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMeaProcess.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include -#include "temperature/include/TempMeaProcess.h" -#include "temperature/include/TempMainView.h" - -namespace OHOS { -static TempMeaProcess *g_tempMeaProcess = nullptr; - -static const int16 MEASURE_PROCESS_IMAGE_X = 130; -static const int16 MEASURE_PROCESS_IMAGE_Y = 128; -static const int16 MEASURE_PROCESS_BUTTON_X = 120; -static const int16 MEASURE_PROCESS_BUTTON_Y = 135; -static const int16 MEASURE_PROCESS_WIDTH = 80; -static const int16 MEASURE_PROCESS_CIRCLE_WIDTH = 300; -static const int16 CIRCLE_PROGRESS_CENTER_X = 161; -static const int16 CIRCLE_PROGRESS_CENTER_Y = 161; -static const int16 MEA_CIRCLE_RADIUS = 115; -static const int16 MEA_CIRCLE_VALUE = 100; -static const int16 MEA_CIRCLE_PROGRESS_WIDTH = 20; -static const int16 MEA_CIRCLE_PROGRESS_LEFT = 10; -static const int16 MEA_CIRCLE_PROGRESS_TOP = 5; -static const int16 MEA_CIRCLE_PROGRESS_STARTANGLE = 360; -static const int16 MEA_CIRCLE_PROGRESS_ENDANGLE = 0; -static const int16 MEA_PROCESS_LABEL_FONT = 34; -static const int16 MEA_PROCESS_LABEL_X = 155; -static const int16 MEA_PROCESS_LABEL_Y = 370; -static const int16 MEA_PROCESS_LABEL_WIDTH = 150; -static const int16 MEA_PROCESS_LABEL_HEIGHT = 80; -static const int16 MEASURE_IMAGE_WAITING_X = 114; -static const int16 MEASURE_IMAGE_WAITING_Y = 112; -static const int16 CIRCLE_PROGRESS_POSITION_X = 50; -static const int16 CIRCLE_PROGRESS_POSITION_Y = 52; -static const int16 CIRCLE_PROGRESS_POSITION_WIDTH = 300; -constexpr char *MEA_PROCESS_LABEL_TEXT = (char*)"正在测试"; - -TempMeaProcess::TempMeaProcess() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::TempMeaProcess"); - g_tempMeaProcess = this; -} - -TempMeaProcess::~TempMeaProcess() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::~TempMeaProcess"); - RemoveAll(); - if (tempCircle != nullptr) { - delete tempCircle; - tempCircle = nullptr; - } - if (imageMeasure != nullptr) { - delete imageMeasure; - imageMeasure = nullptr; - } - if (tempLabel != nullptr) { - delete tempLabel; - tempLabel = nullptr; - } - g_tempMeaProcess = nullptr; -} - -TempMeaProcess *TempMeaProcess::GetInstance(void) -{ - return g_tempMeaProcess; -} - -bool TempMeaProcess::TempCirCleProcess() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::TempCirCleProcess"); - tempCircle = new UICircleProgress(); - if (tempCircle == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::TempCirCleProcess new tempCircle fail"); - return false; - } - tempCircle->SetPosition(CIRCLE_PROGRESS_POSITION_X, CIRCLE_PROGRESS_POSITION_Y, - CIRCLE_PROGRESS_POSITION_WIDTH, CIRCLE_PROGRESS_POSITION_WIDTH); - tempCircle->SetCenterPosition(CIRCLE_PROGRESS_CENTER_X, CIRCLE_PROGRESS_CENTER_Y); - tempCircle->SetRadius(MEA_CIRCLE_RADIUS); - tempCircle->SetValue(MEA_CIRCLE_VALUE); - tempCircle->SetBackgroundStyle(STYLE_LINE_WIDTH, - tempCircle->GetBackgroundStyle(STYLE_LINE_WIDTH) + MEA_CIRCLE_PROGRESS_WIDTH); - tempCircle->SetForegroundStyle(STYLE_LINE_WIDTH, - tempCircle->GetForegroundStyle(STYLE_LINE_WIDTH) + MEA_CIRCLE_PROGRESS_WIDTH); - tempCircle->SetStyle(STYLE_PADDING_LEFT, MEA_CIRCLE_PROGRESS_LEFT); - tempCircle->SetStyle(STYLE_PADDING_TOP, MEA_CIRCLE_PROGRESS_TOP); - tempCircle->SetStartAngle(MEA_CIRCLE_PROGRESS_STARTANGLE); - tempCircle->SetEndAngle(MEA_CIRCLE_PROGRESS_ENDANGLE); - tempCircle->SetLineColor(Color::Gray()); - Add(tempCircle); - return true; -} - -bool TempMeaProcess::TempInitImage(void) -{ - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - - imageMeasure = new UIImageView(); - if (imageMeasure == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::InitMeasure new image fail"); - return false; - } - imageMeasure->SetPosition(MEASURE_PROCESS_IMAGE_X, MEASURE_PROCESS_IMAGE_Y, - MEASURE_PROCESS_WIDTH, MEASURE_PROCESS_WIDTH); - imageMeasure->SetSrc(TEMP_MEASURE); - imageMeasure->SetViewId(TEMP_MEASURE_IMAGE); - imageMeasure->SetOnClickListener(clickListener); - Add(imageMeasure); - - return true; -} - -bool TempMeaProcess::TempInitLabel(void) -{ - tempLabel = new UILabel(); - if (tempLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::InitMeasure new label fail"); - return false; - } - tempLabel->SetText(MEA_PROCESS_LABEL_TEXT); - tempLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, MEA_PROCESS_LABEL_FONT); - tempLabel->SetPosition(MEA_PROCESS_LABEL_X, MEA_PROCESS_LABEL_Y, MEA_PROCESS_LABEL_WIDTH, - MEA_PROCESS_LABEL_HEIGHT); - Add(tempLabel); - return true; -} - -UICircleProgress *TempMeaProcess::GetCircleProgress() -{ - return tempCircle; -} - -bool TempMeaProcess::GetCircleStatus(void) -{ - return circleStatus; -} - -void TempMeaProcess::SetCircleStatus(bool status) -{ - circleStatus = status; -} - -bool TempMeaProcess::InitMeaProcess(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::InitMeaProcess"); - SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::InitMeaProcess TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetOnDragListener(listener); - SetViewId(TEMP_MEASURE_PROCESS); - SetDraggable(true); - SetTouchable(true); - - if (!TempInitImage()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::InitMeaProcess TempInitImage() false"); - return false; - } - if (!TempInitLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::InitMeaProcess TempInitLabel() false"); - return false; - } - if (!TempCirCleProcess()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::InitMeaProcess TempCirCleProcess() false"); - return false; - } - - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMeasure.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMeasure.cpp deleted file mode 100644 index d69ac21d2..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempMeasure.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include -#include "temperature/include/TempMeasure.h" - -namespace OHOS { -static TempMeasure *g_tempMeasure = nullptr; - -static const char *MEASURE_TITLE = (char*)"体温"; -static const char *MEASURE_BUTTON = (char*)"测量"; -static const int16 MEASURE_TITLE_FONT = 40; -static const int16 MEASURE_BUTTON_FONT = 35; -static const int16 MEASURE_TITLE_X = 185; -static const int16 MEASURE_TITLE_Y = 30; -static const int16 MEASURE_TITLE_WIDTH = 155; -static const int16 MEASURE_TITLE_HEIGHT = 155; -static const int16 MEASURE_IMAGE_X = 130; -static const int16 MEASURE_IMAGE_Y = 126; -static const int16 MEASURE_IMAGE_WAITING_X = 114; -static const int16 MEASURE_IMAGE_WAITING_Y = 111; -static const int16 BACKGROUND_IMAGE_X = 135; -static const int16 BACKGROUND_IMAGE_Y = 125; -static const int16 MEASURE_WIDTH = 80; -static const int16 MEASURE_DROP_WIDTH = 45; -static const int16 MEASURE_DROP_X = 200; -static const int16 MEASURE_DROP_Y = 415; -static const int16 MEASURE_BUTTON_X = 110; -static const int16 MEASURE_BUTTON_Y = 340; -static const int16 MEASURE_BUTTON_WIDTH = 220; -static const int16 MEASURE_BUTTON_HEIGHT = 80; -static const int16 TEMP_IMAGE_MAX = 2; -static const int16 TEMP_IMAGE_Y = 35; -static const int16 TEMP_COLD_IMAGE_X = 120; -static const int16 TEMP_HOT_IMAGE_X = 275; -static const int16 TEMP_IMAGE_WIDTH = 60; -static const int16 TEMP_IMAGE_HEIGHT = 58; - -TempMeasure::TempMeasure() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMeasure::TempMeasure"); - g_tempMeasure = this; -} - -TempMeasure::~TempMeasure() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMeasure::~TempMeasure"); - RemoveAll(); - int numMeasure; - if (labelMeasure != nullptr) { - delete labelMeasure; - labelMeasure = nullptr; - } - if (buttonMeasure != nullptr) { - delete buttonMeasure; - buttonMeasure = nullptr; - } - if (backgroudButton != nullptr) { - delete backgroudButton; - backgroudButton = nullptr; - } - for (numMeasure = SET_ZERO; numMeasure < SET_THREE; numMeasure++) { - if (imageMeasure[numMeasure] != nullptr) { - delete imageMeasure[numMeasure]; - imageMeasure[numMeasure] = nullptr; - } - } - g_tempMeasure = nullptr; -} - -TempMeasure *TempMeasure::GetInstance(void) -{ - return g_tempMeasure; -} - -bool TempMeasure::TempInitImage(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMeasure::TempInitImage"); - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - imageMeasure[SET_ZERO] = new UIImageView(); - if (imageMeasure[SET_ZERO] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitMeasure new image fail"); - return false; - } - imageMeasure[SET_ZERO]->SetPosition(MEASURE_IMAGE_X, MEASURE_IMAGE_Y, MEASURE_WIDTH, MEASURE_WIDTH); - imageMeasure[SET_ZERO]->SetSrc(TEMP_MEASURE); - imageMeasure[SET_ZERO]->SetViewId(TEMP_MEASURE_IMAGE); - imageMeasure[SET_ZERO]->SetTouchable(true); - imageMeasure[SET_ZERO]->SetOnClickListener(clickListener); - Add(imageMeasure[SET_ZERO]); - - imageMeasure[SET_ONE] = new UIImageView(); - if (imageMeasure[SET_ONE] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitMeasure new image fail"); - return false; - } - imageMeasure[SET_ONE]->SetPosition(MEASURE_DROP_X, MEASURE_DROP_Y, MEASURE_DROP_WIDTH, MEASURE_DROP_WIDTH); - imageMeasure[SET_ONE]->SetSrc(TEMP_UP_DROP); - Add(imageMeasure[SET_ONE]); - - imageMeasure[SET_TWO] = new UIImageView(); - if (imageMeasure[SET_TWO] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitMeasure new image fail"); - return false; - } - imageMeasure[SET_TWO]->SetPosition(MEASURE_IMAGE_WAITING_X, MEASURE_IMAGE_WAITING_Y); - imageMeasure[SET_TWO]->SetSrc(TEMP_WAITING); - Add(imageMeasure[SET_TWO]); - - return true; -} - -bool TempMeasure::TempInitLabel(void) -{ - labelMeasure = new UILabel(); - if (labelMeasure == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitMeasure new label fail"); - return false; - } - labelMeasure->SetText(MEASURE_TITLE); - labelMeasure->SetFont(DEFAULT_VECTOR_FONT_FILENAME, MEASURE_TITLE_FONT); - labelMeasure->SetPosition(MEASURE_TITLE_X, MEASURE_TITLE_Y, MEASURE_TITLE_WIDTH, MEASURE_TITLE_HEIGHT); - Add(labelMeasure); - - return true; -} - -bool TempMeasure::TempInitButton(void) -{ - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - buttonMeasure = new UILabelButton(); - if (buttonMeasure == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitMeasure new label fail"); - return false; - } - buttonMeasure->SetPosition(MEASURE_BUTTON_X, MEASURE_BUTTON_Y, MEASURE_BUTTON_WIDTH, MEASURE_BUTTON_HEIGHT); - buttonMeasure->SetText(MEASURE_BUTTON); - buttonMeasure->SetFont(DEFAULT_VECTOR_FONT_FILENAME, MEASURE_BUTTON_FONT); - buttonMeasure->SetViewId(TEMP_MEASURE_BUTTON); - buttonMeasure->SetTextColor(OHOS::TempPresenter::GetInstance()->CyanColor()); - buttonMeasure->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::RELEASED); - buttonMeasure->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::PRESSED); - buttonMeasure->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Gray().full, UIButton::INACTIVE); - buttonMeasure->SetOnClickListener(clickListener); - Add(buttonMeasure); - - return true; -} - -bool TempMeasure::InitView(void *caller) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitView"); - UNUSED(caller); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitView TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetDraggable(true); - SetTouchable(true); - SetOnDragListener(listener); - - if (!TempInitLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitView TempInitLabel() false"); - return false; - } - if (!TempInitButton()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitView TempInitButton() false"); - return false; - } - if (!TempInitImage()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitView TempInitImage() false"); - return false; - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempModel.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempModel.cpp deleted file mode 100644 index af1f61393..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempModel.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "temperature/include/TempModel.h" -#include "UiConfig.h" -#include "temperature/include/TempModel.h" - -namespace OHOS { -TempModel::TempModel() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempModel::TempModel"); -} - -TempModel::~TempModel() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempModel::~TempModel"); -} - -TempModel *TempModel::GetInstance(void) -{ - static TempModel tempModel; - return &tempModel; -} - -void TempModel::SetTempInterLis(int16 interListen) -{ - tempInterLis = interListen; -} - -int16 TempModel::GetTempInterLis(void) -{ - return tempInterLis; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempPresenter.cpp deleted file mode 100644 index 5f49e419b..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempPresenter.cpp +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "temperature/include/TempPresenter.h" -#include "temperature/include/TempMainView.h" -#include "ChangeSliceListener.h" -#include "graphic_service.h" -#include "uiservice/include/ui_service.h" -#include "string" -#include "iostream" -#include "sstream" -#include "NativeRegisterManager.h" - -namespace OHOS { - -// REGIST_MENU(VIEW_MAIN_TEMP, TempMainView, TempPresenter, PNG_APPLIST_TEMP_IMAGE, PNG_APPLIST_DEFAULT_IMG, "体温"); - -static TempPresenter *g_tempPresenter = nullptr; - -ColorType TempPresenter::CyanColor() -{ - return Color::GetColorFromRGB(0x1C, 0xF4, 0xED); -} - -TempPresenter::TempPresenter() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter new"); - g_tempPresenter = this; -} - -TempPresenter::~TempPresenter() -{ - g_tempPresenter = nullptr; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::~TempPresenter"); -} - -TempPresenter *TempPresenter::GetInstance() -{ - return g_tempPresenter; -} - -void TempPresenter::OnResume(void) -{ - Presenter::OnResume(); - SendMsgToUIService(UI_ADD_SLEEP_VETO, 0, nullptr, 0); -} - -void TempPresenter::OnStop(void) -{ - SendMsgToUIService(UI_RM_SLEEP_VETO, 0, nullptr, 0); -} - -bool TempPresenter::OnDrag(UIView& view, const DragEvent& event) -{ - if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::OnDrag TempMainView::GetInstance() nullptr"); - return false; - } - TempMainView::GetInstance()->DropView(view); - } - return true; -} - -void TempPresenter::ProgressNotify(void) -{ - if (TempMeaProcess::GetInstance() == nullptr) { - return; - } - if (TempMeaProcess::GetInstance()->GetCircleStatus() && - TempMeaProcess::GetInstance()->GetCircleProgress() != nullptr) { - if (countTemp > 0) { - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&TempPresenter::UpdateTempCount, this)); - } else { - TempMeaProcess::GetInstance()->SetCircleStatus(false); - if (TempMainView::GetInstance() != nullptr) { - TempMainView::GetInstance()->ChangeView(MEASURE_ING, MEASURE_INIT); - } - SetTempCountMax(); - } - } - return; -} - -void TempPresenter::SetTempCountMax(void) -{ - countTemp = SET_HUNDRED; -} - -void TempPresenter::UpdateTempCount(void) -{ - if (TempMeaProcess::GetInstance() != nullptr) { - TempMeaProcess::GetInstance()->GetCircleProgress()->SetValue(countTemp); - } - countTemp--; -} - -void TempPresenter::ClickTempJoin(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickTempJoin start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickTempJoin TempMainView::GetInstance() nullptr"); - return; - } - TempMainView::GetInstance()->ChangeView(JOIN_STUDY_INTER, MEASURE_INTER); - return; -} - -void TempPresenter::ClickPromptWear(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickPromptWear start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickPromptWear TempMainView::GetInstance() nullptr"); - return; - } - TempMainView::GetInstance()->ChangeView(MEASURE_INTER, PROMPT_WEAR); - return; -} - -void TempPresenter::ClickPromptNext(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickPromptWear start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickPromptNext TempMainView::GetInstance() nullptr"); - return; - } - TempMainView::GetInstance()->ChangeView(PROMPT_WEAR, CLICK_MEA); - return; -} - -void TempPresenter::ClickExitMea(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickExitMea start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickExitMea TempMainView::GetInstance() nullptr"); - return; - } - TempMainView::GetInstance()->ChangeView(CLICK_MEA, MEASURE_INTER); - return; -} - -void TempPresenter::ClickIfWear(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickIfWear start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickIfWear TempMainView::GetInstance() nullptr"); - return; - } - if (wearListen == 0) { - TempMainView::GetInstance()->ChangeView(CLICK_MEA, MEASURE_ING); - } else { - TempMainView::GetInstance()->ChangeView(CLICK_MEA, REMIND_WEAR); - } - return; -} - -void TempPresenter::ClickMeaAgain(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickMeaAgain start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickMeaAgain TempMainView::GetInstance() nullptr"); - return; - } - TempMainView::GetInstance()->ChangeView(MEASURE_INIT, MEASURE_ING); - return; -} - -void TempPresenter::ClickMeasure(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickMeasure start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickMeasure TempMainView::GetInstance() nullptr"); - return; - } - TempMainView::GetInstance()->ChangeView(CLICK_MEA, MEASURE_ING); - return; -} - -void TempPresenter::ClickTempTip(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickTempTip start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickTempTip TempMainView::GetInstance() nullptr"); - return; - } - TempMainView::GetInstance()->ChangeView(MEASURE_INTER, TEMP_TIP); - return; -} - -void TempPresenter::ClickTempExit(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickTempExit start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickTempExit TempMainView::GetInstance() nullptr"); - return; - } - int theView = TempMainView::GetInstance()->GetWhichInter(); - if (theView != MEASURE_INTER && theView != MEASURE_INIT) { - theView = MEASURE_INIT; - } - TempMainView::GetInstance()->ChangeView(theView, TEMP_EXIT_STUDY); - return; -} - -void TempPresenter::ClickStudyTip(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickStudyTip start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickStudyTip TempMainView::GetInstance() nullptr"); - return; - } - int theView = TempMainView::GetInstance()->GetWhichInter(); - if (theView != MEASURE_INTER && theView != MEASURE_INIT) { - theView = MEASURE_INIT; - } - TempMainView::GetInstance()->ChangeView(theView, TEMP_STUDY); - return; -} - -void TempPresenter::ClickWarnBack(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickWarnBack start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickStudyTip TempMainView::GetInstance() nullptr"); - return; - } - TempMainView::GetInstance()->ChangeView(TEMP_WARN_INTER, MEASURE_INTER); - return; -} - -void TempPresenter::ClickExitDelete(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickExitDelete start"); - if (TempMainView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickExitDelete TempMainView::GetInstance() nullptr"); - return; - } - TempMainView::GetInstance()->ChangeView(TEMP_EXIT_STUDY, TempMainView::GetInstance()->GetListenInter()); - return; -} - -void TempPresenter::ClickExit(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickExit start"); - uint16 preSlice = NativeAbility::GetInstance().GetPreSliceId(); - NativeAbility::GetInstance().ChangeSlice(preSlice); - if (TempModel::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempModel::GetInstance null error!"); - return; - } - TempModel::GetInstance()->SetTempInterLis(0); - return; -} - -void TempPresenter::ClickExitTemp(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickExitTemp start"); - uint16 preSlice = NativeAbility::GetInstance().GetPreSliceId(); - NativeAbility::GetInstance().ChangeSlice(preSlice); - return; -} - -int8 TempPresenter::GetTempListen(void) -{ - return tempListen; -} - -struct TempPresentMapper1 { - const char *viewId; - void (TempPresenter::*func)(void); -}; - -static const TempPresentMapper1 PresentMapper[] = { - {TEMP_INTER_EXIT, &TempPresenter::ClickExitTemp}, - {TEMP_INTER_JOIN, &TempPresenter::ClickTempJoin}, - {TEMP_MEASURE_IMAGE, &TempPresenter::ClickPromptWear}, - {TEMP_MEASURE_BUTTON, &TempPresenter::ClickPromptWear}, - {TEMP_PROMPT_NEXT, &TempPresenter::ClickPromptNext}, - {TEMP_MEA_EXIT, &TempPresenter::ClickExitMea}, - {TEMP_MEA_IN, &TempPresenter::ClickIfWear}, - {TEMP_MEA_AGAIN, &TempPresenter::ClickMeaAgain}, - {TEMP_IMAGE_LIT_TIP, &TempPresenter::ClickTempTip}, - {TEMP_EXIT_THIS, &TempPresenter::ClickTempExit}, - {TEMP_STUDY_THIS, &TempPresenter::ClickStudyTip}, - {TEMP_WARN_ID, &TempPresenter::ClickWarnBack}, - {TEMP_EXIT_DELETE, &TempPresenter::ClickExitDelete}, - {TEMP_EXIT_TRUE, &TempPresenter::ClickExit}, -}; - -bool TempPresenter::ClickFuncId(const char *buttonName) -{ - if (buttonName == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickFuncId buttonName nullptr error!"); - return false; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::ClickFuncId buttonName = %s", buttonName); - for (uint16 i = 0; i < sizeof(PresentMapper) / sizeof(PresentMapper[0]); i++) { - if (strcmp(buttonName, PresentMapper[i].viewId) == 0) { - (this->*(PresentMapper[i].func))(); - return true; - } - } - return false; -} - -bool TempPresenter::OnClick(UIView &view, const ClickEvent &event) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::OnClick "); - UNUSED(event); - ClickFuncId(view.GetViewId()); - return true; -} - -void TempPresenter::OnSwipe(UISwipeView &view) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter::OnSwipe "); - UNUSED(view); - return; -} - -void TempPresenter::Notify(void) -{ - ProgressNotify(); - return; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempPromptWear.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempPromptWear.cpp deleted file mode 100644 index 2cbdb64c6..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempPromptWear.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include -#include "temperature/include/TempPromptWear.h" - -namespace OHOS { -static TempPromptWear *g_tempPromptWear = nullptr; - -static const int16 PROMPT_LABEL_X = 45; -static const int16 PROMPT_LABEL_Y = 180; -static const int16 PROMPT_LABEL_WIDTH = 350; -static const int16 PROMPT_LABEL_HEIGHT = 200; -static const int16 PROMPT_LABEL_BUTTON_X = 63; -static const int16 PROMPT_LABEL_BUTTON_Y = 366; -static const int16 PROMPT_IMAGE_X = 120; -static const int16 PROMPT_IMAGE_Y = 70; -static const int16 PROMPT_BUTTON_WIDHT = 320; -static const int16 PROMPT_BUTTON_HEIGHT = 101; -static const int16 PROMPT_LABEL_FONT = 35; -static const char *PROMPT_WEAR_LABEL = (char*)"为确保测量准确,建议偏紧佩戴,并保持佩戴10分钟以上再测量"; -static const char *PROMPT_BUTTON_LABEL = (char*)"下一步"; - -TempPromptWear::TempPromptWear() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPromptWear::TempPromptWear"); - g_tempPromptWear = this; -} - -TempPromptWear::~TempPromptWear() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPromptWear::~TempPromptWear"); - RemoveAll(); - if (tempLabel != nullptr) { - delete tempLabel; - tempLabel = nullptr; - } - if (tempButton != nullptr) { - delete tempButton; - tempButton = nullptr; - } - if (tempImage != nullptr) { - delete tempImage; - tempImage = nullptr; - } - g_tempPromptWear = nullptr; -} - -TempPromptWear *TempPromptWear::GetInstance(void) -{ - return g_tempPromptWear; -} - -bool TempPromptWear::TempInitLabel(void) -{ - tempLabel = new UILabel(); - if (tempLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPromptWear::TempInitLabel new tempLabel fail"); - return false; - } - tempLabel->SetPosition(PROMPT_LABEL_X, PROMPT_LABEL_Y, PROMPT_LABEL_WIDTH, PROMPT_LABEL_HEIGHT); - tempLabel->SetText(PROMPT_WEAR_LABEL); - tempLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, PROMPT_LABEL_FONT); - Add(tempLabel); - - return true; -} - -bool TempPromptWear::TempInitButton(void) -{ - tempButton = new UILabelButton(); - if (tempButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPromptWear::InitMeasure new tempButton fail"); - return false; - } - tempButton->SetPosition(PROMPT_LABEL_BUTTON_X, PROMPT_LABEL_BUTTON_Y, PROMPT_BUTTON_WIDHT, PROMPT_BUTTON_HEIGHT); - tempButton->SetText(PROMPT_BUTTON_LABEL); - tempButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, PROMPT_LABEL_FONT); - tempButton->SetViewId(TEMP_PROMPT_NEXT); - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - tempButton->SetOnClickListener(clickListener); - tempButton->SetTextColor(OHOS::TempPresenter::GetInstance()->CyanColor()); - tempButton->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE); - Add(tempButton); - - return true; -} - -bool TempPromptWear::TempInitImage(void) -{ - tempImage = new UIImageView(); - if (tempImage == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPromptWear::InitMeasure new UIImageView fail"); - return false; - } - tempImage->SetPosition(PROMPT_IMAGE_X, PROMPT_IMAGE_Y); // 30 : offset - tempImage->SetSrc(TEMP_ICON_ENTER); - Add(tempImage); - - return true; -} - -bool TempPromptWear::InitPromptWear(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPromptWear::InitPromptWear"); - SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);\ - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPromptWear::InitPromptWear TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetOnDragListener(listener); - SetDraggable(true); - SetTouchable(true); - - if (!TempInitLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPromptWear::InitPromptWear TempInitLabel() fail"); - return false; - } - if (!TempInitButton()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPromptWear::InitPromptWear TempInitButton() fail"); - return false; - } - if (!TempInitImage()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPromptWear::InitPromptWear TempInitImage() fail"); - return false; - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempRemindWear.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempRemindWear.cpp deleted file mode 100644 index 12a401b17..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempRemindWear.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include -#include "temperature/include/TempRemindWear.h" - -namespace OHOS { -static TempRemindWear *g_tempRemindWear = nullptr; - -static const int16 REMIND_BACKGROUND_X = 180; -static const int16 REMIND_BACKGROUND_Y = 350; -static const int16 REMIND_WEAR_IMAGE_X = 120; -static const int16 REMIND_WEAR_IMAGE_WIDTH = 100; -static const int16 REMIND_ROTATE_X = 180; -static const int16 REMIND_ROTATE_Y = 345; -static const int16 REMIND_WEAR_IMAGE_Y = 70; -static const int16 REMIND_LABEL_X = 105; -static const int16 REMIND_LABEL_Y = 200; -static const int16 REMIND_LABEL_WIDTH = 350; -static const int16 REMIND_LABEL_HEIGHT = 200; -static const int16 REMIND_LABEL_FONT = 35; -static const char *REMIND_WEAR_LABEL = (char*)"请佩戴手表测量"; - -TempRemindWear::TempRemindWear() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempRemindWear::TempRemindWear"); - g_tempRemindWear = this; -} - -TempRemindWear::~TempRemindWear() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempRemindWear::~TempRemindWear"); - RemoveAll(); - int num; - if (tempLabel != nullptr) { - delete tempLabel; - tempLabel = nullptr; - } - for (num = 0; num < SET_TWO; num++) { - if (tempImage[num] != nullptr) { - delete tempImage[num]; - tempImage[num] = nullptr; - } - } - g_tempRemindWear = nullptr; -} - -TempRemindWear *TempRemindWear::GetInstance(void) -{ - return g_tempRemindWear; -} - -bool TempRemindWear::TempInitImage(void) -{ - tempImage[0] = new UIImageView(); - if (tempImage[0] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempRemindWear::InitRemindWear new tempImage[0] fail"); - return false; - } - tempImage[0]->SetPosition(REMIND_WEAR_IMAGE_X, REMIND_WEAR_IMAGE_Y); - tempImage[0]->SetSrc(TEMP_ICON_ENTER); - Add(tempImage[0]); - - tempImage[1] = new UIImageView(); - if (tempImage[1] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempRemindWear::InitRemindWear new tempImage[1] fail"); - return false; - } - tempImage[1]->SetPosition(REMIND_ROTATE_X, REMIND_ROTATE_Y); - tempImage[1]->SetSrc(TEMP_ROTATE); - Add(tempImage[1]); - - return true; -} - -bool TempRemindWear::TempInitLabel(void) -{ - tempLabel = new UILabel(); - if (tempLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempRemindWear::InitPromptWear new tempLabel fail"); - return false; - } - tempLabel->SetPosition(REMIND_LABEL_X, REMIND_LABEL_Y, REMIND_LABEL_WIDTH, REMIND_LABEL_HEIGHT); - tempLabel->SetText(REMIND_WEAR_LABEL); - tempLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, REMIND_LABEL_FONT); - Add(tempLabel); - - return true; -} - -bool TempRemindWear::InitRemindWear(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempRemindWear::InitRemindWear"); - SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - SetThrowDrag(true); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempRemindWear::InitRemindWear TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetOnDragListener(listener); - SetDraggable(true); - SetTouchable(true); - - if (!TempInitImage()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempRemindWear::InitRemindWear TempInitImage() false"); - return false; - } - if (!TempInitLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempRemindWear::InitRemindWear TempInitLabel() false"); - return false; - } - - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempReport.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempReport.cpp deleted file mode 100644 index 43eeb7b8f..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempReport.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include "layout/grid_layout.h" -#include "font/ui_font.h" -#include -#include "temperature/include/TempReport.h" - -namespace OHOS { -static TempReport *g_tempReport = nullptr; - -static const int16 TEMP_LABEL_ONE_X = 170; -static const int16 TEMP_LABEL_ONE_Y = 30; -static const int16 TEMP_LABEL_ONE_WIDTH = 100; -static const int16 TEMP_LABEL_ONE_HEIGHT = 55; -static const int16 TEMP_LABEL_TWO_X = 180; -static const int16 TEMP_LABEL_TWO_Y = 90; -static const int16 TEMP_LABEL_TWO_WIDTH = 130; -static const int16 TEMP_LABEL_TWO_HEIGHT = 35; -static const int16 TEMP_LABEL_THREE_X = 150; -static const int16 TEMP_LABEL_THREE_Y = 270; -static const int16 TEMP_LABEL_THREE_WIDTH = 90; -static const int16 TEMP_LABEL_THREE_HEIGHT = 40; -static const int16 TEMP_LABEL_FOUR_X = 260; -static const int16 TEMP_LABEL_FIVE_X = 60; -static const int16 TEMP_LABEL_FIVE_Y = 320; -static const int16 TEMP_LABEL_FIVE_WIDTH = 300; -static const int16 TEMP_LABEL_FIVE_HEIGHT = 60; -static const int16 TEMP_LABEL_SIX_X = 190; -static const int16 TEMP_LABEL_SIX_Y = 385; -static const int16 TEMP_LABEL_SIX_WIDTH = 80; -static const int16 TEMP_LABEL_SIX_HEIGHT = 40; -static const int16 TEMP_IMAGE_ONE_X = 70; -static const int16 TEMP_IMAGE_ONE_Y = 30; -static const int16 TEMP_IMAGE_TWO_X = 275; -static const int16 TEMP_IMAGE_TWO_Y = 50; -static const int16 TEMP_IMAGE_THREE_X = 117; -static const int16 TEMP_IMAGE_THREE_Y = 273; -static const int16 TEMP_IMAGE_FOUR_X = 230; -static const int16 TEMP_FOUR_X = 40; -static const int16 TEMP_IMAGE_FOUR_Y = 120; -static const int16 TEMP_TITLE_FONT = 50; -static const int16 TEMP_LABEL_FONT = 35; -static const int16 TEMP_TIP_FONT = 30; -static const int16 TEMP_LITTLE_TIP_FONT = 25; -static const char *TEMP_LABEL_FIVE_TEXT = (char *)"可能受佩带松紧、环境冷热等影响,测量结果仅供参考"; -static const char *TEMP_LABEL_SIX_TEXT = (char *)"测量"; -static const char *TEMP_NUMBERS = (char *)"36.5"; -static const char *TEMP_TIME_TIP = (char *)"1分钟前"; - -TempReport::TempReport() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport"); - g_tempReport = this; -} - -TempReport::~TempReport() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempReport::~TempReport"); - RemoveAll(); - for (int16_t labelNum = 0; labelNum < TEMP_SET_SIX; labelNum++) { - if (tempLabel[labelNum] != nullptr) { - delete tempLabel[labelNum]; - tempLabel[labelNum] = nullptr; - } - } - for (int16_t imageNum = 0; imageNum < SET_FIVE; imageNum++) { - if (tempImage[imageNum] != nullptr) { - delete tempImage[imageNum]; - tempImage[imageNum] = nullptr; - } - } - g_tempReport = nullptr; -} - -TempReport *TempReport::GetInstance(void) -{ - return g_tempReport; -} - -typedef struct { - int16 labelNum; - int16 x; - int16 y; - int16 width; - int16 height; - char* name; - int16 font; - const char* text; -} TempReportItem; - -static const TempReportItem tempReportItem[] = { - {SET_ZERO, TEMP_LABEL_ONE_X, TEMP_LABEL_ONE_Y, TEMP_LABEL_ONE_WIDTH, TEMP_LABEL_ONE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TITLE_FONT, TEMP_NUMBERS}, - {SET_ONE, TEMP_LABEL_TWO_X, TEMP_LABEL_TWO_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_FONT, TEMP_TIME_TIP}, - {SET_TWO, TEMP_LABEL_THREE_X, TEMP_LABEL_THREE_Y, TEMP_LABEL_THREE_WIDTH, TEMP_LABEL_THREE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_NUMBERS}, - {SET_THREE, TEMP_LABEL_FOUR_X, TEMP_LABEL_THREE_Y, TEMP_LABEL_THREE_WIDTH, TEMP_LABEL_THREE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_NUMBERS}, - {SET_FOUR, TEMP_LABEL_FIVE_X, TEMP_LABEL_FIVE_Y, TEMP_LABEL_FIVE_WIDTH, TEMP_LABEL_FIVE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LITTLE_TIP_FONT, TEMP_LABEL_FIVE_TEXT}, - {SET_FIVE, TEMP_LABEL_SIX_X, TEMP_LABEL_SIX_Y, TEMP_LABEL_SIX_WIDTH, TEMP_LABEL_SIX_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_LABEL_SIX_TEXT}, -}; - -bool TempReport::SetBasicLabel(void) -{ - for (int num = 0; num <= SET_FIVE; num++) { - tempLabel[tempReportItem[num].labelNum] = new UILabel(); - if (tempLabel[tempReportItem[num].labelNum] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::InitLittleTip new tempLabel[%d] fail", - tempReportItem[num].labelNum); - return false; - } - tempLabel[tempReportItem[num].labelNum]->SetPosition(tempReportItem[num].x, tempReportItem[num].y, - tempReportItem[num].width, tempReportItem[num].height); - tempLabel[tempReportItem[num].labelNum]->SetFont(tempReportItem[num].name, tempReportItem[num].font); - tempLabel[tempReportItem[num].labelNum]->SetText(tempReportItem[num].text); - Add(tempLabel[tempReportItem[num].labelNum]); - } - return true; -} - -bool TempReport::SetAppendLabel(void) -{ - if (tempLabel[SET_FOUR] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::SetAppendLabel new tempLabel[SET_FOUR] fail"); - return false; - } - tempLabel[SET_FOUR]->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - tempLabel[SET_FOUR]->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - tempLabel[SET_FIVE]->SetTextColor(TempPresenter::GetInstance()->CyanColor()); - - return true; -} - -bool TempReport::InitSimilarImage(int16 num, int16 tempX, int16 tempY, const char* imageSrc) -{ - tempImage[num] = new UIImageView(); - if (tempImage[num] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::InitSimilarImage new tempImage[%d] fail", num); - return false; - } - tempImage[num]->SetPosition(tempX, tempY); - tempImage[num]->SetSrc(imageSrc); - Add(tempImage[num]); - - return true; -} - -bool TempReport::TempInitImage(void) -{ - if (!InitSimilarImage(SET_ZERO, TEMP_IMAGE_ONE_X, TEMP_IMAGE_ONE_Y, TEMP_LITTLE_MEASURE)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport InitSimilarImage false"); - return false; - } - if (!InitSimilarImage(SET_ONE, TEMP_IMAGE_TWO_X, TEMP_IMAGE_TWO_Y, TEMP_LIT_TIP)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport InitSimilarImage false"); - return false; - } - if (!InitSimilarImage(SET_TWO, TEMP_IMAGE_THREE_X, TEMP_IMAGE_THREE_Y, TEMP_POINT)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport InitSimilarImage false"); - return false; - } - if (!InitSimilarImage(SET_THREE, TEMP_IMAGE_FOUR_X, TEMP_IMAGE_THREE_Y, TEMP_REV_POINTER)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport InitSimilarImage false"); - return false; - } - if (!InitSimilarImage(SET_FOUR, TEMP_FOUR_X, TEMP_IMAGE_FOUR_Y, TEMP_REPORT)) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport InitSimilarImage false"); - return false; - } - - return true; -} - -bool TempReport::InitView(void *caller) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempReport::InitView"); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::InitView TempPresenter::GetInstance() nullptr"); - return false; - } - UNUSED(caller); - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - - SetOnDragListener(listener); - SetDraggable(true); - SetTouchable(true); - - if (!TempInitImage()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::InitView TempInitImage false"); - return false; - } - if (!SetBasicLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::InitView SetBasicLabel false"); - return false; - } - if (!SetAppendLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::InitView SetAppendLabel false"); - return false; - } - return true; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempStudyAbout.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempStudyAbout.cpp deleted file mode 100644 index 4c1a8edc9..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempStudyAbout.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include -#include "temperature/include/TempStudyAbout.h" - -namespace OHOS { -static TempStudyAbout *g_tempStudyAbout = nullptr; - -static const int16 TEMP_LABEL_ONE_X = 150; -static const int16 TEMP_LABEL_ONE_Y = 50; -static const int16 TEMP_LABEL_ONE_WIDTH = 150; -static const int16 TEMP_LABEL_ONE_HEIGHT = 45; -static const int16 TEMP_LABEL_TWO_X = 45; -static const int16 TEMP_LABEL_TWO_Y = 110; -static const int16 TEMP_LABEL_TWO_WIDTH = 390; -static const int16 TEMP_LABEL_TWO_HEIGHT = 200; -static const int16 TEMP_LABEL_THREE_Y = 310; -static const int16 TEMP_LABEL_FOUR_Y = 520; -static const int16 LABEL_FOUR_HEIGHT = 310; -static const int16 TEMP_LABEL_FIVE_Y = 843; -static const int16 TEMP_LABEL_FONT = 35; -static const int16 TEMP_LABEL_TIP_FONT = 28; -static const char *TEMP_STUDY_LABEL_ONE = (char *)"关于研究"; -static const char *TEMP_STUDY_LABEL_TWO = (char *)"本功能通过内置温度传感器测量腕部皮肤温度,主要研究腕部皮肤温度和体温的关系"; -static const char *TEMP_STUDY_LABEL_THREE = (char *)"本功能用于18岁以上健康人群测量运动过程,及之后腕部皮肤温度和体温的变化。"; -static const char *TEMP_STUDY_LABEL_FOUR = (char *)"测量需佩戴10分钟以上,且容易受到环境因素影响。目前达不到水银体温计精度,测量结果仅供参考,不作为医疗诊断依据。"; -static const char *TEMP_STUDY_LABEL_FIVE = (char *)"加入研究时间2022/3/84:16:35OPM"; - -TempStudyAbout::TempStudyAbout() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::TempStudyAbout"); - g_tempStudyAbout = this; -} - -TempStudyAbout::~TempStudyAbout() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::~TempStudyAbout"); - RemoveAll(); - int8 num; - for (num = SET_ZERO; num < SET_FIVE; num++) { - if (tempLabel[num] != nullptr) { - delete tempLabel[num]; - tempLabel[num] = nullptr; - } - } - g_tempStudyAbout = nullptr; -} - -TempStudyAbout *TempStudyAbout::GetInstance(void) -{ - return g_tempStudyAbout; -} - -typedef struct { - int16 labelNum; - int16 x; - int16 y; - int16 width; - int16 height; - char* name; - int16 font; - const char* text; -} TempStudyItem; - -static const TempStudyItem tempStudyItem[] = { - { SET_ZERO, TEMP_LABEL_ONE_X, TEMP_LABEL_ONE_Y, TEMP_LABEL_ONE_WIDTH, TEMP_LABEL_ONE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_ONE }, - { SET_ONE, TEMP_LABEL_TWO_X, TEMP_LABEL_TWO_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_TWO }, - { SET_TWO, TEMP_LABEL_TWO_X, TEMP_LABEL_THREE_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_THREE }, - { SET_THREE, TEMP_LABEL_TWO_X, TEMP_LABEL_FOUR_Y, TEMP_LABEL_TWO_WIDTH, LABEL_FOUR_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_FOUR }, - { SET_FOUR, TEMP_LABEL_TWO_X, TEMP_LABEL_FIVE_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_TIP_FONT, TEMP_STUDY_LABEL_FIVE }, -}; - -bool TempStudyAbout::SetBasicLabel(void) -{ - for (int num = 0; num <= SET_FOUR; num++) { - tempLabel[tempStudyItem[num].labelNum] = new UILabel(); - if (tempLabel[tempStudyItem[num].labelNum] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::InitLittleTip new tempLabel[%d] fail", - tempStudyItem[num].labelNum); - return false; - } - tempLabel[tempStudyItem[num].labelNum]->SetPosition(tempStudyItem[num].x, tempStudyItem[num].y, - tempStudyItem[num].width, tempStudyItem[num].height); - tempLabel[tempStudyItem[num].labelNum]->SetFont(tempStudyItem[num].name, tempStudyItem[num].font); - tempLabel[tempStudyItem[num].labelNum]->SetText(tempStudyItem[num].text); - Add(tempLabel[tempStudyItem[num].labelNum]); - } - return true; -} - -bool TempStudyAbout::SetAppendLabel(void) -{ - if (tempLabel[SET_FOUR] == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::SetAppendLabel new tempLabel[SET_FOUR] fail"); - return false; - } - tempLabel[SET_FOUR]->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - tempLabel[SET_FOUR]->SetTextColor(Color::Gray()); - - return true; -} - -bool TempStudyAbout::InitStudyAbout(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::InitStudyAbout"); - SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - SetThrowDrag(true); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::InitStudyAbout TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetOnDragListener(listener); - SetHorizontalScrollState(false); - SetScrollBlankSize(50); // 50:font size - SetDraggable(true); - SetTouchable(true); - - if (!SetBasicLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::InitStudyAbout SetBasicLabel() false"); - return false; - } - if (!SetAppendLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::InitStudyAbout SetAppendLabel() false"); - return false; - } - return true; -} - -void TempStudyAbout::RefreshStudy(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::RefreshStudy"); - ScrollBy(0, TEMP_LABEL_ONE_Y - tempLabel[0]->GetY()); -} -} diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempWarn.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempWarn.cpp deleted file mode 100644 index 985b0fe30..000000000 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/temperature/src/TempWarn.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2022-2022. All rights reserved. - * Description: temperature - * Author: - * Create: 2022-02-15 - */ - -#include "UiConfig.h" -#include -#include "temperature/include/TempWarn.h" - -namespace OHOS { -static TempWarn *g_tempWarn = nullptr; - -static const int16 TEMP_WARN_IMAGE_X = 182; -static const int16 TEMP_WARN_IMAGE_Y = 57; -static const int16 TEMP_WARN_BUTTON_X = 63; -static const int16 TEMP_WARN_BUTTON_Y = 366; -static const int16 TEMP_WARN_BUTTON_WIDHT = 320; -static const int16 TEMP_WARN_BUTTON_HEIGHT = 101; -static const int16 TEMP_WARN_LABEL_FONT = 35; -static const int16 TEMP_WARN_LABEL_X = 60; -static const int16 TEMP_WARN_LABEL_Y = 160; -static const int16 TEMP_WARN_LABEL_WIDTH = 350; -static const int16 TEMP_WARN_LABEL_HEIGHT = 200; -static const char *TEMP_WARN_BUTTON_TEXT = (char*)"知道了"; -static const char *TEMP_WARN_COLD_LABEL = (char*)"当前体温温度过低(低于35℃),请检测佩戴状态并做好重复测量"; -static const char *TEMP_WARN_HOT_LABEL = (char*)"当前体温温度过高(高于37.2℃),请检测佩戴状态并做好重复测量"; -static const char *TEMP_WARN_ENVIR = (char*)"检测到手表周围温度波动。可能是受环境变化、高功耗应用、佩戴郭松、手表沾水等影响,请进行相应调整并等待10分钟在进行测量"; - -TempWarn::TempWarn() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempWarn::TempWarn"); - g_tempWarn = this; -} - -TempWarn::~TempWarn() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempWarn::~TempWarn"); - RemoveAll(); - if (tempImage != nullptr) { - delete tempImage; - tempImage = nullptr; - } - if (tempButton != nullptr) { - delete tempButton; - tempButton = nullptr; - } - if (tempLabel != nullptr) { - delete tempLabel; - tempLabel = nullptr; - } - g_tempWarn = nullptr; -} - -TempWarn *TempWarn::GetInstance(void) -{ - return g_tempWarn; -} - -bool TempWarn::TempInitImage(void) -{ - tempImage = new UIImageView(); - if (tempImage == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::InitRemindWear new tempImage fail"); - return false; - } - tempImage->SetPosition(TEMP_WARN_IMAGE_X, TEMP_WARN_IMAGE_Y); - tempImage->SetSrc(TEMP_WARN); - Add(tempImage); - - return true; -} - -bool TempWarn::TempInitButton(void) -{ - tempButton = new UILabelButton(); - if (tempButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::InitMeasure new tempButton fail"); - return false; - } - tempButton->SetPosition(TEMP_WARN_BUTTON_X, TEMP_WARN_BUTTON_Y, TEMP_WARN_BUTTON_WIDHT, TEMP_WARN_BUTTON_HEIGHT); - tempButton->SetText(TEMP_WARN_BUTTON_TEXT); - tempButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_WARN_LABEL_FONT); - tempButton->SetViewId(TEMP_WARN_ID); - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::TempPresenter::GetInstance(); - tempButton->SetOnClickListener(clickListener); - tempButton->SetTextColor(OHOS::TempPresenter::GetInstance()->CyanColor()); - tempButton->SetImageSrc(PNG_NEW_DEVICE, PNG_NEW_DEVICE); - Add(tempButton); - - return true; -} - -bool TempWarn::TempInitLabel(void) -{ - tempLabel = new UILabel(); - if (tempLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::TempInitLabel new tempLabel fail"); - return false; - } - tempLabel->SetPosition(TEMP_WARN_LABEL_X, TEMP_WARN_LABEL_Y, TEMP_WARN_LABEL_WIDTH, TEMP_WARN_LABEL_HEIGHT); - tempLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, TEMP_WARN_LABEL_FONT); - tempLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); - Add(tempLabel); - - return true; -} - -bool TempWarn::InitTempWarn(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempWarn::InitTempWarn"); - SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - SetThrowDrag(true); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::InitTempWarn TempPresenter::GetInstance() nullptr"); - return false; - } - UIView::OnDragListener *listener = static_cast(TempPresenter::GetInstance()); - SetOnDragListener(listener); - SetDraggable(true); - SetTouchable(true); - - if (!TempInitImage()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::InitTempWarn TempInitImage() false"); - return false; - } - if (!TempInitButton()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::InitTempWarn TempInitButton() false"); - return false; - } - if (!TempInitLabel()) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::InitTempWarn TempInitLabel() false"); - return false; - } - - return true; -} - -void TempWarn::RefreshTempWarn(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempWarn::RefreshTempWarn"); - if (TempPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::RefreshTempWarn GetInstance nullptr"); - return; - } - if (tempLabel == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::RefreshTempWarn tempLabel nullptr"); - return; - } - int8 tempListener = TempPresenter::GetInstance()->GetTempListen(); - if (tempListener == 0) { - tempLabel->SetText(TEMP_WARN_COLD_LABEL); - } else if (tempListener == 1) { - tempLabel->SetText(TEMP_WARN_HOT_LABEL); - } else { - tempLabel->SetText(TEMP_WARN_ENVIR); - } - return; -} -} \ No newline at end of file diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingEnddataPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingEnddataPresenter.h index 6dfd2fd96..3d3e7279d 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingEnddataPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingEnddataPresenter.h @@ -32,9 +32,7 @@ namespace OHOS virtual ~TraingEnddataPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; void NavigateBack(); // 返回函数 static TraingEnddataPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingNomalPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingNomalPresenter.h index d8191b437..93d9b8f64 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingNomalPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingNomalPresenter.h @@ -21,9 +21,7 @@ namespace OHOS virtual ~TraingNomalPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; void NavigateBack(); void OnTickEvent() override; void Notify() override {} diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingPresenter.h index 87fcd1449..1328565ee 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/include/TraingPresenter.h @@ -32,9 +32,7 @@ namespace OHOS virtual ~TraingPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; void NavigateBack(); static TraingPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingEnddataPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingEnddataPresenter.cpp index e238d92ab..4505ead82 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingEnddataPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingEnddataPresenter.cpp @@ -40,22 +40,11 @@ namespace OHOS void TraingEnddataPresenter::OnStart() { - Presenter::OnStart(); - } - - void TraingEnddataPresenter::OnPause() - { - Presenter::OnPause(); } void TraingEnddataPresenter::OnResume() { - Presenter::OnResume(); - } - - void TraingEnddataPresenter::OnStop() - { - Presenter::OnStop(); + RootView::GetInstance()->SetOnKeyActListener(this); } void TraingEnddataPresenter::NavigateBack() diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingNomalPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingNomalPresenter.cpp index f02755c57..aa5f54095 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingNomalPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingNomalPresenter.cpp @@ -57,20 +57,9 @@ namespace OHOS } Presenter::OnStart(); } - - void TraingNomalPresenter::OnPause(void){ - Presenter::OnPause(); - } - void TraingNomalPresenter::OnResume(void) { - Presenter::OnResume(); - } - - void TraingNomalPresenter::OnStop(void) - { - - Presenter::OnStop(); + RootView::GetInstance()->SetOnKeyActListener(this); } // 回退逻辑 void TraingNomalPresenter::NavigateBack() diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingPresenter.cpp index 7887a3d45..e38c91b54 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingPresenter.cpp @@ -49,11 +49,11 @@ TraingPresenter *TraingPresenter::GetInstance() { return g_pTraingPresenter; } void TraingPresenter::OnStart() { Presenter::OnStart(); } -void TraingPresenter::OnPause(void) { Presenter::OnPause(); } -void TraingPresenter::OnResume(void) { Presenter::OnResume(); } +void TraingPresenter::OnResume(void) { + RootView::GetInstance()->SetOnKeyActListener(this); + } -void TraingPresenter::OnStop(void) { Presenter::OnStop(); } // 回退函数 [ Slice 的 traingview {右滑只能回到applist}] void TraingPresenter::NavigateBack() { NativeAbility::GetInstance().ChangeSlice( diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingSetPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingSetPresenter.cpp index 80c61ecf4..a49df84b3 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingSetPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/src/TraingSetPresenter.cpp @@ -64,14 +64,10 @@ namespace OHOS void TraingSetPresenter::OnResume(void) { - - Presenter::OnResume(); } void TraingSetPresenter::OnStop(void) { - - Presenter::OnStop(); } void TraingSetPresenter::NavigateBack() { diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSPresenter.h index 0cc44acb3..df7dfd546 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSPresenter.h @@ -19,9 +19,7 @@ namespace OHOS virtual ~TraingGPSPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static TraingGPSPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSbackPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSbackPresenter.h index 6e260263e..a5aad8b70 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSbackPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSbackPresenter.h @@ -18,9 +18,7 @@ namespace OHOS virtual ~TraingGPSbackPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static TraingGPSbackPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSlackPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSlackPresenter.h index cf3f87826..b88f70c99 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSlackPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSlackPresenter.h @@ -19,9 +19,7 @@ namespace OHOS virtual ~TraingGPSlackPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static TraingGPSlackPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSnotePresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSnotePresenter.h index c7a5704f2..98fd93515 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSnotePresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSnotePresenter.h @@ -18,9 +18,7 @@ namespace OHOS virtual ~TraingGPSnotePresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static TraingGPSnotePresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSsetPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSsetPresenter.h index 0bb93f533..7b51935fc 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSsetPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/include/TraingGPSsetPresenter.h @@ -18,9 +18,7 @@ namespace OHOS virtual ~TraingGPSsetPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; static TraingGPSsetPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSPresenter.cpp index c5d575d70..2a82ae1f6 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSPresenter.cpp @@ -36,27 +36,15 @@ namespace OHOS void TraingGPSPresenter::OnStart() { - - Presenter::OnStart(); } - void TraingGPSPresenter::OnPause(void) - { - - Presenter::OnPause(); - } + void TraingGPSPresenter::OnResume(void) { - - Presenter::OnResume(); } - void TraingGPSPresenter::OnStop(void) - { - - Presenter::OnStop(); - } + bool TraingGPSPresenter::OnDrag(UIView &view, const DragEvent &event) { return true; diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSbackPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSbackPresenter.cpp index fe970f072..31a0ddc49 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSbackPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSbackPresenter.cpp @@ -35,26 +35,10 @@ namespace OHOS void TraingGPSbackPresenter::OnStart() { - - Presenter::OnStart(); - } - - void TraingGPSbackPresenter::OnPause(void) - { - - Presenter::OnPause(); } void TraingGPSbackPresenter::OnResume(void) { - - Presenter::OnResume(); - } - - void TraingGPSbackPresenter::OnStop(void) - { - - Presenter::OnStop(); } bool TraingGPSbackPresenter::OnDrag(UIView &view, const DragEvent &event) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSlackPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSlackPresenter.cpp index 92f54f2fb..a41a5ed5a 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSlackPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSlackPresenter.cpp @@ -36,26 +36,9 @@ namespace OHOS void TraingGPSlackPresenter::OnStart() { - - Presenter::OnStart(); - } - - void TraingGPSlackPresenter::OnPause(void) - { - - Presenter::OnPause(); } - void TraingGPSlackPresenter::OnResume(void) { - - Presenter::OnResume(); - } - - void TraingGPSlackPresenter::OnStop(void) - { - - Presenter::OnStop(); } bool TraingGPSlackPresenter::OnDrag(UIView &view, const DragEvent &event) { diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSlostPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSlostPresenter.cpp index f8a81c046..d30151751 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSlostPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSlostPresenter.cpp @@ -47,8 +47,6 @@ namespace OHOS void TraingGPSlostPresenter::OnResume(void) { - - Presenter::OnResume(); } void TraingGPSlostPresenter::OnStop(void) diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSnotePresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSnotePresenter.cpp index 008085a3d..e3682258a 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSnotePresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSnotePresenter.cpp @@ -38,27 +38,12 @@ namespace OHOS void TraingGPSnotePresenter::OnStart() { - - Presenter::OnStart(); - } - - void TraingGPSnotePresenter::OnPause(void) - { - - Presenter::OnPause(); } void TraingGPSnotePresenter::OnResume(void) { - - Presenter::OnResume(); - } - - void TraingGPSnotePresenter::OnStop(void) - { - - Presenter::OnStop(); } + bool TraingGPSnotePresenter::OnDrag(UIView &view, const DragEvent &event) { return true; diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSsetPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSsetPresenter.cpp index 1d7eb301a..9dec26aa9 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSsetPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_GPS/src/TraingGPSsetPresenter.cpp @@ -41,27 +41,12 @@ namespace OHOS void TraingGPSsetPresenter::OnStart() { - - Presenter::OnStart(); - } - - void TraingGPSsetPresenter::OnPause(void) - { - - Presenter::OnPause(); } void TraingGPSsetPresenter::OnResume(void) { - - Presenter::OnResume(); - } - - void TraingGPSsetPresenter::OnStop(void) - { - - Presenter::OnStop(); } + bool TraingGPSsetPresenter::OnDrag(UIView &view, const DragEvent &event) { return true; diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/include/TraingCardPresenter.h b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/include/TraingCardPresenter.h index 51935d4b6..e907a86c5 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/include/TraingCardPresenter.h +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/include/TraingCardPresenter.h @@ -46,9 +46,7 @@ public: static TraingCardPresenter *GetInstance(void); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; void OnTickEvent() override{}; void Notify() override {} diff --git a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp index 2b155b7f2..2e97638a4 100644 --- a/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/n9/nativeapp/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -76,23 +76,11 @@ void TraingCardPresenter::OnStart() { // ScreenAlwaysOnCtr(OPEN_SCREEN_ALWAYS_ON); // 长亮屏 } -void TraingCardPresenter::OnPause(void) { - - Presenter::OnPause(); -} - void TraingCardPresenter::OnResume(void) { - Presenter::OnResume(); RootView::GetInstance()->SetOnKeyActListener(this); } -void TraingCardPresenter::OnStop(void) { - - Presenter::OnStop(); - // ScreenAlwaysOnCtr(CANCEL_SCREEN_ALWAYS_ON); // 长亮屏 -} - bool TraingCardPresenter::OnDrag(UIView &view, const DragEvent &event) { UNUSED(view); return true; diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index d19345931..05f288a34 100644 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -1013,6 +1013,7 @@ target = { 'SUPPORT_GYRO_SERVICE', 'GYRO_SH5001', 'SUPPORT_AI_SERVICE', + 'SUPPORT_CHINA_MOBILE_AI_REGULATION', ], #添加自定义应用 'ram_component': [ diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/pointer_input_device.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/pointer_input_device.cpp index 4994c4e0f..c994bccbb 100644 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/pointer_input_device.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/pointer_input_device.cpp @@ -263,9 +263,9 @@ void PointerInputDevice::DispatchDragStartEvent() DispatchCancelEvent(); } // HISI delete end - printf("=====PointerInputDevice::DispatchDragStartEvent absx(%d) limitx(%d) absy(%d) limity(%d) \r\n", - MATH_ABS(dragLen_.x),DRAG_LIMIT_X, - MATH_ABS(dragLen_.y),DRAG_LIMIT_Y); + // printf("=====PointerInputDevice::DispatchDragStartEvent absx(%d) limitx(%d) absy(%d) limity(%d) \r\n", + // MATH_ABS(dragLen_.x),DRAG_LIMIT_X, + // MATH_ABS(dragLen_.y),DRAG_LIMIT_Y); // Send Drag Begin Event. DragEvent evt(curPos_, lastPos_, dragLen_); -- 2.17.1