Package io.rong.imkit.widget.refresh.api
Interface RefreshComponent
-
- All Implemented Interfaces:
public interface RefreshComponent
刷新内部组件 Created by scwang on 2017/5/26.
-
-
Method Summary
Modifier and Type Method Description abstract View
getView()
获取实体视图 abstract SpinnerStyle
getSpinnerStyle()
获取变换方式 SpinnerStyle 必须返回 非空 abstract void
setPrimaryColors(Array<int> colors)
【仅限框架内调用】设置主题颜色 abstract void
onInitialized(RefreshKernel kernel, int height, int maxDragHeight)
【仅限框架内调用】尺寸定义完成 (如果高度不改变(代码修改:setHeader),只调用一次, 在RefreshLayout#onMeasure中调用) abstract void
onMoving(boolean isDragging, float percent, int offset, int height, int maxDragHeight)
【仅限框架内调用】手指拖动下拉(会连续多次调用,添加isDragging并取代之前的onPulling、onReleasing) abstract void
onReleased(RefreshLayout refreshLayout, int height, int maxDragHeight)
【仅限框架内调用】释放时刻(调用一次,将会触发加载) abstract void
onStartAnimator(RefreshLayout refreshLayout, int height, int maxDragHeight)
【仅限框架内调用】开始动画 abstract int
onFinish(RefreshLayout refreshLayout, boolean success)
【仅限框架内调用】动画结束 abstract void
onHorizontalDrag(float percentX, int offsetX, int offsetMax)
【仅限框架内调用】水平方向的拖动 abstract boolean
isSupportHorizontalDrag()
是否支持水平方向的拖动(将会影响到onHorizontalDrag的调用) -
-
Method Detail
-
getView
abstract View getView()
获取实体视图
- Returns:
实体视图
-
getSpinnerStyle
abstract SpinnerStyle getSpinnerStyle()
获取变换方式 SpinnerStyle 必须返回 非空
- Returns:
变换方式
-
setPrimaryColors
abstract void setPrimaryColors(Array<int> colors)
【仅限框架内调用】设置主题颜色
- Parameters:
colors
- 对应Xml中配置的 srlPrimaryColor srlAccentColor
-
onInitialized
abstract void onInitialized(RefreshKernel kernel, int height, int maxDragHeight)
【仅限框架内调用】尺寸定义完成 (如果高度不改变(代码修改:setHeader),只调用一次, 在RefreshLayout#onMeasure中调用)
- Parameters:
kernel
- RefreshKernelheight
- HeaderHeight or FooterHeightmaxDragHeight
- 最大拖动高度
-
onMoving
abstract void onMoving(boolean isDragging, float percent, int offset, int height, int maxDragHeight)
【仅限框架内调用】手指拖动下拉(会连续多次调用,添加isDragging并取代之前的onPulling、onReleasing)
- Parameters:
isDragging
- true 手指正在拖动 false 回弹动画percent
- 下拉的百分比 值 = offset/footerHeight (0 - percent - (footerHeight+maxDragHeight) / footerHeight )offset
- 下拉的像素偏移量 0 - offset - (footerHeight+maxDragHeight)height
- 高度 HeaderHeight or FooterHeight (offset 可以超过 height 此时 percent 大于 1)maxDragHeight
- 最大拖动高度 offset 可以超过 height 参数 但是不会超过 maxDragHeight
-
onReleased
abstract void onReleased(RefreshLayout refreshLayout, int height, int maxDragHeight)
【仅限框架内调用】释放时刻(调用一次,将会触发加载)
- Parameters:
refreshLayout
- RefreshLayoutheight
- 高度 HeaderHeight or FooterHeightmaxDragHeight
- 最大拖动高度
-
onStartAnimator
abstract void onStartAnimator(RefreshLayout refreshLayout, int height, int maxDragHeight)
【仅限框架内调用】开始动画
- Parameters:
refreshLayout
- RefreshLayoutheight
- HeaderHeight or FooterHeightmaxDragHeight
- 最大拖动高度
-
onFinish
abstract int onFinish(RefreshLayout refreshLayout, boolean success)
【仅限框架内调用】动画结束
- Parameters:
refreshLayout
- RefreshLayoutsuccess
- 数据是否成功刷新或加载- Returns:
完成动画所需时间 如果返回 Integer.MAX_VALUE 将取消本次完成事件,继续保持原有状态
-
onHorizontalDrag
abstract void onHorizontalDrag(float percentX, int offsetX, int offsetMax)
【仅限框架内调用】水平方向的拖动
- Parameters:
percentX
- 下拉时,手指水平坐标对屏幕的占比(0 - percentX - 1)offsetX
- 下拉时,手指水平坐标对屏幕的偏移(0 - offsetX - LayoutWidth)offsetMax
- 最大的偏移量
-
isSupportHorizontalDrag
abstract boolean isSupportHorizontalDrag()
是否支持水平方向的拖动(将会影响到onHorizontalDrag的调用)
- Returns:
水平拖动需要消耗更多的时间和资源,所以如果不支持请返回false
-
-
-
-