gpt4 book ai didi

android - android 5 onInterceptTouchEvent 模块中的 SwipeRefreshLayout.java 没有中断

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:14:35 27 4
gpt4 key购买 nike

我注意到该函数在 Action_down 之后没有中断,然后代码可以运行到 ACTION_MOVE,对吗?

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
ensureTarget();

final int action = MotionEventCompat.getActionMasked(ev);

if (mReturningToStart && action == MotionEvent.ACTION_DOWN) {
mReturningToStart = false;
}

if (!isEnabled() || mReturningToStart || canChildScrollUp() || mRefreshing) {
// Fail fast if we're not in a state where a swipe is possible
return false;
}

switch (action) {
case MotionEvent.ACTION_DOWN:
setTargetOffsetTopAndBottom(mOriginalOffsetTop - mCircleView.getTop(), true);
mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
mIsBeingDragged = false;
final float initialMotionY = getMotionEventY(ev, mActivePointerId);
if (initialMotionY == -1) {
return false;
}
mInitialMotionY = initialMotionY;
//-------NO Break here, why? It will run down to ACTION_MOVE
case MotionEvent.ACTION_MOVE:
if (mActivePointerId == INVALID_POINTER) {
Log.e(LOG_TAG, "Got ACTION_MOVE event but don't have an active pointer id.");
return false;
}
final float y = getMotionEventY(ev, mActivePointerId);
if (y == -1) {
return false;
}
final float yDiff = y - mInitialMotionY;
if (yDiff > mTouchSlop && !mIsBeingDragged) {
mIsBeingDragged = true;
mProgress.setAlpha(STARTING_PROGRESS_ALPHA);
}
break;

case MotionEventCompat.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;

case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
mIsBeingDragged = false;
mActivePointerId = INVALID_POINTER;
break;
}

return mIsBeingDragged;
}

我不知道为什么对待ACTION_DOWN然后直接对待ACTION_MOVE,这样对吗?提前致谢。

最佳答案

最后我在 google code 上发布了一个错误报告,它被接受到 future 的版本。 No break in SwipeRefreshLayout.java in android 5 onInterceptTouchEvent module

关于android - android 5 onInterceptTouchEvent 模块中的 SwipeRefreshLayout.java 没有中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26500767/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com