Description
/**
* 在动画执行时,触摸屏幕,打断动画,转为拖动状态
* @param action MotionEvent
* @return 是否成功打断
*/
protected boolean interceptAnimatorByAction(int action) {
if (action == MotionEvent.ACTION_DOWN) {
if (reboundAnimator != null) {
if (mState.isFinishing || mState == RefreshState.TwoLevelReleased || mState == RefreshState.RefreshReleased || mState == RefreshState.LoadReleased) {
return true;//完成动画和打开动画不能被打断
}
if (mState == RefreshState.PullDownCanceled) {
mKernel.setState(RefreshState.PullDownToRefresh);
} else if (mState == RefreshState.PullUpCanceled) {
mKernel.setState(RefreshState.PullUpToLoad);
}
reboundAnimator.setDuration(0);//cancel会触发End调用,可以判断0来确定是否被cancel
reboundAnimator.cancel();//会触发 cancel 和 end 调用
reboundAnimator = null;
}
animationRunnable = null;
}
return reboundAnimator != null;
}