@Test public void sendTouchEvent_whenReceiveTouchEventOutsideOfViewInYDirection_shouldResetAlertState() throws Exception { MotionEvent verticalMotion = MotionEvent.obtain(0, 0, MotionEvent.ACTION_MOVE, 160, 200, 0); subject.sendTouchEvent(verticalMotion); MotionEvent actualMotionEvent = shadowOf(subject).getOnTouchEventMotionEvent(); assertThat(actualMotionEvent).isNull(); verify(adAlertGestureListener).reset(); }
public void sendTouchEvent(MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_UP: if (mUserClickListener != null) { mUserClickListener.onUserClick(); } else { MoPubLog.d("View's onUserClick() is not registered."); } mAdAlertGestureListener.finishGestureDetection(); break; case MotionEvent.ACTION_DOWN: onTouchEvent(motionEvent); break; case MotionEvent.ACTION_MOVE: if (isMotionEventInView(motionEvent, mView)) { onTouchEvent(motionEvent); } else { resetAdFlaggingGesture(); } break; default: break; } }
ViewGestureDetector extends GestureDetector { public void sendTouchEvent(MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_UP: if (mUserClickListener != null) { mUserClickListener.onUserClick(); } else { MoPubLog.d("View's onUserClick() is not registered."); } mAdAlertGestureListener.finishGestureDetection(); break; case MotionEvent.ACTION_DOWN: onTouchEvent(motionEvent); break; case MotionEvent.ACTION_MOVE: if (isMotionEventInView(motionEvent, mView)) { onTouchEvent(motionEvent); } else { resetAdFlaggingGesture(); } break; default: break; } } }
ViewGestureDetector extends GestureDetector { public void sendTouchEvent(MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_UP: if (mUserClickListener != null) { mUserClickListener.onUserClick(); } else { MoPubLog.d("View's onUserClick() is not registered."); } mAdAlertGestureListener.finishGestureDetection(); break; case MotionEvent.ACTION_DOWN: onTouchEvent(motionEvent); break; case MotionEvent.ACTION_MOVE: if (isMotionEventInView(motionEvent, mView)) { onTouchEvent(motionEvent); } else { resetAdFlaggingGesture(); } break; default: break; } } ViewGestureDetector(@NonNull Context context, @NonNull View view, @Nullable AdReport adReport); private  ViewGestureDetector(Context context, View view, AdAlertGestureListener adAlertGestureListener); }
ViewGestureDetector extends GestureDetector { public void sendTouchEvent(MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_UP: if (mUserClickListener != null) { mUserClickListener.onUserClick(); } else { MoPubLog.d("View's onUserClick() is not registered."); } mAdAlertGestureListener.finishGestureDetection(); break; case MotionEvent.ACTION_DOWN: onTouchEvent(motionEvent); break; case MotionEvent.ACTION_MOVE: if (isMotionEventInView(motionEvent, mView)) { onTouchEvent(motionEvent); } else { resetAdFlaggingGesture(); } break; default: break; } } ViewGestureDetector(@NonNull Context context, @NonNull View view, @Nullable AdReport adReport); private  ViewGestureDetector(Context context, View view, AdAlertGestureListener adAlertGestureListener); void sendTouchEvent(MotionEvent motionEvent); void setUserClickListener(UserClickListener listener); }
ViewGestureDetector extends GestureDetector { public void sendTouchEvent(MotionEvent motionEvent) { switch (motionEvent.getAction()) { case MotionEvent.ACTION_UP: if (mUserClickListener != null) { mUserClickListener.onUserClick(); } else { MoPubLog.d("View's onUserClick() is not registered."); } mAdAlertGestureListener.finishGestureDetection(); break; case MotionEvent.ACTION_DOWN: onTouchEvent(motionEvent); break; case MotionEvent.ACTION_MOVE: if (isMotionEventInView(motionEvent, mView)) { onTouchEvent(motionEvent); } else { resetAdFlaggingGesture(); } break; default: break; } } ViewGestureDetector(@NonNull Context context, @NonNull View view, @Nullable AdReport adReport); private  ViewGestureDetector(Context context, View view, AdAlertGestureListener adAlertGestureListener); void sendTouchEvent(MotionEvent motionEvent); void setUserClickListener(UserClickListener listener);  }