VIEW_CALCULATOR, // 计算器
VIEW_SCHEDULE, // 日程
VIEW_SLEEPMODE, // sleep mode
- VIEW_SET_DESKTOP, // 设置主题
VIEW_THUNDER_BIRD, //雷鸟
VIEW_THUNDER_RECORD, //雷鸟录音
/* ---------------------------- 650-0723patch 合并 ---------------------------- */
hintsImageView->SetSrc(PNG_BLUETOOTH_HINTS_PATH);\r
hintsGroup->Add(hintsImageView);\r
\r
- GetRootContainer()->Add(hintsGroup);\r
+ AddViewToRootContainer(hintsGroup);\r
hintsGroup->SetVisible(false);\r
return;\r
}\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogView::CreateNoDataCallerLogViewGroup error");\r
return;\r
}\r
- GetRootContainer()->Add(group);\r
+ AddViewToRootContainer(group);\r
\r
if (!CreateCallerLogViewGroup()) {\r
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogView::CreateCallerLogViewGroup error");\r
return;\r
}\r
\r
- GetRootContainer()->Add(scrollview);\r
+ AddViewToRootContainer(scrollview);\r
\r
if (num == 0) {\r
group->SetVisible(true);\r
void MaingoalrView::OnStart()
{
-
AddViewToRootContainer(GetGoalPageView());
- // GetRootContainer()->Add(GetGoalPageView());
-
if (goalSwipeViewList != nullptr)
{
UIView::OnClickListener *goalOnClickListener = (UIView::OnClickListener *)OHOS::MaingoalPresenter::GetInstance();
goalSwipeViewList->SetOnDragListener(goalOnDragListener);
goalSwipeViewList->SetOnSwipeListener(goalOnSwipeListener);
}
-
- /* --------------------------------- 添加按键监听 --------------------------------- */
- // RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::MaingoalPresenter::GetInstance();
- //RootView::GetInstance()->SetOnKeyActListener(keyactListener);
- /* -------------------------------------------------------------------------- */
}
ReButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xffFF8A36); // 设置按键颜色
ReButton->SetOnClickListener(presenter_);
- AddViewToRootContainer(StButton);
- AddViewToRootContainer(ReButton);
+ group->Add(StButton);
+ group->Add(ReButton);
return true;
}
/***
noteLabel->SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
noteLabel->SetRollSpeed(23);
- AddViewToRootContainer(titleLabel);
- AddViewToRootContainer(noteLabel);
+ group->Add(titleLabel);
+ group->Add(noteLabel);
return true;
}
/***
noteimage->SetPosition(193, 120, 80, 80);
noteimage->SetSrc(BLOOD_PATH_NOTE);
- AddViewToRootContainer(noteimage);
+ group->Add(noteimage);
return true;
}
/***
*/
void CheckAbnormalView::DeInit()
{
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
if (StButton != nullptr)
{
delete StButton;
void CheckAbnormalView::OnStart()
{
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::OnStart");
+ if(group == nullptr)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::new UIViewGroup fail");
+ return;
+ }
+ group->SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ group->SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ group->SetOnDragListener(presenter_);
+ }
+ AddViewToRootContainer(group);
+
if (!CheckAbnormalViewInit())
{
{
custom_VibratorFunc_int(0);
}
-
-
- GetRootContainer()->SetDraggable(true);
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetOnDragListener(presenter_);
- //RootView::GetInstance()->SetOnKeyActListener(presenter_);
}
}
bool Initbackground();
private:
+ UIViewGroup *group = nullptr;
// 提醒图标
UIImageView *noteimage = nullptr;
// 按键
void UpShowHeartText(void);
private:
+ UIViewGroup *group{nullptr};
UIImageAnimatorView *imageAnimator{nullptr};
UILabelExt *titleLabel{nullptr};
UILabel *HeartText{nullptr};
bool Initbackground();
private:
+ UIViewGroup *group = nullptr;
UIImageView *background = nullptr;
UILabelExt *titleLabel = nullptr;
UILabelExt *timeLabel = nullptr;
HeartDetectionView::~HeartDetectionView()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartDetectionView::~HeartDetectionView");
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
delete titleLabel;
titleLabel = nullptr;
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartDetectionViewInit is begin");
/*初始化title*/
InitLabelExt(titleLabel, 83, 50, 300, 35, "title", STR_CHECKON, DEFAULT_VECTOR_FONT_FILENAME, 30);
- AddViewToRootContainer(titleLabel);
-
+ group->Add(titleLabel);
/* -------------------------------------------------------------------------- */
imageAnimator = new UIImageAnimatorView();
if (imageAnimator == nullptr)
}
imageAnimator->SetImageAnimatorSrc(g_imageAnimatorInfo_heart, DETECTION_IMAGE_ANIMATORVIEW_SIZE, DETECTION_IMAGE_ANIMATORVIEW_SPEED);
imageAnimator->SetRepeat(true);
- AddViewToRootContainer(imageAnimator);
+ group->Add(imageAnimator);
/* -------------------------------------------------------------------------- */
/*初始化心率值label*/
InitUILabel(HeartText, 83, 83, 300, 300, "hearttext", "--", GILROY_BOLD_FONT, 140);
- AddViewToRootContainer(HeartText);
+ group->Add(HeartText);
/* -------------------------------------------------------------------------- */
InitButtonExt(testButton, 118, 336, 230, 80, STOPCHECK, STR_CHECKSTOP, 30);
- AddViewToRootContainer(testButton);
+ group->Add(testButton);
/* -------------------------------------------------------------------------- */
UIView::OnClickListener *clickLeftListener = (UIView::OnClickListener *)OHOS::HeartDetectionPresenter::GetInstance();
void HeartDetectionView::OnStart()
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartDetectionView::OnStart");
-
+ if(group == nullptr)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartDetectionView::new UIViewGroup fail");
+ return;
+ }
+ group->SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ group->SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ group->SetOnDragListener(presenter_);
+ }
+
if (!HeartDetectionViewInit())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartDetectionView::InitHeartView fail");
}
-
-
- GetRootContainer()->SetDraggable(true);
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetOnDragListener(presenter_);
-
if (imageAnimator != nullptr)
{
imageAnimator->Start();
*/
void HeartResultView::DeInit()
{
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
if (background != nullptr)
{
delete background;
void HeartResultView::OnStart()
{
-
+ if(group == nullptr)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::new UIViewGroup fail");
+ return;
+ }
+ group->SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ group->SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ group->SetOnDragListener(presenter_);
+ }
+ AddViewToRootContainer(group);
if (!HeartResultViewInit())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartResultView::InitHeartView fail");
}
-
-
- GetRootContainer()->SetDraggable(true);
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetOnDragListener(presenter_);
}
}
void MotionRecognitionView::OnStart()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionRecognitionView::OnStart");
- View<MotionRecognitionPresenter>::OnStart();
-
-
-
if (!viewInitStatus)
{
MotionRecognitionViewInit();
}
- // 增加按键监听
- // GetRootContainer()->SetOnKeyActListener(presenter_);
-
scrollView->Add(Title);
scrollView->Add(MotionRecognitionImage);
scrollView->Add(MotionRecognitionLabel);
void NetworkAndCallView::OnStart()
{
- View<NetworkAndCallPresenter>::OnStart();
NetworkAndCallViewInit();
NetworkAndCallScrollView[NETWORKANDCALLVIEW]->Add(Title);
for (int i = 0; i < ITEM_NUM; i++)
AddViewToRootContainer(NetworkAndCallScrollView[NETWORKANDCALLVIEW]);
}
-
-
-
-
// 获取VOLTE button
UIToggleButton *NetworkAndCallView::GetVoLTEToggleButton(void)
{
if (NetworkAndCallScrollView[thisView] == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "NetworkAndCallView::ChangeNetworkAndCallView");
- GetRootContainer()->Add(NetworkAndCallScrollView[thisView]);
+ AddViewToRootContainer(NetworkAndCallScrollView[thisView]);
}
return true;
}
return false;
}
NetworkAndCallScrollView[thisView] = mobileDataOptionsView->MobileDataOptionsViewInit();
- GetRootContainer()->Add(NetworkAndCallScrollView[thisView]);
+ AddViewToRootContainer(NetworkAndCallScrollView[thisView]);
}
return true;
}
void SetAodDialView::OnStart()
{
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetAodDialView::OnStart");
- View<SetAodDialPresenter>::OnStart();
if (!viewInitStatus)
{
SetAodDialViewInit();
}
- // 增加按键监听
- // GetRootContainer()->SetOnKeyActListener(presenter_);
-
scrollView->Add(Title);
scrollView->Add(SetAodDialImage);
scrollView->Add(SetAodDialLabel);
+++ /dev/null
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SetDesktopModel.h
- * Author:
- * Create: 2021-11-23
- */
-
-#ifndef SET_DESKTOP_MODEL_H
-#define SET_DESKTOP_MODEL_H
-
-#include <cstdint>
-#include <map>
-#include "AppViewIDs.h"
-#include "UiConfig.h"
-
-typedef enum {
- APPLIST_STYLE,
- HEXAGONS_STYLE,
- FOOTBALL_STYLE,
- WATERFALL_STYLE
-} DesktopStyle;
-
-namespace OHOS {
- class SetDesktopModel {
- public:
- static SetDesktopModel &GetInstance(void);
- DesktopStyle GetDesktopStyle(void);
- void SetDesktopStyle(DesktopStyle style);
- private:
- SetDesktopModel();
- SetDesktopModel(const SetDesktopModel &);
- SetDesktopModel &operator=(const SetDesktopModel &);
- virtual ~SetDesktopModel();
- };
-}
-
-#endif // SET_DESKTOP_MODEL_H
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SetDesktopPresenter.h
- * Author:
- * Create: 2021-11-23
- */
-
-#ifndef SET_DESKTOP_PRESENTER_H
-#define SET_DESKTOP_PRESENTER_H
-
-#include "key/include/KeyInputListener.h"
-#include "Presenter.h"
-#include "components/ui_view.h"
-
-namespace OHOS {
-static const char *SET_DESKTOP_LIST = "setdesktopList";
-static const char *SET_DESKTOP_HEXAGONS = "setdesktopHexagons";
-static const char *SET_DESKTOP_FOOTBALL = "setdesktopFootball";
-static const char *SET_DESKTOP_WATERFALL = "setdesktopWaterfall";
-
-class SetDesktopView;
-class SetDesktopModel;
-class SetDesktopPresenter : public Presenter<SetDesktopView>,
- public UIView::OnClickListener,
- public UIView::OnDragListener {
-public:
- SetDesktopPresenter();
- ~SetDesktopPresenter() override;
- bool OnClick(UIView &view, const ClickEvent &event) override;
- bool OnDrag(UIView& view, const DragEvent& event) override;
- uint8_t GetCurrentStyle(void);
-private:
-};
-}
-
-#endif // SET_DESKTOP_PRESENTER_H
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SetDesktopView.h
- * Author:
- * Create: 2021-11-23
- */
-
-#ifndef SET_DESKTOP_VIEW_H
-#define SET_DESKTOP_VIEW_H
-
-#include "View.h"
-#include "components/ui_scroll_view.h"
-#include "components/ui_view_group.h"
-#include "components/ui_label.h"
-#include "components/ui_image_view.h"
-#include "components/ui_toggle_button.h"
-#include "ChangeSliceListener.h"
-#include "UiConfig.h"
-
-namespace OHOS {
-class SetDesktopPresenter;
-
-class SetDesktopView : public View<SetDesktopPresenter> {
-public:
- SetDesktopView();
- ~SetDesktopView() override;
-
- static SetDesktopView *GetInstance()
- {
- static SetDesktopView instance;
- return &instance;
- }
-
- void OnStart() override;
- void UpdateSelectedStyle(uint8_t selectedStyle);
- uint8_t GetCurrentSelectedStyle(void);
-
-private:
- void InitFootballItem();
- void InitWaterfallItem();
- UIScrollView *scrollview{nullptr};
- UILabel titleText;
- UIToggleButton hexagonsBtn;
- UIToggleButton listBtn;
- UIToggleButton footballBtn_;
- UIToggleButton waterfallBtn_;
- UIImageView hexagonsImage;
- UIImageView listImage;
- UIImageView footballImage_;
- UIImageView waterfallImage_;
- UILabel listText;
- UILabel hexagonsText;
- UILabel footballText_;
- UILabel waterfallText_;
-};
-}
-#endif // SET_DESKTOP_VIEW_H
+++ /dev/null
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SettingModel.cpp
- * Author:
- * Create: 2021-11-23
- */
-
-#include "set_desktop/include/SetDesktopModel.h"
-#include "kv_store.h"
-#include "securec.h"
-
-namespace OHOS {
- static const int STYLE_VALUE_LEN = 32;
- SetDesktopModel::SetDesktopModel() {}
-
- SetDesktopModel::~SetDesktopModel() {}
-
- SetDesktopModel &SetDesktopModel::GetInstance()
- {
- static SetDesktopModel instance;
- return instance;
- }
-
- DesktopStyle SetDesktopModel::GetDesktopStyle(void)
- {
- DesktopStyle style;
- char temp[STYLE_VALUE_LEN] = { 0 };
- (void)UtilsGetValue("applist_style", temp, STYLE_VALUE_LEN);
- if (strcmp(temp, "hexagons") == 0) {
- style = HEXAGONS_STYLE;
- } else if (strcmp(temp, "football") == 0) {
- style = FOOTBALL_STYLE;
- } else if (strcmp(temp, "waterfall") == 0) {
- style = WATERFALL_STYLE;
- } else {
- style = APPLIST_STYLE;
- }
- return style;
- }
-
- void SetDesktopModel::SetDesktopStyle(DesktopStyle style)
- {
- if (style == APPLIST_STYLE) {
- (void)UtilsSetValue("applist_style", "list");
- } else if (style == HEXAGONS_STYLE) {
- (void)UtilsSetValue("applist_style", "hexagons");
- } else if (style == FOOTBALL_STYLE) {
- (void)UtilsSetValue("applist_style", "football");
- } else if (style == WATERFALL_STYLE) {
- (void)UtilsSetValue("applist_style", "waterfall");
- }
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SettingPresenter.cpp
- * Author:
- * Create: 2021-11-23
- */
-
-#include "set_desktop/include/SetDesktopView.h"
-#include "set_desktop/include/SetDesktopModel.h"
-#include "set_desktop/include/SetDesktopPresenter.h"
-#include "NativeRegisterManager.h"
-
-namespace OHOS {
-
-REGIST_SLICE(VIEW_SET_DESKTOP, SetDesktopView, SetDesktopPresenter);
-
- SetDesktopPresenter::SetDesktopPresenter()
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopPresenter::SetDesktopPresenter");
- }
-
- SetDesktopPresenter::~SetDesktopPresenter() {}
-
- bool SetDesktopPresenter::OnDrag(UIView& view, const DragEvent& event)
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopPresenter::OnDrag");
- UNUSED(view);
- if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) &&
- (event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnDrag ChangeSlice");
- uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
- NativeAbility::GetInstance().ChangeSlice(preSlice);
- }
- return false;
- }
-
- bool SetDesktopPresenter::OnClick(UIView &view, const ClickEvent &event)
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopPresenter::OnClick");
- if (strcmp(view.GetViewId(), SET_DESKTOP_HEXAGONS) == 0) {
- SetDesktopModel::GetInstance().SetDesktopStyle(DesktopStyle::HEXAGONS_STYLE);
- } else if (strcmp(view.GetViewId(), SET_DESKTOP_LIST) == 0) {
- SetDesktopModel::GetInstance().SetDesktopStyle(DesktopStyle::APPLIST_STYLE);
- } else if (strcmp(view.GetViewId(), SET_DESKTOP_FOOTBALL) == 0) {
- SetDesktopModel::GetInstance().SetDesktopStyle(DesktopStyle::FOOTBALL_STYLE);
- } else if (strcmp(view.GetViewId(), SET_DESKTOP_WATERFALL) == 0) {
- SetDesktopModel::GetInstance().SetDesktopStyle(DesktopStyle::WATERFALL_STYLE);
- }
- uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId();
- NativeAbility::GetInstance().ChangeSlice(preSlice);
- return true;
- }
-
- uint8_t SetDesktopPresenter::GetCurrentStyle(void)
- {
- DesktopStyle style = SetDesktopModel::GetInstance().GetDesktopStyle();
- if (style == HEXAGONS_STYLE) {
- return 1; // 1: hexagons style enum index
- } else if (style == FOOTBALL_STYLE) {
- return 2; // 2: football style enum index
- } else if (style == WATERFALL_STYLE) {
- return 3; // 3: waterfall style enum index
- }
- return 0;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved.
- * Description: SetDesktopView.cpp
- * Author:
- * Create: 2021-11-23
- */
-
-#include <string>
-#include "set_desktop/include/SetDesktopView.h"
-#include "set_desktop/include/SetDesktopPresenter.h"
-#include "components/ui_scroll_view_nested.h"
-#include "common/screen.h"
-
-#include "PageTransitionMgr.h"
-namespace OHOS {
-SetDesktopView::SetDesktopView()
-{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopView::SetDesktopView");
-}
-
-SetDesktopView::~SetDesktopView()
-{
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopView::~SetDesktopView");
- if (scrollview != nullptr) {
- scrollview->RemoveAll();
- delete scrollview;
- scrollview = nullptr;
- }
-}
-
-void SetDesktopView::OnStart()
-{
- GetRootContainer()->SetDraggable(true);
- if (PageTransitionMgr::GetInstance().GetTopSlideBackImage() == nullptr) { // support default slide back firstly
- GetRootContainer()->SetOnDragListener(presenter_);
- }
- GetRootContainer()->SetTouchable(true);
-
- scrollview = new UIScrollViewNested(UIAbstractScroll::HORIZONTAL);
- UIScrollViewNested *nested = dynamic_cast<UIScrollViewNested*>(scrollview);
- if (nested != nullptr) {
- nested->SetBoundaryIntercept(DragEvent::DIRECTION_LEFT_TO_RIGHT, false);
- }
- scrollview->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight());
- AddViewToRootContainer(scrollview);
-
- titleText.SetPosition(180, 45, 260, 110);
- titleText.SetText("桌面");
- titleText.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
- titleText.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40);
- titleText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- AddViewToRootContainer(&titleText);
-
- listImage.SetPosition(0, 135, 190, 190);
- listImage.SetSrc(PNG_SET_DESKTOP_BG_IMAGE);
- scrollview->Add(&listImage);
-
- listBtn.SetPosition(22, 157, 148, 148);
- listBtn.SetImages(PNG_SET_DESKTOP_LIST_IMAGE, PNG_SET_DESKTOP_LIST_IMAGE);
- listBtn.SetViewId(SET_DESKTOP_LIST);
- scrollview->Add(&listBtn);
-
- listText.SetPosition(61, 328, 200, 60);
- listText.SetText("列表");
- listText.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
- listText.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
- listText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- scrollview->Add(&listText);
-
- hexagonsImage.SetPosition(150, 135, 190, 190);
- hexagonsImage.SetSrc(PNG_SET_DESKTOP_BG_IMAGE);
- scrollview->Add(&hexagonsImage);
-
- hexagonsBtn.SetPosition(172, 157, 148, 148);
- hexagonsBtn.SetImages(PNG_SET_DESKTOP_HEXAGONS_IMAGE, PNG_SET_DESKTOP_HEXAGONS_IMAGE);
- hexagonsBtn.SetViewId(SET_DESKTOP_HEXAGONS);
- scrollview->Add(&hexagonsBtn);
-
- hexagonsText.SetPosition(218, 328, 200, 60);
- hexagonsText.SetText("蜂窝");
- hexagonsText.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
- hexagonsText.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
- hexagonsText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- scrollview->Add(&hexagonsText);
-
- InitFootballItem();
- InitWaterfallItem();
- listBtn.SetOnClickListener(presenter_);
- hexagonsBtn.SetOnClickListener(presenter_);
- footballBtn_.SetOnClickListener(presenter_);
- waterfallBtn_.SetOnClickListener(presenter_);
- UpdateSelectedStyle(presenter_->GetCurrentStyle());
-}
-
-void SetDesktopView::UpdateSelectedStyle(uint8_t selectedStyle)
-{
- hexagonsImage.SetVisible(false);
- hexagonsBtn.SetState(false);
- listImage.SetVisible(false);
- listBtn.SetState(false);
- footballImage_.SetVisible(false);
- footballBtn_.SetState(false);
- waterfallImage_.SetVisible(false);
- waterfallBtn_.SetState(false);
-
- if (selectedStyle == 1) { // 1: select hexagons style
- hexagonsImage.SetVisible(true);
- hexagonsBtn.SetState(true);
- } else if (selectedStyle == 2) { // 2: select football style
- footballImage_.SetVisible(true);
- footballBtn_.SetState(true);
- } else if (selectedStyle == 3) { // 3: select waterfall style
- waterfallImage_.SetVisible(true);
- waterfallBtn_.SetState(true);
- } else {
- listImage.SetVisible(true);
- listBtn.SetState(true);
- }
-}
-
-void SetDesktopView::InitFootballItem()
-{
- footballImage_.SetPosition(300, 135, 190, 190);
- footballImage_.SetSrc(PNG_SET_DESKTOP_BG_IMAGE);
- scrollview->Add(&footballImage_);
-
- footballBtn_.SetPosition(322, 157, 148, 148);
- footballBtn_.SetImages(PNG_SET_DESKTOP_HEXAGONS_IMAGE, PNG_SET_DESKTOP_HEXAGONS_IMAGE);
- footballBtn_.SetViewId(SET_DESKTOP_FOOTBALL);
- scrollview->Add(&footballBtn_);
-
- footballText_.SetPosition(368, 328, 200, 60);
- footballText_.SetText("足球");
- footballText_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
- footballText_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
- footballText_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- scrollview->Add(&footballText_);
-}
-
-void SetDesktopView::InitWaterfallItem()
-{
- waterfallImage_.SetPosition(450, 135, 190, 190);
- waterfallImage_.SetSrc(PNG_SET_DESKTOP_BG_IMAGE);
- scrollview->Add(&waterfallImage_);
-
- waterfallBtn_.SetPosition(472, 157, 148, 148);
- waterfallBtn_.SetImages(PNG_SET_DESKTOP_HEXAGONS_IMAGE, PNG_SET_DESKTOP_HEXAGONS_IMAGE);
- waterfallBtn_.SetViewId(SET_DESKTOP_WATERFALL);
- scrollview->Add(&waterfallBtn_);
-
- waterfallText_.SetPosition(518, 328, 200, 60);
- waterfallText_.SetText("瀑布");
- waterfallText_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT);
- waterfallText_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
- waterfallText_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- scrollview->Add(&waterfallText_);
-}
-uint8_t SetDesktopView::GetCurrentSelectedStyle()
-{
- return presenter_->GetCurrentStyle();
-}
-}
void OnClick(UIView &view);
private:
+ UIViewGroup group;
UILabelExt labelTitle_;
UILabelExt labelCover_;
SetDialStyleView::~SetDialStyleView()
{
+ group.RemoveAll();
}
void SetDialStyleView::OnStart()
{
- GetRootContainer()->SetDraggable(true);
- GetRootContainer()->SetTouchable(true);
+ group.SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
+ group.SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ group.SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY);
+ group.SetTouchable(true);
+ group.SetDraggable(true);
+ group.SetOnDragListener(presenter_);
+ AddViewToRootContainer(&group);
+
+
if (PageTransitionMgr::GetInstance().GetTopSlideBackImage() == nullptr)
{ // support default slide back firstly
- GetRootContainer()->SetOnDragListener(presenter_);
+ group.SetOnDragListener(presenter_);
}
-
Cover_Image_.SetPosition(43, 120, 380, 100);
Cover_Image_.SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
Cover_Image_.SetStyle(STYLE_BACKGROUND_OPA, 0xff);
Cover_Image_.SetStyle(STYLE_BORDER_RADIUS, 100);
- AddViewToRootContainer(&Cover_Image_);
-
-
+ group.Add(&Cover_Image_);
Roller_Image_.SetPosition(43, 240, 380, 100);
Roller_Image_.SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
Roller_Image_.SetStyle(STYLE_BACKGROUND_OPA, 0xff);
Roller_Image_.SetStyle(STYLE_BORDER_RADIUS, 100);
- AddViewToRootContainer(&Roller_Image_);
+ group.Add(&Roller_Image_);
labelTitle_.SetPosition(83, 50, 300, 60);
labelTitle_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
labelTitle_.SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
labelTitle_.SetRollSpeed(23);
labelTitle_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- AddViewToRootContainer(&labelTitle_);
+ group.Add(&labelTitle_);
labelCover_.SetPosition(90, 153, 200, 60);
labelCover_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
labelCover_.SetTextId(STR_OVERLAY_FLOW);
- AddViewToRootContainer(&labelCover_);
+ group.Add(&labelCover_);
+
labelRoller_.SetPosition(90, 273, 200, 60);
labelRoller_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
labelRoller_.SetTextId(STR_ROLLER);
- AddViewToRootContainer(&labelRoller_);
+ group.Add(&labelRoller_);
btnCover_.SetPosition(298, 145, 100, 50);
btnCover_.SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);
- AddViewToRootContainer(&btnCover_);
+ group.Add(&btnCover_);
btnRoller_.SetPosition(298, 265, 100, 50);
btnRoller_.SetImages(PNG_TOGGLEBUTTON_ON_IMAGE, PNG_TOGGLEBUTTON_OFF_IMAGE);
- AddViewToRootContainer(&btnRoller_);
+ group.Add(&btnRoller_);
const DialStyle style = SetDialStyleModel::GetInstance().GetStyle();
int len = sizeof(styleTable_) / sizeof(styleTable_[0]);
void OnClick(UIView &view);
private:
+ UIViewGroup group;
UILabelExt labelTitle_;
UILabelExt labelFormat24H_;
UIToggleButton btnFormat24H_;
namespace OHOS {
SetTimeFormatView::SetTimeFormatView() {}
-SetTimeFormatView::~SetTimeFormatView() {}
+SetTimeFormatView::~SetTimeFormatView() {
+ group.RemoveAll();
+}
void SetTimeFormatView::OnStart() {
+ group.SetPosition(0, 0, 466, 466);
+ group.SetTouchable(true);
+ group.SetDraggable(true);
+ group.SetOnDragListener(presenter_);
+ AddViewToRootContainer(&group);
+
if (!SetTimeFormatInit())
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartResultView::InitHeartView fail");
}
-
- GetRootContainer()->SetDraggable(true);
- GetRootContainer()->SetPosition(0, 0, 466, 466);
- GetRootContainer()->SetOnDragListener(presenter_);
-
- GetRootContainer()->SetTouchable(true);
}
bool SetTimeFormatView::SetTimeFormatInit() {
Format24H_Image_.SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919);
Format24H_Image_.SetStyle(STYLE_BACKGROUND_OPA, 0xff);
Format24H_Image_.SetStyle(STYLE_BORDER_RADIUS, 100);
- AddViewToRootContainer(&Format24H_Image_);
+ group.Add(&Format24H_Image_);
labelTitle_.SetPosition(83, 50, 300, 60);
labelTitle_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
labelTitle_.SetTextId(STR_TIME_SET); // TODO:多国语言
labelTitle_.SetLineBreakMode(UILabel::LINE_BREAK_ELLIPSIS); // 居中
labelTitle_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER);
- AddViewToRootContainer(&labelTitle_);
+ group.Add(&labelTitle_);
labelFormat24H_.SetPosition(90, 153, 200, 60);
labelFormat24H_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30);
labelFormat24H_.SetTextId(STR_FORMAT); // TODO:多国语言
labelFormat24H_.SetLineBreakMode(UILabel::LINE_BREAK_OSCILLATION);
labelFormat24H_.SetRollSpeed(23);
- AddViewToRootContainer(&labelFormat24H_);
+ group.Add(&labelFormat24H_);
+
btnFormat24H_.SetPosition(298, 145, 100, 50);
btnFormat24H_.SetImages(PNG_TOGGLEBUTTON_ON_IMAGE,
PNG_TOGGLEBUTTON_OFF_IMAGE);
- AddViewToRootContainer(&btnFormat24H_);
+ group.Add(&btnFormat24H_);
labelNote_.SetPosition(53, 240, 360, 100);
labelNote_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 20);
labelNote_.SetTextId(STR_FORMAT_NOTE);
- AddViewToRootContainer(&labelNote_);
+ group.Add(&labelNote_);
const TimeFormat style = SetTimeFormatModel::GetInstance().GetTimeStyle();
if (style == TimeFormat::TIME_FORMAT_24H) {
SleepNapView *sleepnapView{nullptr};
private:
+ UIViewGroup *group{nullptr};
int16_t maxPage = MAX_SLEEPVIEW;
UISwipeView *SleepSwipeViewList{nullptr};
AppGroupView *recordCard[MAX_SLEEPVIEW]{nullptr};
void SleepControlView::ClearAll(void)
{
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
+
if (SleepSwipeViewList != nullptr)
{
for (int32_t i = 0; i < maxPage; i++)
void SleepControlView::OnStart()
{
SleepModel::GetInstance().msg_save_sleep_data();
-
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetDraggable(true);
- AddViewToRootContainer(GetSleepControlPageView());
- // GetRootContainer()->Add(GetSleepControlPageView());
-
+ if(group == nullptr)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::new UIViewGroup fail");
+ return;
+ }
+ group->SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ group->SetStyle(STYLE_BACKGROUND_OPA, 255);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ group->SetOnDragListener(presenter_);
+ }
+ AddViewToRootContainer(group);
+ group->Add(GetSleepControlPageView());
+
if (SleepSwipeViewList == nullptr)
{
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SleepSwipeViewList is nullptr!");
void SleepModeView::OnStart()
{
- View<SleepModePresenter>::OnStart();
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetDraggable(true);
-
ScrollView_ = InitScreen();
-
AddViewToRootContainer(ScrollView_);
}
updatasider->SetVisible(false);
}
-
- GetRootContainer()->Add(SystemUpdateScrollView);
+ AddViewToRootContainer(SystemUpdateScrollView);
}
void SystemUpdateView::NoNeedUpdateViewInit(void)
TraingNomalView(TraingNomalView &&) = delete;
TraingNomalView &operator=(TraingNomalView &&) = delete;
+ UIViewGroup *group = nullptr;
UILabelExt *sporttitle_ = nullptr;
UIButton *buttonGo_ = nullptr;
UILabelButtonExt *buttonSet_ = nullptr;
TraingView(TraingView &&) = delete;
TraingView &operator=(TraingView &&) = delete;
+ UIViewGroup *group = nullptr;
+
UIButton *buttonmore_ = nullptr;
UIButton *button1_ = nullptr;
UIButton *button2_ = nullptr;
PreLoad();
InitData(); // 刷新数据
- GetRootContainer()->SetDraggable(true);
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetOnDragListener(presenter_);
-
// 检查是否有足够的GPS数据来绘制轨迹
if (isNeedGPS == false) {
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "该运动项不需要GPS");
// 初始化Lable
InitLabelExt(sporttitle_, 83, 50, 300, 35, "label1", sport_id, DEFAULT_VECTOR_FONT_FILENAME, 30);
- AddViewToRootContainer(sporttitle_);
+ group->Add(sporttitle_);
// 初始化Button
InitButton(buttonGo_, 133, 133, 200, 200, BUTTONGO);
buttonGo_->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingNomalPresenter::GetInstance()));
buttonSet_->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingNomalPresenter::GetInstance()));
- AddViewToRootContainer(buttonGo_);
- AddViewToRootContainer(buttonSet_);
+ group->Add(buttonGo_);
+ group->Add(buttonSet_);
/*判断是否需要GPS*/
if(TraingModel::GetInstance()->IsNeedGPS(sport_id) == false)
{
}
#if defined(SUPPORT_GNSS)
InitUILabel(heartrate_label_, -32, 230, 200, 60, "heartrate_label_", "--", DEFAULT_VECTOR_FONT_FILENAME, 30);
- AddViewToRootContainer(heartrate_label_);
+ group->Add(heartrate_label_);
InitUILabel(gps_label_, 295, 230, 200, 60, "label_time", "GPS", DEFAULT_VECTOR_FONT_FILENAME, 30);
- AddViewToRootContainer(gps_label_);
+ group->Add(gps_label_);
// 获取gps状态
bool gps_status = TraingModel::GetInstance()->GetGPSConnectState();
InitImageView(gps_image_, 375, 193, 100, 100, "gps_image", GPS_2_IMAGE);
buttonGo_->SetImageSrc(GO_2_IMAGE, GO_2_IMAGE);
}
- AddViewToRootContainer(gps_image_);
+ group->Add(gps_image_);
InitImageView(heartrate_image_, 48, 193, 100, 100, "heartrate_image_", HEARTRATE_1_IMAGE);
- AddViewToRootContainer(heartrate_image_);
+ group->Add(heartrate_image_);
#endif
}
/* DeInit:删除组件*/
viewiInitStatus = true;
}
}
- // 设置按键监听
- static void SetKeyActListener()
- {
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetKeyActListener");
- // 增加按键监听
- RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::TraingNomalPresenter::GetInstance();
- RootView::GetInstance()->SetOnKeyActListener(keyactListener);
- }
+
void TraingNomalView::OnStart()
{
-
-
- // 创建 draglistener 实例并设置为拖动监听器
- UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingNomalPresenter::GetInstance());
- if (draglistener == nullptr)
+ if(group == nullptr)
{
- return;
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::new UIViewGroup fail");
+ return;
+ }
+ group->SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ group->SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ group->SetOnDragListener(presenter_);
}
- GetRootContainer()->SetOnDragListener(draglistener);
-
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetDraggable(true);
+ AddViewToRootContainer(group);
PreLoad();
-
- SetKeyActListener();
+ RootView::GetInstance()->SetOnKeyActListener(presenter_);
}
// 更新训练目标 [考虑 通用目标 特殊目标]
}
gps_image_->SetSrc(image);
buttonGo_->SetImageSrc(button_image_path.c_str(), button_image_path.c_str());
- //刷新一下
- GetRootContainer()->Invalidate();
return true;
}
}
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingSetView:: new container[%d] fail", thisview);\r
return false;\r
}\r
- GetRootContainer()->Add(SetTagScrollView[thisview]);\r
+ AddViewToRootContainer(SetTagScrollView[thisview]);\r
}\r
return true;\r
}\r
return false;\r
}\r
SetTagScrollView[thisview] = setcalories->SetCaluliViewInit();\r
- GetRootContainer()->Add(SetTagScrollView[thisview]);\r
+ AddViewToRootContainer(SetTagScrollView[thisview]);\r
}\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetTagScrollView[%d] is not null", thisview);\r
return true;\r
return false;\r
}\r
SetTagScrollView[thisview] = settime->SetTimeViewInit();\r
- GetRootContainer()->Add(SetTagScrollView[thisview]);\r
+ AddViewToRootContainer(SetTagScrollView[thisview]);\r
}\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetTagScrollView[%d] is not null", thisview);\r
return true;\r
return false;\r
}\r
SetTagScrollView[thisview] = setmile->SetMileViewInit();\r
- GetRootContainer()->Add(SetTagScrollView[thisview]);\r
+ AddViewToRootContainer(SetTagScrollView[thisview]);\r
}\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetTagScrollView[%d] is not null", thisview);\r
return true;\r
return false;\r
}\r
SetTagScrollView[thisview] = setstep->SetStepViewInit();\r
- GetRootContainer()->Add(SetTagScrollView[thisview]);\r
+ AddViewToRootContainer(SetTagScrollView[thisview]);\r
}\r
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetTagScrollView[%d] is not null", thisview);\r
return true;\r
}\r
\r
SetKeyActListener();\r
- // GetRootContainer()->Add(SetTagScrollView[SET_VIEW]);\r
// SetCurrentViewId(SET_VIEW); // 设置当前页面ID\r
\r
if (group != nullptr)\r
{\r
SetTagScrollView[SET_VIEW] = group;\r
- GetRootContainer()->Add(SetTagScrollView[SET_VIEW]);\r
+ AddViewToRootContainer(SetTagScrollView[SET_VIEW]);\r
SetCurrentViewId(SET_VIEW);\r
}\r
}\r
return true;\r
}\r
void TraingView::InitView() {\r
-\r
-\r
// 初始化按键\r
AddButton();\r
// 初始化标签\r
// 初始化图片\r
AddImageView();\r
\r
- AddViewToRootContainer(button1_);\r
- AddViewToRootContainer(button2_);\r
- AddViewToRootContainer(button3_);\r
- AddViewToRootContainer(buttonmore_);\r
+ group->Add(button1_);\r
+ group->Add(button2_);\r
+ group->Add(button3_);\r
+ group->Add(buttonmore_);\r
\r
- AddViewToRootContainer(title_label);\r
- AddViewToRootContainer(btn1_label);\r
- AddViewToRootContainer(btn2_label);\r
- AddViewToRootContainer(btn3_label);\r
- AddViewToRootContainer(btnmore_label);\r
+ group->Add(title_label);\r
+ group->Add(btn1_label);\r
+ group->Add(btn2_label);\r
+ group->Add(btn3_label);\r
+ group->Add(btnmore_label);\r
\r
- AddViewToRootContainer(btn1_image);\r
- AddViewToRootContainer(btn2_image);\r
- AddViewToRootContainer(btn3_image);\r
- AddViewToRootContainer(btnmore_image);\r
+ group->Add(btn1_image);\r
+ group->Add(btn2_image);\r
+ group->Add(btn3_image);\r
+ group->Add(btnmore_image);\r
\r
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingModel::InitView");\r
}\r
\r
void TraingView::DeInitView() {\r
\r
+ if (group != nullptr) {\r
+ group->RemoveAll();\r
+ delete group;\r
+ group = nullptr;\r
+ }\r
if (buttonmore_ != nullptr) {\r
delete buttonmore_;\r
buttonmore_ = nullptr;\r
btnmore_image = nullptr;\r
}\r
}\r
-\r
-// 设置按键监听\r
-static void SetKeyActListener() {\r
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetKeyActListener");\r
- // 增加按键监听\r
- RootView::OnKeyActListener *keyactListener =\r
- (RootView::OnKeyActListener *)OHOS::TraingPresenter::GetInstance();\r
- RootView::GetInstance()->SetOnKeyActListener(keyactListener);\r
-}\r
void TraingView::OnStart() {\r
-#if 0\r
- printf(" data--training1_Text: %s\n", data->training1_Text.c_str());\r
- printf(" data--training1_Image: %s\n", data->training1_Image.c_str());\r
- printf(" data--training2_Text: %s\n", data->training2_Text.c_str());\r
- printf(" data--training2_Image: %s\n", data->training2_Image.c_str());\r
- printf(" data--training3_Text: %s\n", data->training3_Text.c_str());\r
- printf(" data--training3_Image: %s\n", data->training3_Image.c_str());\r
-#endif\r
-\r
-\r
- // 创建 draglistener 实例并设置为拖动监听器\r
- UIView::OnDragListener *draglistener =\r
- static_cast<UIView::OnDragListener *>(TraingPresenter::GetInstance());\r
- if (draglistener == nullptr) {\r
- return;\r
+ if(group == nullptr)\r
+ {\r
+ group = new UIViewGroup();\r
+ if (group == nullptr)\r
+ {\r
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::new UIViewGroup fail");\r
+ return;\r
+ }\r
+ group->SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);\r
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);\r
+ group->SetStyle(STYLE_BACKGROUND_OPA, 255);\r
+ group->SetTouchable(true);\r
+ group->SetDraggable(true);\r
+ group->SetOnDragListener(presenter_);\r
}\r
- GetRootContainer()->SetOnDragListener(draglistener);\r
- GetRootContainer()->SetTouchable(true);\r
- GetRootContainer()->SetDraggable(true);\r
+ AddViewToRootContainer(group);\r
\r
InitView();\r
-\r
-\r
- // 增加按键监听\r
- SetKeyActListener();\r
+ RootView::GetInstance()->SetOnKeyActListener(presenter_);\r
}\r
\r
\r
TraingGPSView(TraingGPSView &&) = delete;
TraingGPSView &operator=(TraingGPSView &&) = delete;
+ UIViewGroup *group = nullptr;
UILabelExt *label1_ = nullptr;
UILabelExt *label2_ = nullptr;
UILabelExt *label3_ = nullptr;
TraingGPSbackView(TraingGPSbackView &&) = delete;
TraingGPSbackView &operator=(TraingGPSbackView &&) = delete;
+ UIViewGroup *group = nullptr;
UILabelExt *label1_ = nullptr;
UILabelExt *label2_ = nullptr;
UIButton *button1_ = nullptr;
TraingGPSlackView(TraingGPSlackView &&) = delete;
TraingGPSlackView &operator=(TraingGPSlackView &&) = delete;
-
+ UIViewGroup *group = nullptr;
UILabelExt *label1_ = nullptr;
UILabelExt *label2_ = nullptr;
UILabelExt *label3_ = nullptr;
TraingGPSlostView(TraingGPSlostView &&) = delete;
TraingGPSlostView &operator=(TraingGPSlostView &&) = delete;
+ UIViewGroup *group{nullptr};
UILabelExt *label1_ = nullptr;
UILabelExt *label2_ = nullptr;
UIButton *button1_ = nullptr;
UILabelExt *label1_ = nullptr;
UILabelExt *label2_ = nullptr;
-
-
UILabelButtonExt *button_wait = nullptr;
UILabelButtonExt *button_go = nullptr;
-
UIImageView *image1_ = nullptr;
UIImageView *image2_ = nullptr;
bool viewiInitStatus{false};
TraingGPSsetView(TraingGPSsetView &&) = delete;
TraingGPSsetView &operator=(TraingGPSsetView &&) = delete;
-
UIScrollView *scrollView1_ = nullptr;
-
UILabelExt *label1_ = nullptr;
UILabelExt *label2_ = nullptr;
UILabelExt *label3_ = nullptr;
}
}
void TraingGPSView::OnStart() {
-
- // 创建 draglistener 实例并设置为拖动监听器
- UIView::OnDragListener *draglistener =
- static_cast<UIView::OnDragListener *>(TraingGPSPresenter::GetInstance());
- if (draglistener == nullptr) {
- return;
+ if (group == nullptr)
+ {
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::new UIViewGroup fail");
+ return;
+ }
+ group->SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ group->SetStyle(STYLE_BACKGROUND_OPA, 255);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ group->SetOnDragListener(presenter_);
}
- GetRootContainer()->SetOnDragListener(draglistener);
-
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetDraggable(true);
+ AddViewToRootContainer(group);
PreLoad();
}
#include "common/image_cache_manager.h"
#include "components/ui_label_ext.h"
-#include"ui_resource_string.h"
+#include "ui_resource_string.h"
#include "UiConfig.h"
#include "ui_resource_image.h"
#include <ui_scroll_view.h>
TraingGPSbackView::~TraingGPSbackView()
{
- DeInit();
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
+ if (label1_ != nullptr)
+ {
+ delete label1_;
+ label1_ = nullptr;
+ }
+ if (label2_ != nullptr)
+ {
+ delete label2_;
+ label2_ = nullptr;
+ }
+ if (button1_ != nullptr)
+ {
+ delete button1_;
+ button1_ = nullptr;
+ }
+ if (image1_ != nullptr)
+ {
+ delete image1_;
+ image1_ = nullptr;
+ }
g_pTraingGPSbackView = nullptr;
}
/* InitView:初始化界面*/
void TraingGPSbackView ::InitView()
{
-
// 初始化Lable
- InitLabel(label1_, 175, 52, 195, 35, "label1", "GPS连接", DEFAULT_VECTOR_FONT_FILENAME, 35);
- AddViewToRootContainer(label1_);
- InitLabel(label2_, 55, 253, 146, 35, "label2", "GPS已连接,当前信号正常", DEFAULT_VECTOR_FONT_FILENAME, 30);
- AddViewToRootContainer(label2_);
+ InitLabel(label1_, 175, 52, 195, 35, "label1", "GPS连接", DEFAULT_VECTOR_FONT_FILENAME, 35);
+ group->Add(label1_);
+ InitLabel(label2_, 55, 253, 146, 35, "label2", "GPS已连接,当前信号正常", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ group->Add(label2_);
// 初始化image
- InitImageView(image1_, 193, 140, 40, 40, "image1", BACK_IMAGE);
- AddViewToRootContainer(image1_);
+ InitImageView(image1_, 193, 140, 40, 40, "image1", BACK_IMAGE);
+ group->Add(image1_);
// 初始化Button
- InitButton(button1_, 0, 366, 466, 100, BUTTONOK);
+ InitButton(button1_, 0, 366, 466, 100, BUTTONOK);
// Set additional property
button1_->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingGPSbackPresenter::GetInstance()));
button1_->SetImageSrc(BUTTONOK_IMAGE, BUTTONOK_IMAGE);
- AddViewToRootContainer(button1_);
- }
- /* DeInit:删除组件*/
- void TraingGPSbackView::DeInit()
- {
- // UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
- // while (view != nullptr)
- // {
- // UIView *tempView = view;
- // view = view->GetNextSibling();
- // if (tempView->GetParent())
- // {
- // static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
- // }
- // delete tempView;
- // }
- // delete container_;
- // container_ = nullptr;
+ group->Add(button1_);
}
void TraingGPSbackView::PreLoad(void)
}
void TraingGPSbackView::OnStart()
{
-
-
- // 创建 draglistener 实例并设置为拖动监听器
- UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingGPSbackPresenter::GetInstance());
- if (draglistener == nullptr)
+ if (group == nullptr)
{
- return;
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::new UIViewGroup fail");
+ return;
+ }
+ group->SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ group->SetStyle(STYLE_BACKGROUND_OPA, 255);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ group->SetOnDragListener(presenter_);
}
- GetRootContainer()->SetOnDragListener(draglistener);
-
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetDraggable(true);
-
+ AddViewToRootContainer(group);
PreLoad();
}
-
}
#include "common/image_cache_manager.h"
#include "components/ui_label_ext.h"
-#include"ui_resource_string.h"
+#include "ui_resource_string.h"
#include "UiConfig.h"
#include "ui_resource_image.h"
#include <ui_scroll_view.h>
return g_pTraingGPSlackView;
}
-
+
/* InitView:初始化界面*/
void TraingGPSlackView ::InitView()
{
-
// 初始化Lable
- InitLabel(label1_, 203, 52, 195, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30);
- AddViewToRootContainer(label1_);
- InitLabel(label2_, 160, 370, 146, 35, "label2", "设定目标 >", DEFAULT_VECTOR_FONT_FILENAME, 30);
- AddViewToRootContainer(label2_);
- InitLabel(label3_, 41, 237, 54, 41, "lable3", "--", DEFAULT_VECTOR_FONT_FILENAME, 35);
- AddViewToRootContainer(label3_);
- InitLabel(label4_, 361, 237, 54, 41, "lable4", "--", DEFAULT_VECTOR_FONT_FILENAME, 35);
- AddViewToRootContainer(label4_);
+ InitLabel(label1_, 203, 52, 195, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ group->Add(label1_);
+ InitLabel(label2_, 160, 370, 146, 35, "label2", "设定目标 >", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ group->Add(label2_);
+ InitLabel(label3_, 41, 237, 54, 41, "lable3", "--", DEFAULT_VECTOR_FONT_FILENAME, 35);
+ group->Add(label3_);
+ InitLabel(label4_, 361, 237, 54, 41, "lable4", "--", DEFAULT_VECTOR_FONT_FILENAME, 35);
+ group->Add(label4_);
// 初始化image
- InitImageView(image1_, 48, 193, 40, 40, "image1", HEARTRATE_2_IMAGE);
- InitImageView(image2_, 375, 193, 40, 40, "image2", GPS_2_IMAGE);
- AddViewToRootContainer(image1_);
- AddViewToRootContainer(image2_);
+ InitImageView(image1_, 48, 193, 40, 40, "image1", HEARTRATE_2_IMAGE);
+ InitImageView(image2_, 375, 193, 40, 40, "image2", GPS_2_IMAGE);
+ group->Add(image1_);
+ group->Add(image2_);
// 初始化Button
- InitButton(button1_, 133, 133, 200, 200, BUTTONGO);
+ InitButton(button1_, 133, 133, 200, 200, BUTTONGO);
// Set additional property
char *button1defaultImgSrc = "/user/res/Training/Go_2.bin";
char *button1triggeredImgSrc = nullptr;
button1_->SetImageSrc(button1defaultImgSrc, button1triggeredImgSrc);
- InitButton(button2_, 160, 370, 146, 35, BUTTONSET);
+ InitButton(button2_, 160, 370, 146, 35, BUTTONSET);
button2_->SetStyle(STYLE_BACKGROUND_COLOR, 0xff000000); // 设置为透明按键
button2_->SetStyle(STYLE_BACKGROUND_OPA, 0x00);
button2_->SetStyleForState(STYLE_BACKGROUND_OPA, 0x80, UIButton::PRESSED); // 设置按下时的透明度为半透明
- AddViewToRootContainer(button1_);
- AddViewToRootContainer(button2_);
+ group->Add(button1_);
+ group->Add(button2_);
}
/* DeInit:删除组件*/
void TraingGPSlackView::DeInit()
{
- // UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
- // while (view != nullptr)
- // {
- // UIView *tempView = view;
- // view = view->GetNextSibling();
- // if (tempView->GetParent())
- // {
- // static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
- // }
- // delete tempView;
- // }
- // delete container_;
- // container_ = nullptr;
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
+ delete label1_;
+ label1_ = nullptr;
+ delete label2_;
+ label2_ = nullptr;
+ delete label3_;
+ label3_ = nullptr;
+ delete label4_;
+ label4_ = nullptr;
+ delete image1_;
+ image1_ = nullptr;
+ delete image2_;
+ image2_ = nullptr;
+ delete button1_;
+ button1_ = nullptr;
+ delete button2_;
+ button2_ = nullptr;
}
void TraingGPSlackView::PreLoad(void)
}
void TraingGPSlackView::OnStart()
{
-
-
- // 创建 draglistener 实例并设置为拖动监听器
- UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingGPSlackPresenter::GetInstance());
- if (draglistener == nullptr)
+ if (group == nullptr)
{
- return;
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::new UIViewGroup fail");
+ return;
+ }
+ group->SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ group->SetStyle(STYLE_BACKGROUND_OPA, 255);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ group->SetOnDragListener(presenter_);
}
- GetRootContainer()->SetOnDragListener(draglistener);
-
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetDraggable(true);
-
+ AddViewToRootContainer(group);
PreLoad();
-
}
-
}
#include "common/image_cache_manager.h"
#include "components/ui_label_ext.h"
-#include"ui_resource_string.h"
+#include "ui_resource_string.h"
#include "UiConfig.h"
#include "ui_resource_image.h"
#include <ui_scroll_view.h>
TraingGPSlostView *TraingGPSlostView::GetInstance()
{
-
return g_pTraingGPSlostView;
}
-
/* InitView:初始化界面*/
void TraingGPSlostView ::InitView()
{
-
- // 初始化Lable
- InitLabel(label1_, 175, 52, 195, 35, "label1", "GPS丢失", DEFAULT_VECTOR_FONT_FILENAME, 35);
- AddViewToRootContainer(label1_);
- InitLabel(label2_, 55, 253, 146, 35, "label2", "当前位置搜索不到GPS信号", DEFAULT_VECTOR_FONT_FILENAME, 30);
- AddViewToRootContainer(label2_);
+ InitLabel(label1_, 175, 52, 195, 35, "label1", "GPS丢失", DEFAULT_VECTOR_FONT_FILENAME, 35);
+ group->Add(label1_);
+ InitLabel(label2_, 55, 253, 146, 35, "label2", "当前位置搜索不到GPS信号", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ group->Add(label2_);
// 初始化image
- InitImageView(image1_, 193, 140, 40, 40, "image1", WARNING_IMAGE);
- AddViewToRootContainer(image1_);
+ InitImageView(image1_, 193, 140, 40, 40, "image1", WARNING_IMAGE);
+ group->Add(image1_);
// 初始化Button
- InitButton(button1_, 0, 366, 466, 100, BUTTONOK);
+ InitButton(button1_, 0, 366, 466, 100, BUTTONOK);
// Set additional property
button1_->SetImageSrc(BUTTONOK_IMAGE, nullptr);
- AddViewToRootContainer(button1_);
+ group->Add(button1_);
}
/* DeInit:删除组件*/
void TraingGPSlostView::DeInit()
{
- // UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
- // while (view != nullptr)
- // {
- // UIView *tempView = view;
- // view = view->GetNextSibling();
- // if (tempView->GetParent())
- // {
- // static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
- // }
- // delete tempView;
- // }
- // delete container_;
- // container_ = nullptr;
+ if (group != nullptr)
+ {
+ group->RemoveAll();
+ delete group;
+ group = nullptr;
+ }
+ if (label1_ != nullptr)
+ {
+ delete label1_;
+ label1_ = nullptr;
+ }
+ if (label2_ != nullptr)
+ {
+ delete label2_;
+ label2_ = nullptr;
+ }
+ if (button1_ != nullptr)
+ {
+ delete button1_;
+ button1_ = nullptr;
+ }
+ if (image1_ != nullptr)
+ {
+ delete image1_;
+ image1_ = nullptr;
+ }
}
void TraingGPSlostView::PreLoad(void)
}
void TraingGPSlostView::OnStart()
{
-
- // 创建 draglistener 实例并设置为拖动监听器
- UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingGPSlostPresenter::GetInstance());
- if (draglistener == nullptr)
+ if (group == nullptr)
{
- return;
+ group = new UIViewGroup();
+ if (group == nullptr)
+ {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CheckAbnormalView::new UIViewGroup fail");
+ return;
+ }
+ group->SetPosition(0, 0, VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION);
+ group->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full);
+ group->SetStyle(STYLE_BACKGROUND_OPA, 255);
+ group->SetTouchable(true);
+ group->SetDraggable(true);
+ group->SetOnDragListener(presenter_);
}
- GetRootContainer()->SetOnDragListener(draglistener);
-
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetDraggable(true);
-
+ AddViewToRootContainer(group);
PreLoad();
}
#include "common/image_cache_manager.h"
#include "components/ui_label_ext.h"
-#include"ui_resource_string.h"
+#include "ui_resource_string.h"
#include "UiConfig.h"
#include "ui_resource_image.h"
#include <ui_scroll_view.h>
TraingGPSnoteView *TraingGPSnoteView::GetInstance()
{
-
return g_pTraingGPSnoteView;
}
-
/* InitView:初始化界面*/
void TraingGPSnoteView ::InitView()
{
-
-
- // Add ScrollView to App
if (scrollView1_ == nullptr)
{
scrollView1_ = new UIScrollView();
scrollView1_->SetReboundSize(100);
scrollView1_->SetScrollBlankSize(52);
scrollView1_->SetHorizontalScrollState(false);
- // Add to rootView
+ scrollView1_->SetOnDragListener(presenter_);
AddViewToRootContainer(scrollView1_);
scrollView1_->SetVisible(true);
button_go->SetOnClickListener(presenter_);
// 初始化Lable
- InitLabel(label1_, 133, 52, 200, 60, "label1", "GPS未准备", DEFAULT_VECTOR_FONT_FILENAME, 30);
- InitLabel(label2_, 33, 215, 400, 90, "label2", "GPS仍在定位,建议等待定位 完成后再开始训练", DEFAULT_VECTOR_FONT_FILENAME, 30);
-
+ InitLabel(label1_, 133, 52, 200, 60, "label1", "GPS未准备", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(label2_, 33, 215, 400, 90, "label2", "GPS仍在定位,建议等待定位 完成后再开始训练", DEFAULT_VECTOR_FONT_FILENAME, 30);
scrollView1_->Add(label1_);
scrollView1_->Add(label2_);
-
// Add ImageView to App
if (image2_ == nullptr)
{
image2_ = new UIImageView();
}
- image2_->SetPosition(181, 500); // widget's left position and top position
- image2_->Resize(100, 100); // widget's width and height
- image2_->SetViewId("image7"); // Set style
- // Add to rootView
+ image2_->SetPosition(181, 500);
+ image2_->Resize(100, 100);
+ image2_->SetViewId("image7");
scrollView1_->Add(image2_);
image2_->SetVisible(true);
}
delete button_wait;
button_wait = nullptr;
}
- if(button_go != nullptr)
+ if (button_go != nullptr)
{
delete button_go;
button_go = nullptr;
delete scrollView1_;
scrollView1_ = nullptr;
}
-
}
void TraingGPSnoteView::PreLoad(void)
}
void TraingGPSnoteView::OnStart()
{
-
- // 创建 draglistener 实例并设置为拖动监听器
- UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingGPSnotePresenter::GetInstance());
- if (draglistener == nullptr)
- {
- return;
- }
- GetRootContainer()->SetOnDragListener(draglistener);
-
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetDraggable(true);
-
PreLoad();
-
}
}
#include "common/image_cache_manager.h"
#include "components/ui_label_ext.h"
-#include"ui_resource_string.h"
+#include "ui_resource_string.h"
#include "UiConfig.h"
#include "ui_resource_image.h"
#include <ui_scroll_view.h>
TraingGPSsetView *TraingGPSsetView::GetInstance()
{
-
return g_pTraingGPSsetView;
}
-
+
/* Traing:初始化list */
void TraingGPSsetView::InitList()
{
/* InitView:初始化界面*/
void TraingGPSsetView ::InitView()
{
-
// Add ScrollView to App
if (scrollView1_ == nullptr)
{
scrollView1_->SetReboundSize(100);
scrollView1_->SetScrollBlankSize(52);
scrollView1_->SetHorizontalScrollState(false);
+ scrollView1_->SetOnDragListener(presenter_);
// Add to rootView
AddViewToRootContainer(scrollView1_);
scrollView1_->SetVisible(true);
// 初始化Button
- InitButton(button1_, 43, 120, 380, 100, BUTTONTIME);
- InitButton(button2_, 43, 240, 380, 100, BUTTONMIL);
- InitButton(button3_, 43, 360, 380, 100, BUTTONCALULI);
- InitButton(button4_, 43, 480, 380, 100, BUTTONWALK);
+ InitButton(button1_, 43, 120, 380, 100, BUTTONTIME);
+ InitButton(button2_, 43, 240, 380, 100, BUTTONMIL);
+ InitButton(button3_, 43, 360, 380, 100, BUTTONCALULI);
+ InitButton(button4_, 43, 480, 380, 100, BUTTONWALK);
scrollView1_->Add(button1_);
scrollView1_->Add(button2_);
scrollView1_->Add(button3_);
scrollView1_->Add(button4_);
// 初始化Image
- InitImageView(image1_, 380, 160, 100, 100, "image1", ICON_IMAGE);
- InitImageView(image2_, 380, 280, 100, 100, "image2", ICON_IMAGE);
- InitImageView(image3_, 380, 400, 100, 100, "image3", ICON_IMAGE);
- InitImageView(image4_, 380, 520, 100, 100, "image4", ICON_IMAGE);
+ InitImageView(image1_, 380, 160, 100, 100, "image1", ICON_IMAGE);
+ InitImageView(image2_, 380, 280, 100, 100, "image2", ICON_IMAGE);
+ InitImageView(image3_, 380, 400, 100, 100, "image3", ICON_IMAGE);
+ InitImageView(image4_, 380, 520, 100, 100, "image4", ICON_IMAGE);
scrollView1_->Add(image1_);
scrollView1_->Add(image2_);
scrollView1_->Add(image3_);
scrollView1_->Add(image4_);
// 初始化Lable
- InitLabel(label1_, 203, 52, 120, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30);
- InitLabel(label2_, 300, 160, 60, 35, "label2", "30 分钟", DEFAULT_VECTOR_FONT_FILENAME, 20);
- InitLabel(label3_, 300, 280, 69, 23, "label3", "5 公里", DEFAULT_VECTOR_FONT_FILENAME, 20);
- InitLabel(label4_, 300, 400, 60, 35, "label4", "500 千卡", DEFAULT_VECTOR_FONT_FILENAME, 20);
- InitLabel(label5_, 300, 520, 60, 35, "label5", "2000 步", DEFAULT_VECTOR_FONT_FILENAME, 20);
+ InitLabel(label1_, 203, 52, 120, 35, "label1", "骑行", DEFAULT_VECTOR_FONT_FILENAME, 30);
+ InitLabel(label2_, 300, 160, 60, 35, "label2", "30 分钟", DEFAULT_VECTOR_FONT_FILENAME, 20);
+ InitLabel(label3_, 300, 280, 69, 23, "label3", "5 公里", DEFAULT_VECTOR_FONT_FILENAME, 20);
+ InitLabel(label4_, 300, 400, 60, 35, "label4", "500 千卡", DEFAULT_VECTOR_FONT_FILENAME, 20);
+ InitLabel(label5_, 300, 520, 60, 35, "label5", "2000 步", DEFAULT_VECTOR_FONT_FILENAME, 20);
scrollView1_->Add(label1_);
scrollView1_->Add(label2_);
scrollView1_->Add(label3_);
/* DeInit:删除组件 */
void TraingGPSsetView::DeInit()
{
- // UIView *view = static_cast<UIViewGroup *>(container_)->GetChildrenHead();
- // while (view != nullptr)
- // {
- // UIView *tempView = view;
- // view = view->GetNextSibling();
- // if (tempView->GetParent())
- // {
- // static_cast<UIViewGroup *>(tempView->GetParent())->Remove(tempView);
- // }
- // delete tempView;
- // }
- // delete container_;
- // container_ = nullptr;
+ if (scrollView1_ != nullptr)
+ {
+ scrollView1_->RemoveAll();
+ delete scrollView1_;
+ scrollView1_ = nullptr;
+ }
+ if (list1_ != nullptr)
+ {
+ delete list1_;
+ list1_ = nullptr;
+ }
+ if (list1adapter_ != nullptr)
+ {
+ delete list1adapter_;
+ list1adapter_ = nullptr;
+ }
+ if (list1data_ != nullptr)
+ {
+ delete list1data_;
+ list1data_ = nullptr;
+ }
+ if (button1_ != nullptr)
+ {
+ delete button1_;
+ button1_ = nullptr;
+ }
+ if (button2_ != nullptr)
+ {
+ delete button2_;
+ button2_ = nullptr;
+ }
+ if (button3_ != nullptr)
+ {
+ delete button3_;
+ button3_ = nullptr;
+ }
+ if (button4_ != nullptr)
+ {
+ delete button4_;
+ button4_ = nullptr;
+ }
+ if (image1_ != nullptr)
+ {
+ delete image1_;
+ image1_ = nullptr;
+ }
+ if (image2_ != nullptr)
+ {
+ delete image2_;
+ image2_ = nullptr;
+ }
+ if (image3_ != nullptr)
+ {
+ delete image3_;
+ image3_ = nullptr;
+ }
+ if (image4_ != nullptr)
+ {
+ delete image4_;
+ image4_ = nullptr;
+ }
+ if (label1_ != nullptr)
+ {
+ delete label1_;
+ label1_ = nullptr;
+ }
+ if (label2_ != nullptr)
+ {
+ delete label2_;
+ label2_ = nullptr;
+ }
+ if (label3_ != nullptr)
+ {
+ delete label3_;
+ label3_ = nullptr;
+ }
+ if (label4_ != nullptr)
+ {
+ delete label4_;
+ label4_ = nullptr;
+ }
+ if (label5_ != nullptr)
+ {
+ delete label5_;
+ label5_ = nullptr;
+ }
}
void TraingGPSsetView::PreLoad(void)
}
void TraingGPSsetView::OnStart()
{
-
-
- // 创建 draglistener 实例并设置为拖动监听器
- UIView::OnDragListener *draglistener = static_cast<UIView::OnDragListener *>(TraingGPSsetPresenter::GetInstance());
- if (draglistener == nullptr)
- {
- return;
- }
- GetRootContainer()->SetOnDragListener(draglistener);
-
- GetRootContainer()->SetTouchable(true);
- GetRootContainer()->SetDraggable(true);
-
PreLoad();
-
}
-
}
back->SetImageSrc(YES_IMAGE, YES_IMAGE);\r
endView->Add(exit);\r
endView->Add(back);\r
- GetRootContainer()->Add(endView);\r
+ AddViewToRootContainer(endView);\r
endView->SetDraggable(false);\r
endView->SetTouchable(true);\r
endView->SetVisible(false); // 界面隐藏\r
getView->Add(buttonok_);\r
\r
InitImageAnimator();\r
- GetRootContainer()->Add(getView);\r
+ AddViewToRootContainer(getView);\r
getView->SetDraggable(false);\r
getView->SetTouchable(true);\r
getView->SetVisible(false); // 界面隐藏\r
TraingCardPresenter::GetInstance()));\r
heartView->Add(buttonnote_);\r
\r
- GetRootContainer()->Add(heartView);\r
+ AddViewToRootContainer(heartView);\r
heartView->SetDraggable(false);\r
heartView->SetTouchable(true);\r
heartView->SetVisible(false); // 界面隐藏\r