Merge "Remove edge slop support."
This commit is contained in:
@@ -2684,51 +2684,6 @@ public final class ViewAncestor extends Handler implements ViewParent,
|
||||
return;
|
||||
}
|
||||
|
||||
// Apply edge slop and try again, if appropriate.
|
||||
final int edgeFlags = event.getEdgeFlags();
|
||||
if (edgeFlags != 0 && mView instanceof ViewGroup) {
|
||||
final int edgeSlop = mViewConfiguration.getScaledEdgeSlop();
|
||||
int direction = View.FOCUS_UP;
|
||||
int x = (int)event.getX();
|
||||
int y = (int)event.getY();
|
||||
final int[] deltas = new int[2];
|
||||
|
||||
if ((edgeFlags & MotionEvent.EDGE_TOP) != 0) {
|
||||
direction = View.FOCUS_DOWN;
|
||||
if ((edgeFlags & MotionEvent.EDGE_LEFT) != 0) {
|
||||
deltas[0] = edgeSlop;
|
||||
x += edgeSlop;
|
||||
} else if ((edgeFlags & MotionEvent.EDGE_RIGHT) != 0) {
|
||||
deltas[0] = -edgeSlop;
|
||||
x -= edgeSlop;
|
||||
}
|
||||
} else if ((edgeFlags & MotionEvent.EDGE_BOTTOM) != 0) {
|
||||
direction = View.FOCUS_UP;
|
||||
if ((edgeFlags & MotionEvent.EDGE_LEFT) != 0) {
|
||||
deltas[0] = edgeSlop;
|
||||
x += edgeSlop;
|
||||
} else if ((edgeFlags & MotionEvent.EDGE_RIGHT) != 0) {
|
||||
deltas[0] = -edgeSlop;
|
||||
x -= edgeSlop;
|
||||
}
|
||||
} else if ((edgeFlags & MotionEvent.EDGE_LEFT) != 0) {
|
||||
direction = View.FOCUS_RIGHT;
|
||||
} else if ((edgeFlags & MotionEvent.EDGE_RIGHT) != 0) {
|
||||
direction = View.FOCUS_LEFT;
|
||||
}
|
||||
|
||||
View nearest = FocusFinder.getInstance().findNearestTouchable(
|
||||
((ViewGroup) mView), x, y, direction, deltas);
|
||||
if (nearest != null) {
|
||||
event.offsetLocation(deltas[0], deltas[1]);
|
||||
event.setEdgeFlags(0);
|
||||
if (mView.dispatchPointerEvent(event)) {
|
||||
finishMotionEvent(event, sendDone, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Pointer event was unhandled.
|
||||
finishMotionEvent(event, sendDone, false);
|
||||
}
|
||||
|
||||
@@ -2840,14 +2840,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
}
|
||||
postDelayed(mPendingCheckForTap, ViewConfiguration.getTapTimeout());
|
||||
} else {
|
||||
if (ev.getEdgeFlags() != 0 && motionPosition < 0) {
|
||||
// If we couldn't find a view to click on, but the down event
|
||||
// was touching the edge, we will bail out and try again.
|
||||
// This allows the edge correcting code in ViewAncestor to try to
|
||||
// find a nearby view to select
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mTouchMode == TOUCH_MODE_FLING) {
|
||||
// Stopped a fling. It is a scroll.
|
||||
createScrollingCache();
|
||||
|
||||
@@ -498,13 +498,6 @@ public class HorizontalScrollView extends FrameLayout {
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
|
||||
// Don't handle edge touches immediately -- they may actually belong to one of our
|
||||
// descendants.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mVelocityTracker == null) {
|
||||
mVelocityTracker = VelocityTracker.obtain();
|
||||
}
|
||||
|
||||
@@ -3588,17 +3588,6 @@ public class ListView extends AbsListView {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
//noinspection SimplifiableIfStatement
|
||||
if (mItemsCanFocus && ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
|
||||
// Don't handle edge touches immediately -- they may actually belong to one of our
|
||||
// descendants.
|
||||
return false;
|
||||
}
|
||||
return super.onTouchEvent(ev);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set of checked items ids. The result is only valid if the
|
||||
* choice mode has not been set to {@link #CHOICE_MODE_NONE}.
|
||||
|
||||
@@ -506,13 +506,6 @@ public class ScrollView extends FrameLayout {
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
|
||||
// Don't handle edge touches immediately -- they may actually belong to one of our
|
||||
// descendants.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mVelocityTracker == null) {
|
||||
mVelocityTracker = VelocityTracker.obtain();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user