From 54c12038e4d7309ed2478d5020cb556237410d43 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Sat, 6 Jul 2024 17:01:56 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E8=AE=AD=E7=BB=83=E8=AE=B0?= =?utf8?q?=E5=BD=95=E5=88=97=E8=A1=A8=E6=BB=91=E5=8A=A8=E5=BC=82=E5=B8=B8b?= =?utf8?q?ug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../message/include/MessagePresenter.h | 9 +++++- .../nativeui/message/include/MessageView.h | 2 +- .../include/TraingRecordPresenter.h | 6 ++++ .../traingrecord/include/TraingRecordView.h | 8 ++++- .../traingrecord/src/TraingRecordView.cpp | 29 +++++++++---------- 5 files changed, 36 insertions(+), 18 deletions(-) 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())); -- 2.17.1