解决禅道,692手表-在运动列表页熄屏后再短按侧键亮屏,再次短按侧键/右滑动无效(OTA123))bug 3087/2
authorluozheng <1732036298@qq.com>
Wed, 14 Jan 2026 06:40:30 +0000 (14:40 +0800)
committerluozheng <1732036298@qq.com>
Wed, 14 Jan 2026 06:40:30 +0000 (14:40 +0800)
code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/include/TraingPresenter.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/include/TraingView.h
code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingPresenter.cpp
code/sdk/application/wearable/fd272/nativeapp/nativeui/traing/src/TraingView.cpp

index 87fcd14..1328565 100644 (file)
@@ -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();
index 61b9ca2..dce2a0f 100644 (file)
@@ -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;
index 7887a3d..a3d1b30 100644 (file)
@@ -47,17 +47,17 @@ TraingPresenter::~TraingPresenter() {
 
 TraingPresenter *TraingPresenter::GetInstance() { return g_pTraingPresenter; }
 
-void TraingPresenter::OnStart() { Presenter<TraingView>::OnStart(); }
+void TraingPresenter::OnStart() {  }
 
-void TraingPresenter::OnPause(void) { Presenter<TraingView>::OnPause(); }
-
-void TraingPresenter::OnResume(void) { Presenter<TraingView>::OnResume(); }
+void TraingPresenter::OnResume(void) 
+{
+  RootView::GetInstance()->SetOnKeyActListener(this); 
+}
 
-void TraingPresenter::OnStop(void) { Presenter<TraingView>::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) {
index b79ec68..e633b01 100644 (file)
@@ -142,27 +142,34 @@ void TraingView::InitView() {
   // 初始化图片\r
   AddImageView();\r
 \r
-  AddViewToRootContainer(button1_);\r
-  AddViewToRootContainer(button2_);\r
-  AddViewToRootContainer(button3_);\r
-  AddViewToRootContainer(buttonmore_);\r
-\r
-  AddViewToRootContainer(title_label);\r
-  AddViewToRootContainer(btn1_label);\r
-  AddViewToRootContainer(btn2_label);\r
-  AddViewToRootContainer(btn3_label);\r
-  AddViewToRootContainer(btnmore_label);\r
-\r
-  AddViewToRootContainer(btn1_image);\r
-  AddViewToRootContainer(btn2_image);\r
-  AddViewToRootContainer(btn3_image);\r
-  AddViewToRootContainer(btnmore_image);\r
+  group->Add(button1_);\r
+  group->Add(button2_);\r
+  group->Add(button3_);\r
+  group->Add(buttonmore_);\r
+\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
+  group->Add(btn1_image);\r
+  group->Add(btn2_image);\r
+  group->Add(btn3_image);\r
+  group->Add(btnmore_image);\r
+  AddViewToRootContainer(group);\r
 \r
   WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TraingModel::InitView");\r
 }\r
 \r
 void TraingView::DeInitView() {\r
 \r
+  if(group != nullptr)\r
+  {\r
+    group->RemoveAll();\r
+    delete group;\r
+    group = nullptr;\r
+  }\r
   if (buttonmore_ != nullptr) {\r
     delete buttonmore_;\r
     buttonmore_ = nullptr;\r
@@ -235,17 +242,15 @@ void TraingView::OnStart() {
         printf(" data--training3_Image: %s\n", data->training3_Image.c_str());\r
 #endif\r
 \r
+  // 创建group容器\r
+  group = new UIViewGroup();\r
+  group->SetPosition(0, 0);\r
+  group->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);\r
 \r
-  // 创建 draglistener 实例并设置为拖动监听器\r
-  UIView::OnDragListener *draglistener =\r
-      static_cast<UIView::OnDragListener *>(TraingPresenter::GetInstance());\r
-  if (draglistener == nullptr) {\r
-    return;\r
-  }\r
-  GetRootContainer()->SetOnDragListener(draglistener);\r
-  GetRootContainer()->SetTouchable(true);\r
-  GetRootContainer()->SetDraggable(true);\r
-\r
+  // 设置拖拽监听器\r
+  group->SetDraggable(true);\r
+  group->SetTouchable(true);\r
+  group->SetOnDragListener(presenter_);\r
   InitView();\r
 \r
 \r