Skip to content

PullUpCanceled或自动刷新PullDownToRefresh执行动画过程中,触摸子View时存在getParent().requestDisallowInterceptTouchEvent(true)会触发interceptAnimatorByAction取消动画被打断,导致无法恢复默认状态 #1595

Open
@libin1993

Description

@libin1993

/**
* 在动画执行时,触摸屏幕,打断动画,转为拖动状态
* @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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions