Loading core/java/android/view/View.java +36 −38 Original line number Diff line number Diff line Loading @@ -3521,7 +3521,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * the stylus is touching the screen and the button has been pressed, this * is false once the stylus has been lifted. */ private boolean mInStylusButtonPress = false; private boolean mInStylusButtonPress; /** * Whether the next up event should be ignored for the purposes of gesture recognition. This is * true after a stylus button press has occured, when the next up event should not be recognized * as a tap. */ private boolean mIgnoreNextUpEvent; /** * The minimum height of the view. We'll try our best to have the height Loading Loading @@ -5230,26 +5237,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return handled; } /** * Checks for a stylus button press and calls the listener. * * @param event The event. * @return True if the event was consumed. */ private boolean performStylusActionOnButtonPress(MotionEvent event) { if (isStylusButtonPressable() && !mInStylusButtonPress && !mHasPerformedLongPress && event.isButtonPressed(MotionEvent.BUTTON_STYLUS_SECONDARY)) { if (performStylusButtonPress()) { mInStylusButtonPress = true; setPressed(true, event.getX(), event.getY()); removeTapCallback(); removeLongPressCallback(); return true; } } return false; } /** * Performs button-related actions during a touch down event. * Loading Loading @@ -9380,6 +9367,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return true; } switch (event.getActionMasked()) { case MotionEvent.ACTION_BUTTON_PRESS: if (isStylusButtonPressable() && !mInStylusButtonPress && !mHasPerformedLongPress && event.getActionButton() == MotionEvent.BUTTON_STYLUS_PRIMARY) { if (performStylusButtonPress()) { mInStylusButtonPress = true; setPressed(true, event.getX(), event.getY()); removeTapCallback(); removeLongPressCallback(); return true; } } break; case MotionEvent.ACTION_BUTTON_RELEASE: if (mInStylusButtonPress && event.getActionButton() == MotionEvent.BUTTON_STYLUS_PRIMARY) { mInStylusButtonPress = false; mIgnoreNextUpEvent = true; } break; } if (mInputEventConsistencyVerifier != null) { mInputEventConsistencyVerifier.onUnhandledEvent(event, 0); } Loading Loading @@ -10240,10 +10250,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, (viewFlags & STYLUS_BUTTON_PRESSABLE) == STYLUS_BUTTON_PRESSABLE) { switch (action) { case MotionEvent.ACTION_UP: if (mInStylusButtonPress) { mInStylusButtonPress = false; mHasPerformedLongPress = false; } boolean prepressed = (mPrivateFlags & PFLAG_PREPRESSED) != 0; if ((mPrivateFlags & PFLAG_PRESSED) != 0 || prepressed) { // take focus if we don't have it already and we should in Loading @@ -10261,7 +10267,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, setPressed(true, x, y); } if (!mHasPerformedLongPress) { if (!mHasPerformedLongPress && !mIgnoreNextUpEvent) { // This is a tap, so remove the longpress check removeLongPressCallback(); Loading Loading @@ -10293,15 +10299,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, removeTapCallback(); } mIgnoreNextUpEvent = false; break; case MotionEvent.ACTION_DOWN: mHasPerformedLongPress = false; mInStylusButtonPress = false; if (performStylusActionOnButtonPress(event)) { break; } if (performButtonActionOnTouchDown(event)) { break; Loading Loading @@ -10331,10 +10333,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, setPressed(false); removeTapCallback(); removeLongPressCallback(); if (mInStylusButtonPress) { mInStylusButtonPress = false; mHasPerformedLongPress = false; } mIgnoreNextUpEvent = false; break; case MotionEvent.ACTION_MOVE: Loading @@ -10350,9 +10351,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, setPressed(false); } } else if (performStylusActionOnButtonPress(event)) { // Check for stylus button press if we're within the view. break; } break; } Loading Loading
core/java/android/view/View.java +36 −38 Original line number Diff line number Diff line Loading @@ -3521,7 +3521,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * the stylus is touching the screen and the button has been pressed, this * is false once the stylus has been lifted. */ private boolean mInStylusButtonPress = false; private boolean mInStylusButtonPress; /** * Whether the next up event should be ignored for the purposes of gesture recognition. This is * true after a stylus button press has occured, when the next up event should not be recognized * as a tap. */ private boolean mIgnoreNextUpEvent; /** * The minimum height of the view. We'll try our best to have the height Loading Loading @@ -5230,26 +5237,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return handled; } /** * Checks for a stylus button press and calls the listener. * * @param event The event. * @return True if the event was consumed. */ private boolean performStylusActionOnButtonPress(MotionEvent event) { if (isStylusButtonPressable() && !mInStylusButtonPress && !mHasPerformedLongPress && event.isButtonPressed(MotionEvent.BUTTON_STYLUS_SECONDARY)) { if (performStylusButtonPress()) { mInStylusButtonPress = true; setPressed(true, event.getX(), event.getY()); removeTapCallback(); removeLongPressCallback(); return true; } } return false; } /** * Performs button-related actions during a touch down event. * Loading Loading @@ -9380,6 +9367,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return true; } switch (event.getActionMasked()) { case MotionEvent.ACTION_BUTTON_PRESS: if (isStylusButtonPressable() && !mInStylusButtonPress && !mHasPerformedLongPress && event.getActionButton() == MotionEvent.BUTTON_STYLUS_PRIMARY) { if (performStylusButtonPress()) { mInStylusButtonPress = true; setPressed(true, event.getX(), event.getY()); removeTapCallback(); removeLongPressCallback(); return true; } } break; case MotionEvent.ACTION_BUTTON_RELEASE: if (mInStylusButtonPress && event.getActionButton() == MotionEvent.BUTTON_STYLUS_PRIMARY) { mInStylusButtonPress = false; mIgnoreNextUpEvent = true; } break; } if (mInputEventConsistencyVerifier != null) { mInputEventConsistencyVerifier.onUnhandledEvent(event, 0); } Loading Loading @@ -10240,10 +10250,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, (viewFlags & STYLUS_BUTTON_PRESSABLE) == STYLUS_BUTTON_PRESSABLE) { switch (action) { case MotionEvent.ACTION_UP: if (mInStylusButtonPress) { mInStylusButtonPress = false; mHasPerformedLongPress = false; } boolean prepressed = (mPrivateFlags & PFLAG_PREPRESSED) != 0; if ((mPrivateFlags & PFLAG_PRESSED) != 0 || prepressed) { // take focus if we don't have it already and we should in Loading @@ -10261,7 +10267,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, setPressed(true, x, y); } if (!mHasPerformedLongPress) { if (!mHasPerformedLongPress && !mIgnoreNextUpEvent) { // This is a tap, so remove the longpress check removeLongPressCallback(); Loading Loading @@ -10293,15 +10299,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, removeTapCallback(); } mIgnoreNextUpEvent = false; break; case MotionEvent.ACTION_DOWN: mHasPerformedLongPress = false; mInStylusButtonPress = false; if (performStylusActionOnButtonPress(event)) { break; } if (performButtonActionOnTouchDown(event)) { break; Loading Loading @@ -10331,10 +10333,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, setPressed(false); removeTapCallback(); removeLongPressCallback(); if (mInStylusButtonPress) { mInStylusButtonPress = false; mHasPerformedLongPress = false; } mIgnoreNextUpEvent = false; break; case MotionEvent.ACTION_MOVE: Loading @@ -10350,9 +10351,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, setPressed(false); } } else if (performStylusActionOnButtonPress(event)) { // Check for stylus button press if we're within the view. break; } break; } Loading