Fix OnGestureListener nullability annotations
First motion event may be null in cases where the event stream is incomplete. Relnote: Fixed nullability for OnGestureListener methods Fixes: 249227476 Test: GestureDetectorTest Change-Id: I85117033e7dbb248e787de453857fff6b15e4474
This commit is contained in:
@@ -48386,9 +48386,9 @@ package android.view {
|
||||
|
||||
public static interface GestureDetector.OnGestureListener {
|
||||
method public boolean onDown(@NonNull android.view.MotionEvent);
|
||||
method public boolean onFling(@NonNull android.view.MotionEvent, @NonNull android.view.MotionEvent, float, float);
|
||||
method public boolean onFling(@Nullable android.view.MotionEvent, @NonNull android.view.MotionEvent, float, float);
|
||||
method public void onLongPress(@NonNull android.view.MotionEvent);
|
||||
method public boolean onScroll(@NonNull android.view.MotionEvent, @NonNull android.view.MotionEvent, float, float);
|
||||
method public boolean onScroll(@Nullable android.view.MotionEvent, @NonNull android.view.MotionEvent, float, float);
|
||||
method public void onShowPress(@NonNull android.view.MotionEvent);
|
||||
method public boolean onSingleTapUp(@NonNull android.view.MotionEvent);
|
||||
}
|
||||
@@ -48399,9 +48399,9 @@ package android.view {
|
||||
method public boolean onDoubleTap(@NonNull android.view.MotionEvent);
|
||||
method public boolean onDoubleTapEvent(@NonNull android.view.MotionEvent);
|
||||
method public boolean onDown(@NonNull android.view.MotionEvent);
|
||||
method public boolean onFling(@NonNull android.view.MotionEvent, @NonNull android.view.MotionEvent, float, float);
|
||||
method public boolean onFling(@Nullable android.view.MotionEvent, @NonNull android.view.MotionEvent, float, float);
|
||||
method public void onLongPress(@NonNull android.view.MotionEvent);
|
||||
method public boolean onScroll(@NonNull android.view.MotionEvent, @NonNull android.view.MotionEvent, float, float);
|
||||
method public boolean onScroll(@Nullable android.view.MotionEvent, @NonNull android.view.MotionEvent, float, float);
|
||||
method public void onShowPress(@NonNull android.view.MotionEvent);
|
||||
method public boolean onSingleTapConfirmed(@NonNull android.view.MotionEvent);
|
||||
method public boolean onSingleTapUp(@NonNull android.view.MotionEvent);
|
||||
|
||||
@@ -96,7 +96,8 @@ public class GestureDetector {
|
||||
* current move {@link MotionEvent}. The distance in x and y is also supplied for
|
||||
* convenience.
|
||||
*
|
||||
* @param e1 The first down motion event that started the scrolling.
|
||||
* @param e1 The first down motion event that started the scrolling. A {@code null} event
|
||||
* indicates an incomplete event stream or error state.
|
||||
* @param e2 The move motion event that triggered the current onScroll.
|
||||
* @param distanceX The distance along the X axis that has been scrolled since the last
|
||||
* call to onScroll. This is NOT the distance between {@code e1}
|
||||
@@ -106,7 +107,7 @@ public class GestureDetector {
|
||||
* and {@code e2}.
|
||||
* @return true if the event is consumed, else false
|
||||
*/
|
||||
boolean onScroll(@NonNull MotionEvent e1, @NonNull MotionEvent e2, float distanceX,
|
||||
boolean onScroll(@Nullable MotionEvent e1, @NonNull MotionEvent e2, float distanceX,
|
||||
float distanceY);
|
||||
|
||||
/**
|
||||
@@ -122,7 +123,8 @@ public class GestureDetector {
|
||||
* and the matching up {@link MotionEvent}. The calculated velocity is supplied along
|
||||
* the x and y axis in pixels per second.
|
||||
*
|
||||
* @param e1 The first down motion event that started the fling.
|
||||
* @param e1 The first down motion event that started the fling. A {@code null} event
|
||||
* indicates an incomplete event stream or error state.
|
||||
* @param e2 The move motion event that triggered the current onFling.
|
||||
* @param velocityX The velocity of this fling measured in pixels per second
|
||||
* along the x axis.
|
||||
@@ -130,7 +132,7 @@ public class GestureDetector {
|
||||
* along the y axis.
|
||||
* @return true if the event is consumed, else false
|
||||
*/
|
||||
boolean onFling(@NonNull MotionEvent e1, @NonNull MotionEvent e2, float velocityX,
|
||||
boolean onFling(@Nullable MotionEvent e1, @NonNull MotionEvent e2, float velocityX,
|
||||
float velocityY);
|
||||
}
|
||||
|
||||
@@ -201,12 +203,12 @@ public class GestureDetector {
|
||||
public void onLongPress(@NonNull MotionEvent e) {
|
||||
}
|
||||
|
||||
public boolean onScroll(@NonNull MotionEvent e1, @NonNull MotionEvent e2,
|
||||
public boolean onScroll(@Nullable MotionEvent e1, @NonNull MotionEvent e2,
|
||||
float distanceX, float distanceY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onFling(@NonNull MotionEvent e1, @NonNull MotionEvent e2, float velocityX,
|
||||
public boolean onFling(@Nullable MotionEvent e1, @NonNull MotionEvent e2, float velocityX,
|
||||
float velocityY) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user