记录一下几个常量
众所周知手放在屏幕上其实是一直在move的。考虑到安卓众多机型不同的屏幕分辨率,如何判断用户是在滑动成为了一个问题。对此安卓提供了一系列的常量,在不同的机型上是不一样的。
private val viewConfiguration = ViewConfiguration.get(context)
//Distance in pixels a touch can wander before we think the user is scrolling a full page
//在我们认为用户滚动整个页面之前,触摸可能会偏离的距离(以像素为单位)
private val pagingSlop = viewConfiguration.scaledPagingTouchSlop
//Distance in pixels a touch can wander before we think the user is scrolling
//触摸在我们认为用户滚动之前可能会徘徊的距离(以像素为单位)
private val touchSlop = viewConfiguration.scaledTouchSlop
// Distance in pixels a touch must be outside the bounds of a window for it to be counted as outside the window for purposes of dismissing that window.
// 触摸的距离(以像素为单位)必须在窗口边界之外,才能将其计为窗口外,以便关闭该窗口
private val windowTouchSlop = viewConfiguration.scaledWindowTouchSlop
//Distance in pixels between the first touch and second touch to still be considered a double tap
//第一次触摸和第二次触摸之间的距离(以像素为单位)仍被视为双击
private val doubleTapSlop = viewConfiguration.scaledDoubleTapSlop
//Inset in pixels to look for touchable content when the user touches the edge of the screen
//以像素为单位插入,以便在用户触摸屏幕边缘时查找可触摸的内容
private val edgeSlop = viewConfiguration.scaledEdgeSlop
//Minimum velocity to initiate a fling, as measured in pixels per second.
//启动投掷的最小速度,以每秒像素数为单位。
private val minVelocity = viewConfiguration.scaledMinimumFlingVelocity
//启动投掷的最大速度,以每秒像素数为单位。
private val maxVelocity = viewConfiguration.scaledMaximumFlingVelocity