Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Graphic Ui
提交
c78fee23
G
Graphic Ui
项目概览
OpenHarmony
/
Graphic Ui
10 个月 前同步成功
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Graphic Ui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
c78fee23
编写于
1月 12, 2022
作者:
O
openharmony_ci
提交者:
Gitee
1月 12, 2022
浏览文件
操作
浏览文件
下载
差异文件
!578 增加ScrollTop和ScrollBottom事件
Merge pull request !578 from 郝烁/master
上级
fdca0510
8a6312ef
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
51 addition
and
0 deletion
+51
-0
frameworks/components/ui_list.cpp
frameworks/components/ui_list.cpp
+25
-0
interfaces/kits/components/ui_list.h
interfaces/kits/components/ui_list.h
+26
-0
未找到文件。
frameworks/components/ui_list.cpp
浏览文件 @
c78fee23
...
...
@@ -354,6 +354,31 @@ bool UIList::MoveOffset(int16_t x, int16_t y)
scrollListener_
->
OnScrollStart
(
onSelectedIndex_
,
onSelectedView_
);
}
if
(
!
isLoopList_
&&
scrollListener_
)
{
if
(
direction_
==
VERTICAL
)
{
if
(
childrenHead_
&&
(
childrenHead_
->
GetViewIndex
()
==
startIndex_
)
&&
childrenHead_
->
GetRelativeRect
().
GetTop
()
>=
0
&&
childrenHead_
->
GetRelativeRect
().
GetTop
()
-
y
<
0
)
{
scrollListener_
->
OnScrollTop
(
childrenHead_
->
GetViewIndex
(),
childrenHead_
);
}
if
(
childrenTail_
&&
(
childrenTail_
->
GetViewIndex
()
==
recycle_
.
GetAdapterItemCount
()
-
1
)
&&
(
childrenTail_
->
GetRelativeRect
().
GetBottom
()
<=
GetContentRect
().
GetHeight
()
-
1
)
&&
(
childrenTail_
->
GetRelativeRect
().
GetBottom
()
-
y
>
GetContentRect
().
GetHeight
()
-
1
))
{
scrollListener_
->
OnScrollBottom
(
childrenTail_
->
GetViewIndex
(),
childrenTail_
);
}
}
else
{
if
(
childrenHead_
&&
(
childrenHead_
->
GetViewIndex
()
==
startIndex_
)
&&
childrenHead_
->
GetRelativeRect
().
GetLeft
()
>=
0
&&
childrenHead_
->
GetRelativeRect
().
GetLeft
()
-
x
<
0
)
{
scrollListener_
->
OnScrollTop
(
childrenHead_
->
GetViewIndex
(),
childrenHead_
);
}
if
(
childrenTail_
&&
(
childrenTail_
->
GetViewIndex
()
==
recycle_
.
GetAdapterItemCount
()
-
1
)
&&
(
childrenTail_
->
GetRelativeRect
().
GetRight
()
<=
GetContentRect
().
GetWidth
()
-
1
)
&&
(
childrenTail_
->
GetRelativeRect
().
GetRight
()
-
x
>
GetContentRect
().
GetWidth
()
-
1
))
{
scrollListener_
->
OnScrollBottom
(
childrenTail_
->
GetViewIndex
(),
childrenTail_
);
}
}
}
return
true
;
}
...
...
interfaces/kits/components/ui_list.h
浏览文件 @
c78fee23
...
...
@@ -93,6 +93,32 @@ public:
*/
virtual
void
OnScrollEnd
(
int16_t
index
,
UIView
*
view
)
{}
/**
* @brief Called when move to the top of scroll.
*
* @param index Indicates the index of the child view being selected at the preset position. This parameter should
* be set to {@link NULL_SELECT_INDEX} if no child view is selected or no position is preset.
* @param view Indicates the child view being selected at the preset position. This parameter should be set to
* <b>NULL</b> if no child view is selected or no position is preset.
* @since 8
* @version 8
*
*/
virtual
void
OnScrollTop
(
int16_t
index
,
UIView
*
view
)
{}
/**
* @brief Called when move to the bottom of scroll.
*
* @param index Indicates the index of the child view being selected at the preset position. This parameter should
* be set to {@link NULL_SELECT_INDEX} if no child view is selected or no position is preset.
* @param view Indicates the child view being selected at the preset position. This parameter should be set to
* <b>NULL</b> if no child view is selected or no position is preset.
* @since 8
* @version 8
*
*/
virtual
void
OnScrollBottom
(
int16_t
index
,
UIView
*
view
)
{}
/**
* @brief Called when a new child view is selected at the preset position as this list scrolls. For details about
* how to set the position, see {@link SetSelectPosition}.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录