以下是重构后的代码:
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN && event.getEdgeFlags() != 0) {
return false;
}
obtainVelocityTracker(event);
final int action = event.getAction();
final float x = event.getX();
final float y = event.getY();
switch (action) {
case MotionEvent.ACTION_DOWN:
LogUtil.log(TAG, "ACTION_DOWN#currentScrollY:" + getScrollY() + ", mLastMotionY:" + mLastMotionY, LogUtil.LOG_E);
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
mLastMotionY = y;
break;
case MotionEvent.ACTION_MOVE:
final int deltaY = (int) (mLastMotionY - y);
mLastMotionY = y;
if (deltaY < 0) {
if (getScrollY() > 0) {
scrollBy(0, deltaY);
}
} else if (deltaY > 0) {
mIsInEdge = getScrollY() <= childTotalHeight - height;
if (mIsInEdge) {
scrollBy(0, deltaY);
}
}
}
}
请根据以下内容完成段落结构重构:
```java
}
break;
case MotionEvent.ACTION_UP:
final VelocityTracker velocityTracker = mVelocityTracker;
velocityTracker.computeCurrentVelocity(1000, mMaximumVelocity);
int initialVelocity = (int) velocityTracker.getYVelocity();
if (Math.abs(initialVelocity) > mMinimumVelocity && getChildCount() > 0) {
fling(-initialVelocity);
}
releaseVelocityTracker();
break;
return true;
}
```