Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6111377 authored by Jeff Brown's avatar Jeff Brown
Browse files

Remove edge slop support.

The edge slop feature was added a long time ago for a specific
device that had severe non-linear touch response issues near
the edges of its touch screen.  The feature is not useful on
modern hardware that is property calibrated.

Change-Id: I26716cbc7411c31883ddb4bb4ddd981027790d0f
parent a79f4b7d
Loading
Loading
Loading
Loading
+0 −45
Original line number Diff line number Diff line
@@ -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);
    }
+0 −8
Original line number Diff line number Diff line
@@ -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();
+0 −7
Original line number Diff line number Diff line
@@ -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();
        }
+0 −11
Original line number Diff line number Diff line
@@ -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}.
+0 −7
Original line number Diff line number Diff line
@@ -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();
        }
Loading