From: luozheng <1732036298@qq.com> Date: Wed, 14 Jan 2026 06:40:30 +0000 (+0800) Subject: 解决禅道,692手表-在运动列表页熄屏后再短按侧键亮屏,再次短按侧键/右滑动无效(OTA123))bug X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=8fbef837f3fbf030543b151b6cd751d18900c436;p=mirrors%2FFD230.git 解决禅道,692手表-在运动列表页熄屏后再短按侧键亮屏,再次短按侧键/右滑动无效(OTA123))bug --- diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/include/TraingPresenter.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/include/TraingPresenter.h index 87fcd1449..1328565ee 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/include/TraingPresenter.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/include/TraingPresenter.h @@ -32,9 +32,7 @@ namespace OHOS virtual ~TraingPresenter(); void OnStart() override; - void OnPause() override; void OnResume() override; - void OnStop() override; void NavigateBack(); static TraingPresenter *GetInstance(); diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/include/TraingView.h b/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/include/TraingView.h index 61b9ca244..dce2a0f06 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/include/TraingView.h +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/include/TraingView.h @@ -37,6 +37,7 @@ namespace OHOS TraingView(TraingView &&) = delete; TraingView &operator=(TraingView &&) = delete; + UIViewGroup *group = nullptr; UIButton *buttonmore_ = nullptr; UIButton *button1_ = nullptr; UIButton *button2_ = nullptr; diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingPresenter.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingPresenter.cpp index 7887a3d45..a3d1b3028 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingPresenter.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingPresenter.cpp @@ -47,17 +47,17 @@ TraingPresenter::~TraingPresenter() { TraingPresenter *TraingPresenter::GetInstance() { return g_pTraingPresenter; } -void TraingPresenter::OnStart() { Presenter::OnStart(); } +void TraingPresenter::OnStart() { } -void TraingPresenter::OnPause(void) { Presenter::OnPause(); } - -void TraingPresenter::OnResume(void) { Presenter::OnResume(); } +void TraingPresenter::OnResume(void) +{ + RootView::GetInstance()->SetOnKeyActListener(this); +} -void TraingPresenter::OnStop(void) { Presenter::OnStop(); } // 回退函数 [ Slice 的 traingview {右滑只能回到applist}] void TraingPresenter::NavigateBack() { NativeAbility::GetInstance().ChangeSlice( - VIEW_APPLIST, TransitionType::TRANSITION_BACK_TO_HEXAGONS); + VIEW_APPLIST, TransitionType::TRANSITION_INVALID); NativeAbility::GetInstance().ClearSliceIdStack(); // 清空所有SLiceId栈元素 } bool TraingPresenter::OnDrag(UIView &view, const DragEvent &event) { diff --git a/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingView.cpp b/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingView.cpp index b79ec68bb..e633b0188 100644 --- a/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingView.cpp +++ b/code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingView.cpp @@ -142,27 +142,34 @@ void TraingView::InitView() { // 初始化图片 AddImageView(); - AddViewToRootContainer(button1_); - AddViewToRootContainer(button2_); - AddViewToRootContainer(button3_); - AddViewToRootContainer(buttonmore_); - - AddViewToRootContainer(title_label); - AddViewToRootContainer(btn1_label); - AddViewToRootContainer(btn2_label); - AddViewToRootContainer(btn3_label); - AddViewToRootContainer(btnmore_label); - - AddViewToRootContainer(btn1_image); - AddViewToRootContainer(btn2_image); - AddViewToRootContainer(btn3_image); - AddViewToRootContainer(btnmore_image); + group->Add(button1_); + group->Add(button2_); + group->Add(button3_); + group->Add(buttonmore_); + + group->Add(title_label); + group->Add(btn1_label); + group->Add(btn2_label); + group->Add(btn3_label); + group->Add(btnmore_label); + + group->Add(btn1_image); + group->Add(btn2_image); + group->Add(btn3_image); + group->Add(btnmore_image); + AddViewToRootContainer(group); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingModel::InitView"); } void TraingView::DeInitView() { + if(group != nullptr) + { + group->RemoveAll(); + delete group; + group = nullptr; + } if (buttonmore_ != nullptr) { delete buttonmore_; buttonmore_ = nullptr; @@ -235,17 +242,15 @@ void TraingView::OnStart() { printf(" data--training3_Image: %s\n", data->training3_Image.c_str()); #endif + // 创建group容器 + group = new UIViewGroup(); + group->SetPosition(0, 0); + group->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - // 创建 draglistener 实例并设置为拖动监听器 - UIView::OnDragListener *draglistener = - static_cast(TraingPresenter::GetInstance()); - if (draglistener == nullptr) { - return; - } - GetRootContainer()->SetOnDragListener(draglistener); - GetRootContainer()->SetTouchable(true); - GetRootContainer()->SetDraggable(true); - + // 设置拖拽监听器 + group->SetDraggable(true); + group->SetTouchable(true); + group->SetOnDragListener(presenter_); InitView();