Loading core/java/android/view/SimulatedTrackball.java +21 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import android.content.Intent; import android.os.Handler; import android.os.Handler.Callback; import android.os.Message; Loading @@ -33,6 +34,8 @@ class SimulatedTrackball { // event for it to be considered a tap // TODO:Read this value from a configuration file private static final int MAX_TAP_TIME = 250; // Where the cutoff is for determining an edge swipe private static final float EDGE_SWIPE_THRESHOLD = 0.9f; private static final int FLICK_MSG_ID = 313; // The position of the previous touchpad event Loading @@ -47,6 +50,8 @@ class SimulatedTrackball { private long mLastTouchPadKeySendTimeMs = 0; // When the most recent touch event of any type occurred private long mLastTouchPadEventTimeMs = 0; // Did the swipe begin in a valid region private boolean mEdgeSwipePossible; // How quickly keys were sent; private int mKeySendRateMs = 0; Loading Loading @@ -131,8 +136,14 @@ class SimulatedTrackball { mAccumulatedY = 0; mLastMoveX = 0; mLastMoveY = 0; if (event.getDevice().getMotionRange(MotionEvent.AXIS_Y).getMax() * EDGE_SWIPE_THRESHOLD < event.getY()) { // Did the swipe begin in a valid region mEdgeSwipePossible = true; } // Clear any flings mHandler.removeMessages(FLICK_MSG_ID); break; case MotionEvent.ACTION_HOVER_MOVE: // Determine whether the move is slop or an intentional move Loading @@ -141,7 +152,15 @@ class SimulatedTrackball { if (mTouchSlopSquared < deltaX * deltaX + deltaY * deltaY) { mAlwaysInTapRegion = false; } // Checks if the swipe has crossed the midpoint // and if our swipe gesture is complete if (event.getY() < (event.getDevice().getMotionRange(MotionEvent.AXIS_Y).getMax() * .5) && mEdgeSwipePossible) { mEdgeSwipePossible = false; Intent intent = new Intent("android.search.action.GLOBAL_SEARCH"); intent.addCategory("android.intent.category.DEFAULT"); viewroot.mView.getContext().startActivity(intent); } // Find the difference in position between the two most recent // touchpad events mLastMoveX = event.getX() - mLastTouchpadXPosition; Loading Loading @@ -222,6 +241,7 @@ class SimulatedTrackball { mHandler.sendMessageDelayed(message, mKeySendRateMs); } } mEdgeSwipePossible = false; break; } // Store touch event position and time Loading Loading
core/java/android/view/SimulatedTrackball.java +21 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import android.content.Intent; import android.os.Handler; import android.os.Handler.Callback; import android.os.Message; Loading @@ -33,6 +34,8 @@ class SimulatedTrackball { // event for it to be considered a tap // TODO:Read this value from a configuration file private static final int MAX_TAP_TIME = 250; // Where the cutoff is for determining an edge swipe private static final float EDGE_SWIPE_THRESHOLD = 0.9f; private static final int FLICK_MSG_ID = 313; // The position of the previous touchpad event Loading @@ -47,6 +50,8 @@ class SimulatedTrackball { private long mLastTouchPadKeySendTimeMs = 0; // When the most recent touch event of any type occurred private long mLastTouchPadEventTimeMs = 0; // Did the swipe begin in a valid region private boolean mEdgeSwipePossible; // How quickly keys were sent; private int mKeySendRateMs = 0; Loading Loading @@ -131,8 +136,14 @@ class SimulatedTrackball { mAccumulatedY = 0; mLastMoveX = 0; mLastMoveY = 0; if (event.getDevice().getMotionRange(MotionEvent.AXIS_Y).getMax() * EDGE_SWIPE_THRESHOLD < event.getY()) { // Did the swipe begin in a valid region mEdgeSwipePossible = true; } // Clear any flings mHandler.removeMessages(FLICK_MSG_ID); break; case MotionEvent.ACTION_HOVER_MOVE: // Determine whether the move is slop or an intentional move Loading @@ -141,7 +152,15 @@ class SimulatedTrackball { if (mTouchSlopSquared < deltaX * deltaX + deltaY * deltaY) { mAlwaysInTapRegion = false; } // Checks if the swipe has crossed the midpoint // and if our swipe gesture is complete if (event.getY() < (event.getDevice().getMotionRange(MotionEvent.AXIS_Y).getMax() * .5) && mEdgeSwipePossible) { mEdgeSwipePossible = false; Intent intent = new Intent("android.search.action.GLOBAL_SEARCH"); intent.addCategory("android.intent.category.DEFAULT"); viewroot.mView.getContext().startActivity(intent); } // Find the difference in position between the two most recent // touchpad events mLastMoveX = event.getX() - mLastTouchpadXPosition; Loading Loading @@ -222,6 +241,7 @@ class SimulatedTrackball { mHandler.sendMessageDelayed(message, mKeySendRateMs); } } mEdgeSwipePossible = false; break; } // Store touch event position and time Loading