@Test public void test_get_distance_point_for_bottom_right() { radialSort = new RadialSort(0, false, RadialSort.Position.BOTTOM_RIGHT); Mockito.when(mockParent.getWidth()).thenReturn(20); Mockito.when(mockParent.getHeight()).thenReturn(20); setupMockChildrenForPoint(20, 20); PointF resultPoint = radialSort.getDistancePoint(mockParent, mockChildren); assertEquals(new PointF(20F, 20F), resultPoint); }
@Override public PointF getDistancePoint(ViewGroup parent, List<View> children) { PointF distancePoint; switch (position) { case TOP_LEFT: distancePoint = new PointF(0, 0); break; case TOP_MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, 0); break; case TOP_RIGHT: distancePoint = new PointF(parent.getWidth(), 0); break; case LEFT: distancePoint = new PointF(0, parent.getHeight() / 2); break; case MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, parent.getHeight() / 2); break; case RIGHT: distancePoint = new PointF(parent.getWidth(), parent.getHeight() / 2); break; case BOTTOM_LEFT: distancePoint = new PointF(0, parent.getHeight()); break; case BOTTOM_MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, parent.getHeight()); break; case BOTTOM_RIGHT: distancePoint = new PointF(parent.getWidth(), parent.getHeight()); break; default: throw new AssertionError("Must be a valid Position argument type"); } return super.translate(distancePoint, children); }
RadialSort extends DistancedSort { @Override public PointF getDistancePoint(ViewGroup parent, List<View> children) { PointF distancePoint; switch (position) { case TOP_LEFT: distancePoint = new PointF(0, 0); break; case TOP_MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, 0); break; case TOP_RIGHT: distancePoint = new PointF(parent.getWidth(), 0); break; case LEFT: distancePoint = new PointF(0, parent.getHeight() / 2); break; case MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, parent.getHeight() / 2); break; case RIGHT: distancePoint = new PointF(parent.getWidth(), parent.getHeight() / 2); break; case BOTTOM_LEFT: distancePoint = new PointF(0, parent.getHeight()); break; case BOTTOM_MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, parent.getHeight()); break; case BOTTOM_RIGHT: distancePoint = new PointF(parent.getWidth(), parent.getHeight()); break; default: throw new AssertionError("Must be a valid Position argument type"); } return super.translate(distancePoint, children); } }
RadialSort extends DistancedSort { @Override public PointF getDistancePoint(ViewGroup parent, List<View> children) { PointF distancePoint; switch (position) { case TOP_LEFT: distancePoint = new PointF(0, 0); break; case TOP_MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, 0); break; case TOP_RIGHT: distancePoint = new PointF(parent.getWidth(), 0); break; case LEFT: distancePoint = new PointF(0, parent.getHeight() / 2); break; case MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, parent.getHeight() / 2); break; case RIGHT: distancePoint = new PointF(parent.getWidth(), parent.getHeight() / 2); break; case BOTTOM_LEFT: distancePoint = new PointF(0, parent.getHeight()); break; case BOTTOM_MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, parent.getHeight()); break; case BOTTOM_RIGHT: distancePoint = new PointF(parent.getWidth(), parent.getHeight()); break; default: throw new AssertionError("Must be a valid Position argument type"); } return super.translate(distancePoint, children); } RadialSort(long interObjectDelay, boolean reversed, Position position); }
RadialSort extends DistancedSort { @Override public PointF getDistancePoint(ViewGroup parent, List<View> children) { PointF distancePoint; switch (position) { case TOP_LEFT: distancePoint = new PointF(0, 0); break; case TOP_MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, 0); break; case TOP_RIGHT: distancePoint = new PointF(parent.getWidth(), 0); break; case LEFT: distancePoint = new PointF(0, parent.getHeight() / 2); break; case MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, parent.getHeight() / 2); break; case RIGHT: distancePoint = new PointF(parent.getWidth(), parent.getHeight() / 2); break; case BOTTOM_LEFT: distancePoint = new PointF(0, parent.getHeight()); break; case BOTTOM_MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, parent.getHeight()); break; case BOTTOM_RIGHT: distancePoint = new PointF(parent.getWidth(), parent.getHeight()); break; default: throw new AssertionError("Must be a valid Position argument type"); } return super.translate(distancePoint, children); } RadialSort(long interObjectDelay, boolean reversed, Position position); @Override PointF getDistancePoint(ViewGroup parent, List<View> children); }
RadialSort extends DistancedSort { @Override public PointF getDistancePoint(ViewGroup parent, List<View> children) { PointF distancePoint; switch (position) { case TOP_LEFT: distancePoint = new PointF(0, 0); break; case TOP_MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, 0); break; case TOP_RIGHT: distancePoint = new PointF(parent.getWidth(), 0); break; case LEFT: distancePoint = new PointF(0, parent.getHeight() / 2); break; case MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, parent.getHeight() / 2); break; case RIGHT: distancePoint = new PointF(parent.getWidth(), parent.getHeight() / 2); break; case BOTTOM_LEFT: distancePoint = new PointF(0, parent.getHeight()); break; case BOTTOM_MIDDLE: distancePoint = new PointF(parent.getWidth() / 2, parent.getHeight()); break; case BOTTOM_RIGHT: distancePoint = new PointF(parent.getWidth(), parent.getHeight()); break; default: throw new AssertionError("Must be a valid Position argument type"); } return super.translate(distancePoint, children); } RadialSort(long interObjectDelay, boolean reversed, Position position); @Override PointF getDistancePoint(ViewGroup parent, List<View> children);  }