修复训练记录列表滑动异常bug 475/2
authorCaisking <3449750381@qq.com>
Sat, 6 Jul 2024 09:01:56 +0000 (17:01 +0800)
committerCaisking <3449750381@qq.com>
Sat, 6 Jul 2024 09:01:56 +0000 (17:01 +0800)
code/sdk/application/wearable/fd230app/nativeui/message/include/MessagePresenter.h
code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h
code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordPresenter.h
code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordView.h
code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordView.cpp

index cf4e5e1..716f815 100644 (file)
@@ -1,4 +1,10 @@
-/*** 
+/***
+ * @Date: 2024-04-15 10:55:58
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-07-06 16:36:09
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/message/include/MessagePresenter.h
+ */
+/***
  * @Date: 2024-04-15 10:55:58
  * @LastEditors: Caisking 3449750381@qq.com
  * @LastEditTime: 2024-04-23 15:40:41
@@ -19,6 +25,7 @@ namespace OHOS
     class MessagePresenter : public Presenter<MessageView>,
                              public UIView::OnClickListener,
                              public UIView::OnDragListener,
+                             public ListScrollListener,
                              public UIList
     {
     public:
index b06fd2c..80d2e38 100644 (file)
@@ -43,7 +43,7 @@ namespace OHOS
     };
     class MessagePresenter;
     class MessageModel;
-    class MessageView : public View<MessagePresenter>, ListScrollListener
+    class MessageView : public View<MessagePresenter>, public ListScrollListener
     {
 
     public:
index 1330b25..6b9c102 100644 (file)
@@ -1,4 +1,10 @@
 /*** 
+ * @Date: 2024-05-20 19:40:41
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-07-06 16:36:57
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordPresenter.h
+ */
+/***
  * @Date: 2024-05-20 19:40:41
  * @LastEditors: Caisking 3449750381@qq.com
  * @LastEditTime: 2024-06-08 10:11:44
index 3daf075..c3cd229 100644 (file)
@@ -1,4 +1,10 @@
 /*** 
+ * @Date: 2024-05-20 19:40:41
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-07-06 16:38:46
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordView.h
+ */
+/***
  * @Date: 2024-05-20 19:40:41
  * @LastEditors: Caisking 3449750381@qq.com
  * @LastEditTime: 2024-06-11 09:40:10
@@ -41,7 +47,7 @@ namespace OHOS
     };
 
     class TraingRecordPresenter;
-    class TraingRecordView : public View<TraingRecordPresenter>
+    class TraingRecordView : public View<TraingRecordPresenter>, public ListScrollListener
     {
     public:
         TraingRecordView();
index 0a91efd..2849708 100644 (file)
@@ -14,10 +14,10 @@ namespace OHOS
     static const uint32_t BACK_GROUND_COLOR = 0xfff6f6f6;
     static TraingRecordView *g_pTraingRecordView{nullptr};
     static constexpr uint8_t NUM_2 = 2;
-    // static TraingMoreView *g_pTraingMoreView{nullptr};
-    static constexpr int16_t More_LIST_POSITION_X = 43;
-    static constexpr int16_t More_LIST_POSITION_Y = 120;
-    static constexpr int16_t More_SCROLLBLANKSIZE = 35; // 设置此滚动视图的空白大小。
+    // static TraingMOREView *g_pTraingMOREView{nullptr};
+    static constexpr int16_t MORE_LIST_POSITION_X = 43;
+    static constexpr int16_t MORE_LIST_POSITION_Y = 120;
+    static constexpr int16_t MORE_SCROLLBLANKSIZE = 35; // 设置此滚动视图的空白大小。
     static constexpr int16 MAX_SCR_DIS = 1000;
     static constexpr int16 LIST_POS = 20;
     static constexpr int16 SNUM_2 = 2;
@@ -201,18 +201,17 @@ namespace OHOS
         {
             TraingRecordList = new UIList();
         }
-        TraingRecordList->SetPosition(More_LIST_POSITION_X, More_LIST_POSITION_Y);
-        TraingRecordList->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION);
-        TraingRecordList->SetScrollBlankSize(More_SCROLLBLANKSIZE);
-        TraingRecordList->SetReboundSize(50);
-        TraingRecordList->SetSelectPosition(HORIZONTAL_RESOLUTION / SNUM_2); // middle position
-        TraingRecordList->SetDraggable(true);
+        TraingRecordList->SetPosition(MORE_LIST_POSITION_X, MORE_LIST_POSITION_Y, 466, 466);
+        TraingRecordList->SetScrollStateListener(this);
         TraingRecordList->SetThrowDrag(true);
-        TraingRecordList->EnableAutoAlign(true);
-        TraingRecordList->SetElastic(true); // 设置回弹效果
-        TraingRecordList->SetMaxScrollDistance(MAX_SCR_DIS);
-
-        recordView->SetYScrollBarVisible(true); // 设置滑动滚动条
+        TraingRecordList->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT);
+        // 设置手指抬起屏幕后的最大滚动距离
+        TraingRecordList->SetMaxScrollDistance(1000); // 1000: max scroll distance
+        // 设置手指抬起屏幕后的补偿距离
+        TraingRecordList->SetSwipeACCLevel(800); // 800: compensation distance
+        // 设置拖动加速
+        TraingRecordList->SetDragACCLevel(5); // 5: drag acceleration
+        TraingRecordList->SetYScrollBarVisible(true);
 
         TraingRecordList->SetOnClickListener(static_cast<UIView::OnClickListener *>(TraingRecordPresenter::GetInstance()));