@Test public void test_inter_object_delay_of_views_is_set_on_default_sort() { List<SpruceTimedView> resultViews = new DefaultSort(1) .getViewListWithTimeOffsets(mockParent, mockChildren); Assert.assertEquals(0, resultViews.get(0).getTimeOffset()); Assert.assertEquals(1, resultViews.get(1).getTimeOffset()); Assert.assertEquals(2, resultViews.get(2).getTimeOffset()); }
@Override public List<SpruceTimedView> getViewListWithTimeOffsets(ViewGroup parent, List<View> children) { List<SpruceTimedView> childTimedViews = new ArrayList<>(); long currentTimeOffset = 0L; for (View childView : children) { childTimedViews.add(new SpruceTimedView(childView, currentTimeOffset)); currentTimeOffset += interObjectDelay; } return childTimedViews; }
DefaultSort extends SortFunction { @Override public List<SpruceTimedView> getViewListWithTimeOffsets(ViewGroup parent, List<View> children) { List<SpruceTimedView> childTimedViews = new ArrayList<>(); long currentTimeOffset = 0L; for (View childView : children) { childTimedViews.add(new SpruceTimedView(childView, currentTimeOffset)); currentTimeOffset += interObjectDelay; } return childTimedViews; } }
DefaultSort extends SortFunction { @Override public List<SpruceTimedView> getViewListWithTimeOffsets(ViewGroup parent, List<View> children) { List<SpruceTimedView> childTimedViews = new ArrayList<>(); long currentTimeOffset = 0L; for (View childView : children) { childTimedViews.add(new SpruceTimedView(childView, currentTimeOffset)); currentTimeOffset += interObjectDelay; } return childTimedViews; } DefaultSort(long interObjectDelay); }
DefaultSort extends SortFunction { @Override public List<SpruceTimedView> getViewListWithTimeOffsets(ViewGroup parent, List<View> children) { List<SpruceTimedView> childTimedViews = new ArrayList<>(); long currentTimeOffset = 0L; for (View childView : children) { childTimedViews.add(new SpruceTimedView(childView, currentTimeOffset)); currentTimeOffset += interObjectDelay; } return childTimedViews; } DefaultSort(long interObjectDelay); @Override List<SpruceTimedView> getViewListWithTimeOffsets(ViewGroup parent, List<View> children); @Override void sortChildren(ViewGroup parent, List<View> children); }
DefaultSort extends SortFunction { @Override public List<SpruceTimedView> getViewListWithTimeOffsets(ViewGroup parent, List<View> children) { List<SpruceTimedView> childTimedViews = new ArrayList<>(); long currentTimeOffset = 0L; for (View childView : children) { childTimedViews.add(new SpruceTimedView(childView, currentTimeOffset)); currentTimeOffset += interObjectDelay; } return childTimedViews; } DefaultSort(long interObjectDelay); @Override List<SpruceTimedView> getViewListWithTimeOffsets(ViewGroup parent, List<View> children); @Override void sortChildren(ViewGroup parent, List<View> children);  }