Skip to content

Commit

Permalink
修改滑动拦截逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
lang-v committed Dec 27, 2020
1 parent aa1a008 commit b1032c5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ open class ElasticLayout @JvmOverloads constructor(
override fun scrollBy(x: Int, y: Int) {
scrollListener?.let {
if (it.preOnScrolled(scrollX, scrollY, x, y)) {
it.onScrolled(x,y)
return
}
}
Expand All @@ -230,6 +229,7 @@ open class ElasticLayout @JvmOverloads constructor(
} else {
super.scrollBy(x, 0)
}
scrollListener?.onScrolled(x,y)
if (isLoadingOrRefreshing()) return
val scrollOffset = getScrollOffset()
//更新控件header,footer状态
Expand Down Expand Up @@ -565,7 +565,7 @@ open class ElasticLayout @JvmOverloads constructor(
*
* @param dx
* @param dy 还未滑动的偏移值
* @return true 拦截滑动事件 接着就会调用onScrolled
* @return false 不拦截滑动事件 接着就会调用onScrolled
*/
fun preOnScrolled(scrollX: Int, scrollY: Int, dx: Int, dy: Int): Boolean

Expand Down

0 comments on commit b1032c5

Please sign in to comment.