}
HeartChartView::~HeartChartView() {
WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartChartView::~HeartChartView");
+ if (container_)
+ container_->RemoveAll();
- UIViewGroup *tmpGroup = dynamic_cast<UIViewGroup *>(container_);
- UIViewGroup::RemoveAndDeleteAllRecursively(tmpGroup);
+ if (displayheart_) {
+ delete displayheart_;
+ displayheart_ = nullptr;
+ }
+ if (maxheart_) {
+ delete maxheart_;
+ maxheart_ = nullptr;
+ }
+ if (minheart_) {
+ delete minheart_;
+ minheart_ = nullptr;
+ }
+ if (uheart_) {
+ delete uheart_;
+ uheart_ = nullptr;
+ }
+ if (lastheart_) {
+ delete lastheart_;
+ lastheart_ = nullptr;
+ }
+ if (maxheart_dynamic_) {
+ delete maxheart_dynamic_;
+ maxheart_dynamic_ = nullptr;
+ }
+ if (maxheart_dynamic_3_) {
+ delete maxheart_dynamic_3_;
+ maxheart_dynamic_3_ = nullptr;
+ }
+ if (maxheart_dynamic_2_) {
+ delete maxheart_dynamic_2_;
+ maxheart_dynamic_2_ = nullptr;
+ }
+ if (maxheart_dynamic_1_) {
+ delete maxheart_dynamic_1_;
+ maxheart_dynamic_1_ = nullptr;
+ }
+ if (minheart_dynamic_) {
+ delete minheart_dynamic_;
+ minheart_dynamic_ = nullptr;
+ }
-#if 0
+ if (maxRateIconView_) {
+ delete maxRateIconView_;
+ maxRateIconView_ = nullptr;
+ }
+ if (minRateIconView_) {
+ delete minRateIconView_;
+ minRateIconView_ = nullptr;
+ }
+ if (chartBackgroundView_) {
+ delete chartBackgroundView_;
+ chartBackgroundView_ = nullptr;
+ }
+ if (heartIconView_) {
+ delete heartIconView_;
+ heartIconView_ = nullptr;
+ }
- container_->RemoveAll();
-
- delete displayheart_;
- displayheart_ = nullptr;
- delete maxheart_;
- maxheart_ = nullptr;
- delete minheart_;
- minheart_ = nullptr;
- delete uheart_;
- uheart_ = nullptr;
- delete lastheart_;
- lastheart_ = nullptr;
- delete maxheart_dynamic_;
- maxheart_dynamic_ = nullptr;
- delete maxheart_dynamic_3_;
- maxheart_dynamic_3_ = nullptr;
- delete maxheart_dynamic_2_;
- maxheart_dynamic_2_ = nullptr;
- delete maxheart_dynamic_1_;
- maxheart_dynamic_1_ = nullptr;
- delete minheart_dynamic_;
- minheart_dynamic_ = nullptr;
-
- delete maxRateIconView_;
- maxRateIconView_ = nullptr;
- delete minRateIconView_;
- minRateIconView_ = nullptr;
- delete chartBackgroundView_;
- chartBackgroundView_ = nullptr;
- delete heartIconView_;
- heartIconView_ = nullptr;
-
- imageAnimator->Stop();
- delete imageAnimator;
- imageAnimator = nullptr;
-
- heartchart->ClearDataSerial();
- delete heartSerial;
- heartSerial = nullptr;
- delete heartchart;
- heartchart = nullptr;
-#endif
- g_pHeartCheckView = this;
+ if (imageAnimator) {
+ imageAnimator->Stop();
+ delete imageAnimator;
+ imageAnimator = nullptr;
+ }
+
+ if (heartSerial) {
+ heartchart->ClearDataSerial();
+ delete heartSerial;
+ heartSerial = nullptr;
+ }
+
+ if (heartchart) {
+ delete heartchart;
+ heartchart = nullptr;
+ }
+
+ g_pHeartCheckView = nullptr;
}
HeartChartView *HeartChartView::GetInstance(void) { return g_pHeartCheckView; }