From: Caisking <3449750381@qq.com> Date: Fri, 12 Apr 2024 10:38:13 +0000 (+0800) Subject: 训练结束弹窗Slice删除 X-Git-Tag: release_V1.2.70_20241020_135402~1204 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=bc605f5a9d7541545a258a729a23375d0163d8b0;p=mirrors%2FFD230.git 训练结束弹窗Slice删除 --- diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 6bcb1e112..909aea238 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -479,10 +479,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingSetTimePresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingSetCaluliView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingSetCaluliPresenter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnoteView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnotePresenter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnote2View.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEndnote2Presenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEnddataView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingEnddataPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/traing/src/TraingWinView.cpp diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h index f3c6a7bb8..f9630e65e 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/AppViewIDs.h @@ -80,8 +80,6 @@ typedef enum : uint16_t VIEW_TRAININGSETDIST, // 设置训练路程 VIEW_TRAININGSETSTEP, // 设置训练步数 VIEW_TRAININGCRAD, // 训练控制卡片 - VIEW_TRAININGENDNOTE, // 结束训练提醒 - VIEW_TRAININGENDNOTE2, // 结束训练时间太短 VIEW_TRAININGENDDATA, // 训练结束详细数据 VIEW_TRAININGSTRONG, // 训练强度介绍 VIEW_TRAININGWIN, // 目标达成 diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h index 3062b8e46..f0bb3a870 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/NativeLauncher.h @@ -74,8 +74,6 @@ namespace OHOS void InitTraingSetDistSlice(void); void InitTraingSetStepSlice(void); void InitTraingCardSlice(void); - void InitTraingEndnoteSlice(void); - void InitTraingEndnote2Slice(void); void InitTraingEnddataSlice(void); void InitTraingWinSlice(void); diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp index bc4002db7..16438556a 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/fd230app/nativelauncher/src/NativeLauncher.cpp @@ -172,10 +172,6 @@ #include "traing/include/TraingSetDistView.h" #include "traing/include/TraingSetSeptPresenter.h" #include "traing/include/TraingSetSeptView.h" -#include "traing/include/TraingEndnotePresenter.h" -#include "traing/include/TraingEndnoteView.h" -#include "traing/include/TraingEndnote2Presenter.h" -#include "traing/include/TraingEndnote2View.h" #include "traing/include/TraingEnddataPresenter.h" #include "traing/include/TraingEnddataView.h" #include "traing/include/TraingStrongPresenter.h" @@ -313,8 +309,6 @@ namespace OHOS {VIEW_TRAININGSETDIST, &NativeLauncher::InitTraingSetDistSlice}, // 设置目标距离 {VIEW_TRAININGSETSTEP, &NativeLauncher::InitTraingSetStepSlice}, // 设置目标步数 {VIEW_TRAININGCRAD, &NativeLauncher::InitTraingCardSlice}, // 训练卡片 - {VIEW_TRAININGENDNOTE, &NativeLauncher::InitTraingEndnoteSlice}, // 训练结束提醒 - {VIEW_TRAININGENDNOTE2, &NativeLauncher::InitTraingEndnote2Slice}, // 训练结束时间太短提醒 {VIEW_TRAININGENDDATA, &NativeLauncher::InitTraingEnddataSlice}, // 训练结束详细数据 {VIEW_TRAININGWIN, &NativeLauncher::InitTraingWinSlice}, // 训练目标达成 {VIEW_TRAINING_RECORD, &NativeLauncher::InitTraingRecordSlice}, // 训练目标达成 @@ -954,16 +948,6 @@ namespace OHOS NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGCRAD, traingcardview); } - void NativeLauncher::InitTraingEndnoteSlice(void) - { - SliceProxy *traingendnoteview = new AbilitySliceProxy; - NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGENDNOTE, traingendnoteview); - } - void NativeLauncher::InitTraingEndnote2Slice(void) - { - SliceProxy *traingendnote2view = new AbilitySliceProxy; - NativeAbility::GetInstance().AddSliceProxy(VIEW_TRAININGENDNOTE2, traingendnote2view); - } void NativeLauncher::InitTraingEnddataSlice(void) { SliceProxy *traingenddataview = new AbilitySliceProxy; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2Presenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2Presenter.h deleted file mode 100644 index a2e64be13..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2Presenter.h +++ /dev/null @@ -1,34 +0,0 @@ - -#ifndef _TraingEndnote2_PRESENTER_H -#define _TraingEndnote2_PRESENTER_H - -#include "Presenter.h" -#include "TraingEndnote2View.h" - -namespace OHOS -{ - class TraingEndnote2View; - - class TraingEndnote2Presenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener - { - public: - TraingEndnote2Presenter(); - virtual ~TraingEndnote2Presenter(); - - void OnStart() override; - void OnPause() override; - void OnResume() override; - void OnStop() override; - static TraingEndnote2Presenter *GetInstance(); - - private: - // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; - bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView &view, const DragEvent &event) override; - // bool OnDragEnd(UIView& view, const DragEvent& event) override; - }; -} // namespace OHOS - -#endif // SLEEPDETAIL_PRESENTER_H \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2View.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2View.h deleted file mode 100644 index 49108ce6f..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnote2View.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _TraingEndnote2_VIEW_H -#define _TraingEndnote2_VIEW_H - -#include "BaseView.h" -#include "View.h" -#include -#include "components/ui_view_group.h" -#include "components/ui_label.h" -#include "components/ui_label_ext.h" -#include "components/ui_image_view.h" -#include "components/ui_button.h" -#include "components/ui_image_animator.h" -#include "components/ui_label_button_ext.h" -#include "components/ui_chart.h" -#include "components/ui_list.h" -#include "components/icon_adapter.h" -#include "wearable_log.h" -#include "ohos_types.h" -#include "components/ui_card_page.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" -#include "TraingEndnote2Presenter.h" -namespace OHOS -{ -#define BUTTONNO "button1" -#define BUTTONYES "button2" - - class TraingEndnote2Presenter; - class TraingEndnote2View : public View - { - - public: - TraingEndnote2View(); - virtual ~TraingEndnote2View(); - static TraingEndnote2View *GetInstance(void); - - void OnStart() override; - void OnSetUpView() override; - void OnTearDownView() override; - void OnStop() override; - void InitView(); - void DeInit(); - - void PreLoad(void); - - // 通过函数改变 - void SetLabel(); - void SetButton(); - - private: - UIView::OnDragListener *draglistener{nullptr}; - TraingEndnote2View(TraingEndnote2View &&) = delete; - TraingEndnote2View &operator=(TraingEndnote2View &&) = delete; - - UIViewGroup *container_ = nullptr; - - UILabelExt *label1_ = nullptr; - UILabelExt *label2_ = nullptr; - - UIButton *button1_ = nullptr; - UIButton *button2_ = nullptr; - bool viewiInitStatus{false}; - }; -} // namespace OHOS -#endif // TraingEndnote2_PRESENTER_H diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnotePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnotePresenter.h deleted file mode 100644 index 219e3972d..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnotePresenter.h +++ /dev/null @@ -1,34 +0,0 @@ - -#ifndef _TraingEndnote_PRESENTER_H -#define _TraingEndnote_PRESENTER_H - -#include "Presenter.h" -#include "TraingEndnoteView.h" - -namespace OHOS -{ - class TraingEndnoteView; - - class TraingEndnotePresenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener - { - public: - TraingEndnotePresenter(); - virtual ~TraingEndnotePresenter(); - - void OnStart() override; - void OnPause() override; - void OnResume() override; - void OnStop() override; - static TraingEndnotePresenter *GetInstance(); - - private: - // 因为继承了OnClickListener,所以有OnClick属性,至于参数,原函数也这样直接继承; - bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView &view, const DragEvent &event) override; - //bool OnDragEnd(UIView& view, const DragEvent& event) override; - }; -} // namespace OHOS - -#endif // SLEEPDETAIL_PRESENTER_H \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnoteView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnoteView.h deleted file mode 100644 index c8cc0cfb9..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEndnoteView.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef _TraingEndnote_VIEW_H -#define _TraingEndnote_VIEW_H - -#include "BaseView.h" -#include "View.h" -#include -#include "components/ui_view_group.h" -#include "components/ui_label.h" -#include "components/ui_label_ext.h" -#include "components/ui_image_view.h" -#include "components/ui_button.h" -#include "components/ui_image_animator.h" -#include "components/ui_label_button_ext.h" -#include "components/ui_chart.h" -#include "components/ui_list.h" -#include "components/icon_adapter.h" -#include "wearable_log.h" -#include "ohos_types.h" -#include "components/ui_card_page.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" -#include "TraingEndnotePresenter.h" -namespace OHOS -{ -#define BUTTONNO "button1" -#define BUTTONYES "button2" - - class TraingEndnotePresenter; - class TraingEndnoteView : public View - { - - public: - TraingEndnoteView(); - virtual ~TraingEndnoteView(); - static TraingEndnoteView *GetInstance(void); - - void OnStart() override; - void OnSetUpView() override; - void OnTearDownView() override; - void OnStop() override; - void InitView(); - void DeInit(); - - void InitList(); - void PreLoad(void); - - // 通过函数改变 - void SetLabel(); - void SetButton(); - - private: - UIView::OnDragListener *draglistener{nullptr}; - TraingEndnoteView(TraingEndnoteView &&) = delete; - TraingEndnoteView &operator=(TraingEndnoteView &&) = delete; - - UIViewGroup *container_ = nullptr; - - UILabelExt *label1_ = nullptr; - UILabelExt *label2_ = nullptr; - - UIButton *button1_ = nullptr; - UIButton *button2_ = nullptr; - bool viewiInitStatus{false}; - }; -} // namespace OHOS -#endif // TraingEndnote_PRESENTER_H diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2Presenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2Presenter.cpp deleted file mode 100644 index 79a6f90af..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2Presenter.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "AppViewIDs.h" -#include "components/ui_label_ext.h" -#include "language/font/ui_resource_string.h" -#include "NativeAbility.h" - -#include -#include -#include -#include "traing/include/TraingEndnote2Presenter.h" -// #include "TraingEndnote2View.h" - -namespace OHOS -{ - - // 当前Presenter属性实例化的内存指针 - static TraingEndnote2Presenter *g_pTraingEndnote2Presenter = nullptr; - - TraingEndnote2Presenter::TraingEndnote2Presenter() - { - - g_pTraingEndnote2Presenter = this; - } - - TraingEndnote2Presenter::~TraingEndnote2Presenter() - { - - g_pTraingEndnote2Presenter = nullptr; - } - - TraingEndnote2Presenter *TraingEndnote2Presenter::GetInstance() - { - - return g_pTraingEndnote2Presenter; - } - - void TraingEndnote2Presenter::OnStart() - { - - Presenter::OnStart(); - } - - void TraingEndnote2Presenter::OnPause(void) - { - - Presenter::OnPause(); - } - - void TraingEndnote2Presenter::OnResume(void) - { - - Presenter::OnResume(); - } - - void TraingEndnote2Presenter::OnStop(void) - { - - Presenter::OnStop(); - } - - bool TraingEndnote2Presenter::OnDrag(UIView &view, const DragEvent &event) - { - - // if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM) - // { - // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA); - // } - UNUSED(view); - return true; - } - - bool TraingEndnote2Presenter::OnClick(UIView &view, const ClickEvent &event) - { - - // 根据控件id查找是哪个控件触发了点击回调 - if (strcmp(view.GetViewId(), BUTTONNO) == 0) - { - // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); - } - if (strcmp(view.GetViewId(), BUTTONYES) == 0) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAINING); - } - return true; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2View.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2View.cpp deleted file mode 100644 index 635a0cf40..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnote2View.cpp +++ /dev/null @@ -1,140 +0,0 @@ - -#include "traing/include/TraingEndnote2View.h" - -#include "common/image_cache_manager.h" -#include "components/ui_label_ext.h" -#include "language/font/ui_resource_string.h" -#include "UiConfig.h" -#include "ui_resource_image.h" -#include -#include "components/ui_button.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -namespace OHOS -{ - - static TraingEndnote2View *g_pTraingEndnote2View{nullptr}; - - TraingEndnote2View::TraingEndnote2View() - { - g_pTraingEndnote2View = this; - } - - TraingEndnote2View::~TraingEndnote2View() - { - DeInit(); - g_pTraingEndnote2View = nullptr; - } - - TraingEndnote2View *TraingEndnote2View::GetInstance() - { - - return g_pTraingEndnote2View; - } - - /* InitView:初始化界面*/ - void TraingEndnote2View ::InitView() - { - if (container_ == nullptr) - { - container_ = new UIViewGroup(); - container_->SetPosition(0, 0, 466, 466); - container_->SetStyle(STYLE_BACKGROUND_OPA, 0); - } - - // 初始化Lable - TraingModel::GetInstance()->InitLabel(label1_, 203, 52, 90, 35, "label1", "注意", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabel(label2_, 56, 167, 60, 40, "label2", "当前运动量太小,无法记录\n是否结束运动", DEFAULT_VECTOR_FONT_FILENAME, 30); - - container_->Add(label1_); - container_->Add(label2_); - - TraingModel::GetInstance()->InitButton(button1_, 111, 299, 100, 100, BUTTONNO); - button1_->SetOnClickListener(static_cast(TraingEndnote2Presenter::GetInstance())); - // Set additional property - button1_->SetImageSrc(NO_IMAGE, NO_IMAGE); - - TraingModel::GetInstance()->InitButton(button2_, 256, 299, 100, 100, BUTTONYES); - button2_->SetOnClickListener(static_cast(TraingEndnote2Presenter::GetInstance())); - // Set additional property - button2_->SetImageSrc(YES_IMAGE, YES_IMAGE); - - container_->Add(button1_); - container_->Add(button2_); - } - - /* DeInit:删除组件 */ - void TraingEndnote2View::DeInit() - { - container_->RemoveAll(); - UIView *view = static_cast(container_)->GetChildrenHead(); - while (view != nullptr) - { - UIView *tempView = view; - view = view->GetNextSibling(); - if (tempView->GetParent()) - { - static_cast(tempView->GetParent())->Remove(tempView); - } - delete tempView; - } - delete container_; - container_ = nullptr; - } - - void TraingEndnote2View::PreLoad(void) - { - if (!viewiInitStatus) - { - InitView(); - viewiInitStatus = true; - } - } - void TraingEndnote2View::OnStart() - { - container_ = new UIViewGroup(); - if (container_ == nullptr) - { - return; - } - container_->SetPosition(0, 0); - container_->SetWidth(Screen::GetInstance().GetWidth()); - container_->SetHeight(Screen::GetInstance().GetHeight()); - - // 创建 draglistener 实例并设置为拖动监听器 - UIView::OnDragListener *draglistener = static_cast(TraingEndnote2Presenter::GetInstance()); - if (draglistener == nullptr) - { - return; - } - container_->SetOnDragListener(draglistener); - - container_->SetTouchable(true); - container_->SetDraggable(true); - - PreLoad(); - RootView::GetInstance()->Add(container_); - } - - void TraingEndnote2View::OnSetUpView() - { - - View::OnSetUpView(); - Draw(); - } - - void TraingEndnote2View::OnTearDownView() - { - - View::OnTearDownView(); - return; - } - - void TraingEndnote2View::OnStop() - { - View::OnStop(); - RootView::GetInstance()->RemoveAll(); - return; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnotePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnotePresenter.cpp deleted file mode 100644 index 9ae0f7a45..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnotePresenter.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "AppViewIDs.h" -#include "components/ui_label_ext.h" -#include"language/font/ui_resource_string.h" -#include "NativeAbility.h" - -#include -#include -#include -#include "traing/include/TraingEndnotePresenter.h" -// #include "TraingEndnoteView.h" - -namespace OHOS -{ - - // 当前Presenter属性实例化的内存指针 - static TraingEndnotePresenter *g_pTraingEndnotePresenter = nullptr; - - TraingEndnotePresenter::TraingEndnotePresenter() - { - - g_pTraingEndnotePresenter = this; - } - - TraingEndnotePresenter::~TraingEndnotePresenter() - { - - g_pTraingEndnotePresenter = nullptr; - } - - TraingEndnotePresenter *TraingEndnotePresenter::GetInstance() - { - - return g_pTraingEndnotePresenter; - } - - void TraingEndnotePresenter::OnStart() - { - - Presenter::OnStart(); - } - - void TraingEndnotePresenter::OnPause(void) - { - - Presenter::OnPause(); - } - - void TraingEndnotePresenter::OnResume(void) - { - - Presenter::OnResume(); - } - - void TraingEndnotePresenter::OnStop(void) - { - - Presenter::OnStop(); - } - - bool TraingEndnotePresenter::OnDrag(UIView &view, const DragEvent &event) - { - - // if (event.GetDragDirection() == DragEvent::DIRECTION_TOP_TO_BOTTOM) - // { - // NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGDATA); - // } - UNUSED(view); - return true; - } - - bool TraingEndnotePresenter::OnClick(UIView &view, const ClickEvent &event) - { - - // 根据控件id查找是哪个控件触发了点击回调 - if (strcmp(view.GetViewId(), BUTTONNO) == 0) - { - //NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGCONTROL); - } - if (strcmp(view.GetViewId(), BUTTONYES) == 0) - { - NativeAbility::GetInstance().ChangeSlice(VIEW_TRAININGWIN); - } - return true; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnoteView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnoteView.cpp deleted file mode 100644 index 59a6739a9..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEndnoteView.cpp +++ /dev/null @@ -1,140 +0,0 @@ - -#include "traing/include/TraingEndnoteView.h" - -#include "common/image_cache_manager.h" -#include "components/ui_label_ext.h" -#include "language/font/ui_resource_string.h" -#include "UiConfig.h" -#include "ui_resource_image.h" -#include -#include "components/ui_button.h" -#include "traing/include/TraingModel.h" -#include "traing/Training_UiConfig.h" - -namespace OHOS -{ - - static TraingEndnoteView *g_pTraingEndnoteView{nullptr}; - - TraingEndnoteView::TraingEndnoteView() - { - g_pTraingEndnoteView = this; - } - - TraingEndnoteView::~TraingEndnoteView() - { - DeInit(); - g_pTraingEndnoteView = nullptr; - } - - TraingEndnoteView *TraingEndnoteView::GetInstance() - { - - return g_pTraingEndnoteView; - } - - /* InitView:初始化界面*/ - void TraingEndnoteView ::InitView() - { - if (container_ == nullptr) - { - container_ = new UIViewGroup(); - container_->SetPosition(0, 0, 466, 466); - container_->SetStyle(STYLE_BACKGROUND_OPA, 0); - } - - // 初始化Lable - TraingModel::GetInstance()->InitLabel(label1_, 173, 52, 90, 35, "label1", "结束运动", DEFAULT_VECTOR_FONT_FILENAME, 30); - TraingModel::GetInstance()->InitLabel(label2_, 116, 187, 60, 40, "label2", "是否结束本次运动", DEFAULT_VECTOR_FONT_FILENAME, 26); - - container_->Add(label1_); - container_->Add(label2_); - - TraingModel::GetInstance()->InitButton(button1_, 111, 299, 100, 100, BUTTONNO); - button1_->SetOnClickListener(static_cast(TraingEndnotePresenter::GetInstance())); - // Set additional property - button1_->SetImageSrc(NO_IMAGE, NO_IMAGE); - - TraingModel::GetInstance()->InitButton(button2_, 256, 299, 100, 100, BUTTONYES); - button2_->SetOnClickListener(static_cast(TraingEndnotePresenter::GetInstance())); - // Set additional property - button2_->SetImageSrc(YES_IMAGE, YES_IMAGE); - - container_->Add(button1_); - container_->Add(button2_); - } - - /* DeInit:删除组件 */ - void TraingEndnoteView::DeInit() - { - container_->RemoveAll(); - UIView *view = static_cast(container_)->GetChildrenHead(); - while (view != nullptr) - { - UIView *tempView = view; - view = view->GetNextSibling(); - if (tempView->GetParent()) - { - static_cast(tempView->GetParent())->Remove(tempView); - } - delete tempView; - } - delete container_; - container_ = nullptr; - } - - void TraingEndnoteView::PreLoad(void) - { - if (!viewiInitStatus) - { - InitView(); - viewiInitStatus = true; - } - } - void TraingEndnoteView::OnStart() - { - container_ = new UIViewGroup(); - if (container_ == nullptr) - { - return; - } - container_->SetPosition(0, 0); - container_->SetWidth(Screen::GetInstance().GetWidth()); - container_->SetHeight(Screen::GetInstance().GetHeight()); - - // 创建 draglistener 实例并设置为拖动监听器 - UIView::OnDragListener *draglistener = static_cast(TraingEndnotePresenter::GetInstance()); - if (draglistener == nullptr) - { - return; - } - container_->SetOnDragListener(draglistener); - - container_->SetTouchable(true); - container_->SetDraggable(true); - - PreLoad(); - RootView::GetInstance()->Add(container_); - } - - void TraingEndnoteView::OnSetUpView() - { - - View::OnSetUpView(); - Draw(); - } - - void TraingEndnoteView::OnTearDownView() - { - - View::OnTearDownView(); - return; - } - - void TraingEndnoteView::OnStop() - { - View::OnStop(); - RootView::GetInstance()->RemoveAll(); - return; - } -} diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp index 5c7e9b46f..f8c437867 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/training_card/src/TraingCardPresenter.cpp @@ -187,7 +187,7 @@ namespace OHOS TrainingDetailView::GetInstance()->GetStepLabel()->SetText(stepsStr.c_str()); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ControlSensor--Calories: %s, Distance: %s, Steps: %s", calorieStr.c_str(), distanceStr.c_str(), stepsStr.c_str()); - + // 释放sportdata内存 } /*刷新time和data*/