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) {
// 初始化图片\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
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