From 11bedc72d4bace7f78611a73f02e397b1e2b3510 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Fri, 19 Apr 2024 20:45:42 +0800 Subject: [PATCH] =?utf8?q?=E8=A7=A3=E5=86=B3=E7=95=8C=E9=9D=A2=E6=9E=90?= =?utf8?q?=E6=9E=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../traing/include/TraingEnddataView.h | 24 +-- .../nativeui/traing/src/TraingEnddataView.cpp | 159 ++++++++++++++---- 2 files changed, 133 insertions(+), 50 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEnddataView.h b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEnddataView.h index f8a12a24c..76b850365 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEnddataView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/include/TraingEnddataView.h @@ -77,24 +77,16 @@ namespace OHOS UILabelExt *labelheart = nullptr; UILabelExt *labelstrong = nullptr; - UILabelExt *label16_ = nullptr; - UILabelExt *label17_ = nullptr; - UILabelExt *label18_ = nullptr; - UILabelExt *label19_ = nullptr; - UILabelButtonExt *buttonexit = nullptr; - UIImageView *image1_ = nullptr; - UIImageView *image2_ = nullptr; - UIImageView *image3_ = nullptr; - UIImageView *image4_ = nullptr; - UIImageView *image5_ = nullptr; - UIImageView *image6_ = nullptr; - UIImageView *image7_ = nullptr; - UIImageView *image8_ = nullptr; - UIImageView *image9_ = nullptr; - UIImageView *image10_ = nullptr; - UIImageView *image11_ = nullptr; + UIImageView *imageLine1 = nullptr; + UIImageView *imageLine2 = nullptr; + UIImageView *imageLine3 = nullptr; + UIImageView *imageLine4 = nullptr; + UIImageView *imageLine5 = nullptr; + UIImageView *imageLine6 = nullptr; + UIImageView *imageLine7 = nullptr; + bool viewiInitStatus{false}; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataView.cpp index bd64a6555..e788d909a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/src/TraingEnddataView.cpp @@ -58,18 +58,18 @@ namespace OHOS scrollView_->SetVisible(true); // 初始化image - TraingModel::GetInstance()->InitImageView(image5_, 80, 132, 54, 80, "image5", WALKING_54_IMAGE); - TraingModel::GetInstance()->InitImageView(image6_, 97, 214, 80, 20, "image6", LINE_IMAGE); - TraingModel::GetInstance()->InitImageView(image8_, 97, 344, 80, 20, "image8", LINE_IMAGE); - TraingModel::GetInstance()->InitImageView(image9_, 97, 474, 80, 20, "image9", LINE_IMAGE); - TraingModel::GetInstance()->InitImageView(image10_, 97, 604, 80, 20, "image10", LINE_IMAGE); - TraingModel::GetInstance()->InitImageView(image11_, 97, 734, 80, 20, "image11", LINE_IMAGE); - scrollView_->Add(image6_); - scrollView_->Add(image8_); - scrollView_->Add(image9_); - scrollView_->Add(image10_); - scrollView_->Add(image11_); - scrollView_->Add(image5_); + TraingModel::GetInstance()->InitImageView(imageLine1, 80, 132, 54, 80, "image5", WALKING_54_IMAGE); + TraingModel::GetInstance()->InitImageView(imageLine2, 97, 214, 80, 20, "image6", LINE_IMAGE); + TraingModel::GetInstance()->InitImageView(imageLine3, 97, 344, 80, 20, "image8", LINE_IMAGE); + TraingModel::GetInstance()->InitImageView(imageLine4, 97, 474, 80, 20, "image9", LINE_IMAGE); + TraingModel::GetInstance()->InitImageView(imageLine5, 97, 604, 80, 20, "image10", LINE_IMAGE); + TraingModel::GetInstance()->InitImageView(imageLine6, 97, 734, 80, 20, "image11", LINE_IMAGE); + scrollView_->Add(imageLine2); + scrollView_->Add(imageLine3); + scrollView_->Add(imageLine4); + scrollView_->Add(imageLine5); + scrollView_->Add(imageLine6); + scrollView_->Add(imageLine1); // 初始化Lable // 初始化标签 @@ -122,34 +122,125 @@ namespace OHOS TraingModel::GetInstance()->InitButtonExt(buttonexit, 42, 1319 - 338, 380, 100, BUTTONBACK, STR_OFF, 30); buttonexit->SetOnClickListener(static_cast(TraingEnddataPresenter::GetInstance())); scrollView_->Add(buttonexit); - - // Add ImageView to App - if (image7_ == nullptr) - { - image7_ = new UIImageView(); - } - image7_->SetPosition(188, 1460 - 338); // widget's left position and top position - image7_->Resize(100, 100); // widget's width and height - image7_->SetViewId("image7"); // Set style - // Add to rootView - scrollView_->Add(image7_); - image7_->SetVisible(true); } /* DeInit:删除组件 */ void TraingEnddataView::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; + /*标签*/ + if (labeltype != nullptr) + { + delete labeltype; + labeltype = nullptr; + } + if (labelsport != nullptr) + { + delete labelsport; + labelsport = nullptr; + } + if (labelutime != nullptr) + { + delete labelutime; + labelutime = nullptr; + } + if (labelutag != nullptr) + { + delete labelutag; + labelutag = nullptr; + } + + if (labelumile != nullptr) + { + delete labelumile; + labelumile = nullptr; + } + if (labeluheart != nullptr) + { + delete labeluheart; + labeluheart = nullptr; + } + if (labelustrong != nullptr) + { + delete labelustrong; + labelustrong = nullptr; + } + if (labelnote != nullptr) + { + delete labelnote; + labelnote = nullptr; + } + if (labelduration != nullptr) + { + delete labelduration; + labelduration = nullptr; + } + if (labeltag != nullptr) + { + delete labeltag; + labeltag = nullptr; + } + if (labeltime != nullptr) + { + delete labeltime; + labeltime = nullptr; + } + if (labelmile != nullptr) + { + delete labelmile; + labelmile = nullptr; + } + if (labelheart != nullptr) + { + delete labelheart; + labelheart = nullptr; + } + if (labelstrong != nullptr) + { + delete labelstrong; + labelstrong = nullptr; + } + /*按键*/ + if (buttonexit != nullptr) + { + delete buttonexit; + buttonexit = nullptr; + } + /*图片*/ + if (imageLine1 != nullptr) + { + delete imageLine1; + imageLine1 = nullptr; + } + if (imageLine2 != nullptr) + { + delete imageLine2; + imageLine2 = nullptr; + } + if (imageLine3 != nullptr) + { + delete imageLine3; + imageLine3 = nullptr; + } + if (imageLine4 != nullptr) + { + delete imageLine4; + imageLine4 = nullptr; + } + if (imageLine5 != nullptr) + { + delete imageLine5; + imageLine5 = nullptr; + } + if (imageLine6 != nullptr) + { + delete imageLine6; + imageLine6 = nullptr; + } + if (imageLine7 != nullptr) + { + delete imageLine7; + imageLine7 = nullptr; } delete container_; container_ = nullptr; -- 2.17.1