@Test public void testGetAngle() { assertEquals(0, mArcSwipeUnderTest.getAngle(200, 0), 0.0f); assertEquals(90, mArcSwipeUnderTest.getAngle(400, 200), 0.0f); assertEquals(180, mArcSwipeUnderTest.getAngle(200, 400), 0.0f); assertEquals(270, mArcSwipeUnderTest.getAngle(0, 200), 0.0f); }
@VisibleForTesting float getAngle(double x, double y) { double relativeX = x - (mBounds.width() / 2); double relativeY = y - (mBounds.height() / 2); double rowAngle = Math.atan2(relativeX, relativeY); double angle = -Math.toDegrees(rowAngle) - 180; if (angle < 0) { angle += 360; } return (float) angle; }
ArcSwipe implements Swiper { @VisibleForTesting float getAngle(double x, double y) { double relativeX = x - (mBounds.width() / 2); double relativeY = y - (mBounds.height() / 2); double rowAngle = Math.atan2(relativeX, relativeY); double angle = -Math.toDegrees(rowAngle) - 180; if (angle < 0) { angle += 360; } return (float) angle; } }
ArcSwipe implements Swiper { @VisibleForTesting float getAngle(double x, double y) { double relativeX = x - (mBounds.width() / 2); double relativeY = y - (mBounds.height() / 2); double rowAngle = Math.atan2(relativeX, relativeY); double angle = -Math.toDegrees(rowAngle) - 180; if (angle < 0) { angle += 360; } return (float) angle; } ArcSwipe(Gesture gesture, RectF bounds); }
ArcSwipe implements Swiper { @VisibleForTesting float getAngle(double x, double y) { double relativeX = x - (mBounds.width() / 2); double relativeY = y - (mBounds.height() / 2); double rowAngle = Math.atan2(relativeX, relativeY); double angle = -Math.toDegrees(rowAngle) - 180; if (angle < 0) { angle += 360; } return (float) angle; } ArcSwipe(Gesture gesture, RectF bounds); @Override Swiper.Status sendSwipe(
            UiController uiController,
            float[] startCoordinates,
            float[] endCoordinates,
            float[] precision); }
ArcSwipe implements Swiper { @VisibleForTesting float getAngle(double x, double y) { double relativeX = x - (mBounds.width() / 2); double relativeY = y - (mBounds.height() / 2); double rowAngle = Math.atan2(relativeX, relativeY); double angle = -Math.toDegrees(rowAngle) - 180; if (angle < 0) { angle += 360; } return (float) angle; } ArcSwipe(Gesture gesture, RectF bounds); @Override Swiper.Status sendSwipe(
            UiController uiController,
            float[] startCoordinates,
            float[] endCoordinates,
            float[] precision);  }