From: Caisking <3449750381@qq.com> Date: Sat, 6 Jul 2024 09:01:56 +0000 (+0800) Subject: 修复训练记录列表滑动异常bug X-Git-Tag: release_V1.2.70_20241020_135402~838^2~2 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F475%2F2;p=mirrors%2FFD230.git 修复训练记录列表滑动异常bug --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessagePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessagePresenter.h index cf4e5e188..716f81552 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessagePresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessagePresenter.h @@ -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, public UIView::OnClickListener, public UIView::OnDragListener, + public ListScrollListener, public UIList { public: diff --git a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h index b06fd2c5a..80d2e3813 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/message/include/MessageView.h @@ -43,7 +43,7 @@ namespace OHOS }; class MessagePresenter; class MessageModel; - class MessageView : public View, ListScrollListener + class MessageView : public View, public ListScrollListener { public: diff --git a/code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordPresenter.h index 1330b2539..6b9c10260 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordPresenter.h @@ -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 diff --git a/code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordView.h b/code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordView.h index 3daf075a1..c3cd229eb 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traingrecord/include/TraingRecordView.h @@ -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 + class TraingRecordView : public View, public ListScrollListener { public: TraingRecordView(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordView.cpp b/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordView.cpp index 0a91efd93..2849708fe 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/traingrecord/src/TraingRecordView.cpp @@ -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(TraingRecordPresenter::GetInstance()));