优化训练列表卡死的问题 623/2 623/head
authorCaisking <3449750381@qq.com>
Wed, 31 Jul 2024 09:49:35 +0000 (17:49 +0800)
committerCaisking <3449750381@qq.com>
Wed, 31 Jul 2024 09:49:35 +0000 (17:49 +0800)
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ball/src/TraingBallView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_dance/src/TraingDanceView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_fitness/src/TraingFitnessView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_ice/src/TraingIceView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_limit/src/TraingLimitView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_more/src/TraingMoreView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_other/src/TraingOtherView.cpp
code/sdk/application/wearable/fd230app/nativeui/traing/training_list_rest/src/TraingRestView.cpp
code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordView.cpp

index 3d2b07a..9d0ac08 100644 (file)
@@ -79,6 +79,7 @@ namespace OHOS
         {
             TraingBallList = new UIList();
         }
+#if 0
         TraingBallList->SetPosition(Ball_LIST_POSITION_X, Ball_LIST_POSITION_Y);
         TraingBallList->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
         TraingBallList->SetScrollBlankSize(Ball_SCROLLBLANKSIZE);
@@ -90,6 +91,14 @@ namespace OHOS
         TraingBallList->SetElastic(true); // 设置回弹效果
         TraingBallList->SetMaxScrollDistance(MAX_SCR_DIS);
         TraingBallList->SetYScrollBarVisible(true); // 设置滑动滚动条
+#endif
+
+        TraingBallList->SetPosition(Ball_LIST_POSITION_X, Ball_LIST_POSITION_Y, 466, 466);
+        TraingBallList->SetThrowDrag(true);
+        TraingBallList->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+        TraingBallList->SetMaxScrollDistance(1000);
+        TraingBallList->SetSwipeACCLevel(800);
+        TraingBallList->SetDragACCLevel(5);
 
         // 增加表冠控制
         TraingBallList->SetRotateFactor(2);
@@ -160,9 +169,8 @@ namespace OHOS
     {
         View<TraingBallPresenter>::OnStop();
 
-
         RootView::GetInstance()->ClearOnKeyActListener();
-        //FocusManager::GetInstance()->ClearFocus();
+        // FocusManager::GetInstance()->ClearFocus();
         RootView::GetInstance()->RemoveAll();
         // RootView::GetInstance()->ClearFocus();
         return;
index 25eec3a..3e44f69 100644 (file)
@@ -79,6 +79,7 @@ namespace OHOS
         {
             TraingDanceList = new UIList();
         }
+#if 0
         TraingDanceList->SetPosition(Dance_LIST_POSITION_X, Dance_LIST_POSITION_Y);
         TraingDanceList->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
         TraingDanceList->SetScrollBlankSize(Dance_SCROLLBLANKSIZE);
@@ -90,6 +91,14 @@ namespace OHOS
         TraingDanceList->SetElastic(true); // 设置回弹效果
         TraingDanceList->SetMaxScrollDistance(MAX_SCR_DIS);
         TraingDanceList->SetYScrollBarVisible(true); // 设置滑动滚动条
+#endif
+
+        TraingDanceList->SetPosition(Dance_LIST_POSITION_X, Dance_LIST_POSITION_Y, 466, 466);
+        TraingDanceList->SetThrowDrag(true);
+        TraingDanceList->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+        TraingDanceList->SetMaxScrollDistance(1000);
+        TraingDanceList->SetSwipeACCLevel(800);
+        TraingDanceList->SetDragACCLevel(5);
 
         // 增加表冠控制
         TraingDanceList->SetRotateFactor(2);
@@ -160,9 +169,8 @@ namespace OHOS
     {
         View<TraingDancePresenter>::OnStop();
 
-
         RootView::GetInstance()->ClearOnKeyActListener();
-        //FocusManager::GetInstance()->ClearFocus();
+        // FocusManager::GetInstance()->ClearFocus();
         RootView::GetInstance()->RemoveAll();
         // RootView::GetInstance()->ClearFocus();
         return;
index e7daa04..0f9e831 100644 (file)
@@ -78,6 +78,7 @@ namespace OHOS
         {
             TraingFitnessList = new UIList();
         }
+#if 0
         TraingFitnessList->SetPosition(Fitness_LIST_POSITION_X, Fitness_LIST_POSITION_Y);
         TraingFitnessList->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
         TraingFitnessList->SetScrollBlankSize(Fitness_SCROLLBLANKSIZE);
@@ -89,6 +90,14 @@ namespace OHOS
         TraingFitnessList->SetElastic(true); // 设置回弹效果
         TraingFitnessList->SetMaxScrollDistance(MAX_SCR_DIS);
         TraingFitnessList->SetYScrollBarVisible(true); // 设置滑动滚动条
+#endif
+
+        TraingFitnessList->SetPosition(Fitness_LIST_POSITION_X, Fitness_LIST_POSITION_Y, 466, 466);
+        TraingFitnessList->SetThrowDrag(true);
+        TraingFitnessList->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+        TraingFitnessList->SetMaxScrollDistance(1000);
+        TraingFitnessList->SetSwipeACCLevel(800);
+        TraingFitnessList->SetDragACCLevel(5);
 
         // 增加表冠控制
         TraingFitnessList->SetRotateFactor(2);
@@ -164,9 +173,8 @@ namespace OHOS
     {
         View<TraingFitnessPresenter>::OnStop();
 
-
         RootView::GetInstance()->ClearOnKeyActListener();
-        //FocusManager::GetInstance()->ClearFocus();
+        // FocusManager::GetInstance()->ClearFocus();
         RootView::GetInstance()->RemoveAll();
         // RootView::GetInstance()->ClearFocus();
         return;
index 295fa7a..a2fb057 100644 (file)
@@ -87,6 +87,7 @@ namespace OHOS
         {
             TraingIceList = new UIList();
         }
+#if 0
         TraingIceList->SetPosition(Ice_LIST_POSITION_X, Ice_LIST_POSITION_Y);
         TraingIceList->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
         TraingIceList->SetScrollBlankSize(Ice_SCROLLBLANKSIZE);
@@ -98,6 +99,14 @@ namespace OHOS
         TraingIceList->SetElastic(true); // 设置回弹效果
         TraingIceList->SetMaxScrollDistance(MAX_SCR_DIS);
         TraingIceList->SetYScrollBarVisible(true); // 设置滑动滚动条
+#endif
+
+        TraingIceList->SetPosition(Ice_LIST_POSITION_X, Ice_LIST_POSITION_Y, 466, 466);
+        TraingIceList->SetThrowDrag(true);
+        TraingIceList->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+        TraingIceList->SetMaxScrollDistance(1000);
+        TraingIceList->SetSwipeACCLevel(800);
+        TraingIceList->SetDragACCLevel(5);
 
         // 增加表冠控制
         scrollView->SetRotateFactor(2);
@@ -169,7 +178,7 @@ namespace OHOS
         View<TraingIcePresenter>::OnStop();
 
         RootView::GetInstance()->ClearOnKeyActListener();
-        //FocusManager::GetInstance()->ClearFocus();
+        // FocusManager::GetInstance()->ClearFocus();
         RootView::GetInstance()->RemoveAll();
         // RootView::GetInstance()->ClearFocus();
         return;
index 4ff5003..415ee64 100644 (file)
@@ -80,6 +80,7 @@ namespace OHOS
         {\r
             TraingLimitList = new UIList();\r
         }\r
+#if 0\r
         TraingLimitList->SetPosition(Limit_LIST_POSITION_X, Limit_LIST_POSITION_Y);\r
         TraingLimitList->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);\r
         TraingLimitList->SetScrollBlankSize(Limit_SCROLLBLANKSIZE);\r
@@ -91,6 +92,14 @@ namespace OHOS
         TraingLimitList->SetElastic(true); // 设置回弹效果\r
         TraingLimitList->SetMaxScrollDistance(MAX_SCR_DIS);\r
         TraingLimitList->SetYScrollBarVisible(true); // 设置滑动滚动条\r
+#endif\r
+\r
+        TraingLimitList->SetPosition(Limit_LIST_POSITION_X, Limit_LIST_POSITION_Y, 466, 466);\r
+        TraingLimitList->SetThrowDrag(true);\r
+        TraingLimitList->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);\r
+        TraingLimitList->SetMaxScrollDistance(1000);\r
+        TraingLimitList->SetSwipeACCLevel(800);\r
+        TraingLimitList->SetDragACCLevel(5);\r
 \r
         // 增加表冠控制\r
         TraingLimitList->SetRotateFactor(2);\r
@@ -162,7 +171,7 @@ namespace OHOS
         View<TraingLimitPresenter>::OnStop();\r
 \r
         RootView::GetInstance()->ClearOnKeyActListener();\r
-        //FocusManager::GetInstance()->ClearFocus();\r
+        // FocusManager::GetInstance()->ClearFocus();\r
         RootView::GetInstance()->RemoveAll();\r
         // RootView::GetInstance()->ClearFocus();\r
         return;\r
index e6d283b..8e661f5 100644 (file)
@@ -83,16 +83,22 @@ namespace OHOS
         {\r
             TraingMoreList = new UIList();\r
         }\r
-        TraingMoreList->SetPosition(More_LIST_POSITION_X, More_LIST_POSITION_Y);\r
-        TraingMoreList->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);\r
-        TraingMoreList->SetScrollBlankSize(More_SCROLLBLANKSIZE);\r
-        TraingMoreList->SetReboundSize(50);\r
-        TraingMoreList->SetSelectPosition(HORIZONTAL_RESOLUTION / SNUM_2); // middle position\r
-        TraingMoreList->SetDraggable(true);\r
+\r
+        // TraingMoreList->SetScrollBlankSize(More_SCROLLBLANKSIZE);\r
+        // TraingMoreList->SetReboundSize(50);\r
+        // TraingMoreList->SetSelectPosition(HORIZONTAL_RESOLUTION / SNUM_2); // middle position\r
+        // TraingMoreList->SetDraggable(true);\r
+        // TraingMoreList->SetThrowDrag(true);\r
+        // TraingMoreList->EnableAutoAlign(true);\r
+        // TraingMoreList->SetElastic(true); // 设置回弹效果\r
+        // TraingMoreList->SetMaxScrollDistance(MAX_SCR_DIS);\r
+\r
+        TraingMoreList->SetPosition(More_LIST_POSITION_X, More_LIST_POSITION_Y, 466, 466);\r
         TraingMoreList->SetThrowDrag(true);\r
-        TraingMoreList->EnableAutoAlign(true);\r
-        TraingMoreList->SetElastic(true); // 设置回弹效果\r
-        TraingMoreList->SetMaxScrollDistance(MAX_SCR_DIS);\r
+        TraingMoreList->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);\r
+        TraingMoreList->SetMaxScrollDistance(1000);\r
+        TraingMoreList->SetSwipeACCLevel(800);\r
+        TraingMoreList->SetDragACCLevel(5);\r
 \r
         scrollView->SetYScrollBarVisible(true); // 设置滑动滚动条\r
 \r
@@ -165,9 +171,8 @@ namespace OHOS
     {\r
         View<TraingMorePresenter>::OnStop();\r
 \r
-\r
         RootView::GetInstance()->ClearOnKeyActListener();\r
-        //FocusManager::GetInstance()->ClearFocus();\r
+        // FocusManager::GetInstance()->ClearFocus();\r
         RootView::GetInstance()->RemoveAll();\r
         // RootView::GetInstance()->ClearFocus();\r
         return;\r
index 5d02e5f..7e2b211 100644 (file)
@@ -80,6 +80,7 @@ namespace OHOS
         {
             TraingOtherList = new UIList();
         }
+#if 0
         TraingOtherList->SetPosition(Other_LIST_POSITION_X, Other_LIST_POSITION_Y);
         TraingOtherList->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
         TraingOtherList->SetScrollBlankSize(Other_SCROLLBLANKSIZE);
@@ -91,6 +92,14 @@ namespace OHOS
         TraingOtherList->SetElastic(true); // 设置回弹效果
         TraingOtherList->SetMaxScrollDistance(MAX_SCR_DIS);
         TraingOtherList->SetYScrollBarVisible(true); // 设置滑动滚动条
+#endif
+
+        TraingOtherList->SetPosition(Other_LIST_POSITION_X, Other_LIST_POSITION_Y, 466, 466);
+        TraingOtherList->SetThrowDrag(true);
+        TraingOtherList->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+        TraingOtherList->SetMaxScrollDistance(1000);
+        TraingOtherList->SetSwipeACCLevel(800);
+        TraingOtherList->SetDragACCLevel(5);
 
         // 增加表冠控制
         TraingOtherList->SetRotateFactor(2);
@@ -162,7 +171,7 @@ namespace OHOS
         View<TraingOtherPresenter>::OnStop();
 
         RootView::GetInstance()->ClearOnKeyActListener();
-        //FocusManager::GetInstance()->ClearFocus();
+        // FocusManager::GetInstance()->ClearFocus();
         RootView::GetInstance()->RemoveAll();
         // RootView::GetInstance()->ClearFocus();
         return;
index 349a0ed..149c7ec 100644 (file)
@@ -80,6 +80,7 @@ namespace OHOS
         {
             TraingRestList = new UIList();
         }
+#if 0
         TraingRestList->SetPosition(Rest_LIST_POSITION_X, Rest_LIST_POSITION_Y);
         TraingRestList->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
         TraingRestList->SetScrollBlankSize(Rest_SCROLLBLANKSIZE);
@@ -91,6 +92,14 @@ namespace OHOS
         TraingRestList->SetElastic(true); // 设置回弹效果
         TraingRestList->SetMaxScrollDistance(MAX_SCR_DIS);
         TraingRestList->SetYScrollBarVisible(true); // 设置滑动滚动条
+#endif
+
+        TraingRestList->SetPosition(Rest_LIST_POSITION_X, Rest_LIST_POSITION_Y, 466, 466);
+        TraingRestList->SetThrowDrag(true);
+        TraingRestList->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+        TraingRestList->SetMaxScrollDistance(1000);
+        TraingRestList->SetSwipeACCLevel(800);
+        TraingRestList->SetDragACCLevel(5);
 
         // 增加表冠控制
         TraingRestList->SetRotateFactor(2);
@@ -162,7 +171,7 @@ namespace OHOS
         View<TraingRestPresenter>::OnStop();
 
         RootView::GetInstance()->ClearOnKeyActListener();
-        //FocusManager::GetInstance()->ClearFocus();
+        // FocusManager::GetInstance()->ClearFocus();
         RootView::GetInstance()->RemoveAll();
         // RootView::GetInstance()->ClearFocus();
         return;
index b70bba6..b91e8da 100644 (file)
@@ -63,68 +63,33 @@ namespace OHOS
     /* DeInit:删除组件 */
     void TraingRecordView::DeInit()
     {
-        container_->RemoveAll();
         lackView->RemoveAll();
         recordView->RemoveAll();
-        TraingRecordList->RemoveAll();
 
-        if (labeltitle_ != nullptr)
-        {
-            lackView->Remove(labeltitle_);
-            delete labeltitle_;
-            labeltitle_ = nullptr;
-        }
-        if (labelrecord_ != nullptr)
-        {
-            lackView->Remove(labelrecord_);
-            delete labelrecord_;
-            labelrecord_ = nullptr;
-        }
-        if (buttongo != nullptr)
-        {
-            lackView->Remove(buttongo);
-            delete buttongo;
-            buttongo = nullptr;
-        }
-        if (imagerecord != nullptr)
-        {
-            lackView->Remove(imagerecord);
-            delete imagerecord;
-            imagerecord = nullptr;
-        }
-        if (lackView != nullptr)
-        {
-            lackView->RemoveAll();
-            delete lackView;
-            lackView = nullptr;
-        }
+        delete labeltitle_;
+        labeltitle_ = nullptr;
 
-        if (TraingRecordList != nullptr)
-        {
-            recordView->Remove(TraingRecordList);
-            delete TraingRecordList;
-            TraingRecordList = nullptr;
-        }
-        if (labelercord_ != nullptr)
-        {
-            recordView->Remove(labelercord_);
-            delete labelercord_;
-            labelercord_ = nullptr;
-        }
-        if (recordView != nullptr)
-        {
-            recordView->RemoveAll();
-            delete recordView;
-            recordView = nullptr;
-        }
-        if (container_ != nullptr)
-        {
-            container_->RemoveAll();
-            delete container_;
-            container_ = nullptr;
-        }
-    }
+        delete labelrecord_;
+        labelrecord_ = nullptr;
+
+        delete buttongo;
+        buttongo = nullptr;
+
+        delete imagerecord;
+        imagerecord = nullptr;
+
+        delete lackView;
+        lackView = nullptr;
+
+        delete TraingRecordList;
+        TraingRecordList = nullptr;
 
+        delete labelercord_;
+        labelercord_ = nullptr;
+
+        delete recordView;
+        recordView = nullptr;
+    }
     void TraingRecordView::PreLoad(void)
     {
         if (!viewiInitStatus)
@@ -308,6 +273,12 @@ namespace OHOS
     void TraingRecordView::OnStop()
     {
         View<TraingRecordPresenter>::OnStop();
+        if (container_ != nullptr)
+        {
+            container_->RemoveAll();
+            delete container_;
+            container_ = nullptr;
+        }
         RootView::GetInstance()->RemoveAll();
         return;
     }