From: luozheng <1732036298@qq.com> Date: Fri, 18 Jul 2025 08:27:00 +0000 (+0800) Subject: 650:解决呼吸训练息屏回到主界面滑动list会死机问题 X-Git-Tag: leiniao_debug_1.0.0_20250922_020716~249 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=39d6c4b6927642ebd59f27fe444e5a09518ecf68;p=mirrors%2FFD230.git 650:解决呼吸训练息屏回到主界面滑动list会死机问题 --- diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/include/RespiratoryTrainingView.h b/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/include/RespiratoryTrainingView.h index 09d1549a7..19e876350 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/include/RespiratoryTrainingView.h +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/include/RespiratoryTrainingView.h @@ -104,6 +104,7 @@ namespace OHOS UILabelExt *RespiratoryTrainingLabel_ = nullptr; bool animateStart_ = false; /* -------------------------------------------------------------------------- */ + UIViewGroup *group{nullptr}; UILabelExt *titlelabel{nullptr}; // 标题 UILabelExt *TrainingDurationSelectiontitlelabel{nullptr}; // 选择的训练时长 UIImageView *Image{nullptr}; diff --git a/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp b/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp index 4c1a273bd..ab6fbc6b3 100644 --- a/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp +++ b/code/sdk/application/wearable/fd230/nativeapp/nativeui/respiratorytraining/src/RespiratoryTrainingView.cpp @@ -49,7 +49,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RespiratoryTrainingView::ChangeRespiratoryTrainingView"); if (RespiratoryTrainingScrollView[thisView] == nullptr) { - AddViewToRootContainer(RespiratoryTrainingScrollView[thisView]); + group->Add(RespiratoryTrainingScrollView[thisView]); } if (TrainingDurationSelectiontitlelabel) { @@ -77,7 +77,7 @@ namespace OHOS return false; } RespiratoryTrainingScrollView[thisView] = scrollView; - AddViewToRootContainer(RespiratoryTrainingScrollView[thisView]); + group->Add(RespiratoryTrainingScrollView[thisView]); } return true; } @@ -100,7 +100,7 @@ namespace OHOS return false; } RespiratoryTrainingScrollView[thisView] = scrollView; - AddViewToRootContainer(RespiratoryTrainingScrollView[thisView]); + group->Add(RespiratoryTrainingScrollView[thisView]); } return true; } @@ -465,7 +465,7 @@ namespace OHOS RespiratoryTrainingScrollView[RESPIRATORYTRAINING]->SetHorizontalScrollState(false); RespiratoryTrainingScrollView[RESPIRATORYTRAINING]->SetTouchable(true); RespiratoryTrainingScrollView[RESPIRATORYTRAINING]->SetDraggable(true); - AddViewToRootContainer(RespiratoryTrainingScrollView[RESPIRATORYTRAINING]); + group->Add(RespiratoryTrainingScrollView[RESPIRATORYTRAINING]); return true; } @@ -490,6 +490,12 @@ namespace OHOS void RespiratoryTrainingView::ClearAll(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[RespiratoryTrainingView]ClearAll start"); + if(group != nullptr) + { + group->RemoveAll(); + delete group; + group = nullptr; + } if (RespiratoryTrainingScrollView[RESPIRATORYTRAINING] != nullptr) { RespiratoryTrainingScrollView[RESPIRATORYTRAINING]->RemoveAll(); @@ -572,12 +578,17 @@ namespace OHOS void RespiratoryTrainingView::OnStart() { - + if (group == nullptr) + { + group = new UIViewGroup(); + group->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + group->SetOnDragListener(presenter_); + AddViewToRootContainer(group); + } + RespiratoryTrainingViewInit(); RootView::GetInstance()->SetDraggable(true); RootView::GetInstance()->SetTouchable(true); - RootView::GetInstance()->SetOnDragListener(presenter_); RootView::GetInstance()->SetOnKeyActListener(presenter_); - RespiratoryTrainingViewInit(); } } \ No newline at end of file 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 d03b1fa5c..4994c4e0f 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 @@ -259,9 +259,9 @@ void PointerInputDevice::DispatchDragStartEvent() if ((MATH_ABS(dragLen_.x) >= DRAG_LIMIT_X) || (MATH_ABS(dragLen_.y) >= DRAG_LIMIT_Y)) { // if ((MATH_ABS(dragLen_.x) >= INDEV_DRAG_LIMIT) || (MATH_ABS(dragLen_.y) >= INDEV_DRAG_LIMIT)) { // HISI delete begin - //if ((touchableView_ != nullptr) && !cancelSent_) { - // DispatchCancelEvent(); - //} + if ((touchableView_ != nullptr) && !cancelSent_) { + DispatchCancelEvent(); + } // HISI delete end printf("=====PointerInputDevice::DispatchDragStartEvent absx(%d) limitx(%d) absy(%d) limity(%d) \r\n", MATH_ABS(dragLen_.x),DRAG_LIMIT_X,