TouchTracker extends GestureDetector.SimpleOnGestureListener implements View.OnTouchListener, OrientationListener.Listener { @Override @BinderThread public void onOrientationChange(float[] deviceOrientationMatrix, float roll) { this.roll = -roll; } @SuppressWarnings({ "nullness:assignment.type.incompatible", "nullness:argument.type.incompatible" })  TouchTracker(Context context, Listener listener, float pxPerDegrees); void setSingleTapListener(@Nullable SingleTapListener listener); @Override boolean onTouch(View v, MotionEvent event); @Override boolean onDown(MotionEvent e); @Override boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY); @Override boolean onSingleTapUp(MotionEvent e); @Override @BinderThread void onOrientationChange(float[] deviceOrientationMatrix, float roll);  }
@Test public void testWithRoll90() { tracker.onOrientationChange(dummyMatrix, (float) Math.toRadians(90)); swipe(tracker, 0, 0, 0, 2 * SWIPE_PX); assertThat(yaw).isWithin(EPSILON).of(-2 * SWIPE_PX / PX_PER_DEGREES); swipe(tracker, 0, 0, -3 * SWIPE_PX, 0); assertThat(pitch).isWithin(EPSILON).of(3 * SWIPE_PX / PX_PER_DEGREES); }
@Test public void testWithRoll180() { tracker.onOrientationChange(dummyMatrix, (float) Math.toRadians(180)); swipe(tracker, 0, 0, -2 * SWIPE_PX, 0); assertThat(yaw).isWithin(EPSILON).of(-2 * SWIPE_PX / PX_PER_DEGREES); swipe(tracker, 0, 0, 0, -3 * SWIPE_PX); assertThat(pitch).isWithin(EPSILON).of(3 * SWIPE_PX / PX_PER_DEGREES); }
@Test public void testWithRoll270() { tracker.onOrientationChange(dummyMatrix, (float) Math.toRadians(270)); swipe(tracker, 0, 0, 0, -2 * SWIPE_PX); assertThat(yaw).isWithin(EPSILON).of(-2 * SWIPE_PX / PX_PER_DEGREES); swipe(tracker, 0, 0, 3 * SWIPE_PX, 0); assertThat(pitch).isWithin(EPSILON).of(3 * SWIPE_PX / PX_PER_DEGREES); }