@Test public void filterNonZeroIds_returns_shorterArray_whenThereAre_zeros_inPassedArray() { StaggeredAnimationGroup spiedGroup = prepareSpiedGroup(); int[] testIds = new int[]{1, 2, 3, 4, 0, 0, 0, 0}; int[] filtered = spiedGroup.filterNonZeroIds(testIds); assertThat(filtered).asList().containsExactly(1, 2, 3, 4).inOrder(); }
@VisibleForTesting final int[] filterNonZeroIds(int[] allIds) { int nonZeroIdsCount = 0; for (int id : allIds) { if (id != 0) { nonZeroIdsCount++; } } if (nonZeroIdsCount == allIds.length) { return allIds; } int[] groupIds = new int[nonZeroIdsCount]; for (int i = 0; i < nonZeroIdsCount; i++) { groupIds[i] = allIds[i]; } return groupIds; }
StaggeredAnimationGroup extends Group { @VisibleForTesting final int[] filterNonZeroIds(int[] allIds) { int nonZeroIdsCount = 0; for (int id : allIds) { if (id != 0) { nonZeroIdsCount++; } } if (nonZeroIdsCount == allIds.length) { return allIds; } int[] groupIds = new int[nonZeroIdsCount]; for (int i = 0; i < nonZeroIdsCount; i++) { groupIds[i] = allIds[i]; } return groupIds; } }
StaggeredAnimationGroup extends Group { @VisibleForTesting final int[] filterNonZeroIds(int[] allIds) { int nonZeroIdsCount = 0; for (int id : allIds) { if (id != 0) { nonZeroIdsCount++; } } if (nonZeroIdsCount == allIds.length) { return allIds; } int[] groupIds = new int[nonZeroIdsCount]; for (int i = 0; i < nonZeroIdsCount; i++) { groupIds[i] = allIds[i]; } return groupIds; } StaggeredAnimationGroup(Context context);  StaggeredAnimationGroup(Context context, AttributeSet attrs);  StaggeredAnimationGroup(Context context, AttributeSet attrs, int defStyleAttr); }
StaggeredAnimationGroup extends Group { @VisibleForTesting final int[] filterNonZeroIds(int[] allIds) { int nonZeroIdsCount = 0; for (int id : allIds) { if (id != 0) { nonZeroIdsCount++; } } if (nonZeroIdsCount == allIds.length) { return allIds; } int[] groupIds = new int[nonZeroIdsCount]; for (int i = 0; i < nonZeroIdsCount; i++) { groupIds[i] = allIds[i]; } return groupIds; } StaggeredAnimationGroup(Context context);  StaggeredAnimationGroup(Context context, AttributeSet attrs);  StaggeredAnimationGroup(Context context, AttributeSet attrs, int defStyleAttr); final void show(); final void show(boolean inReversedOrder); final void hide(); final void hide(boolean inReversedOrder); final void setPartialTransitionFactory(@NonNull PartialTransitionFactory factory); final void clearPartialTransitionFactory(); final void setOnTransitionPreparedListener(@NonNull OnTransitionPreparedListener listener); final void clearOnTransitionPreparedListener(); final void setPartialDuration(int partialDuration); final void setPartialDelay(int partialDelay); final void setPartialInterpolator(TimeInterpolator partialInterpolator); }
StaggeredAnimationGroup extends Group { @VisibleForTesting final int[] filterNonZeroIds(int[] allIds) { int nonZeroIdsCount = 0; for (int id : allIds) { if (id != 0) { nonZeroIdsCount++; } } if (nonZeroIdsCount == allIds.length) { return allIds; } int[] groupIds = new int[nonZeroIdsCount]; for (int i = 0; i < nonZeroIdsCount; i++) { groupIds[i] = allIds[i]; } return groupIds; } StaggeredAnimationGroup(Context context);  StaggeredAnimationGroup(Context context, AttributeSet attrs);  StaggeredAnimationGroup(Context context, AttributeSet attrs, int defStyleAttr); final void show(); final void show(boolean inReversedOrder); final void hide(); final void hide(boolean inReversedOrder); final void setPartialTransitionFactory(@NonNull PartialTransitionFactory factory); final void clearPartialTransitionFactory(); final void setOnTransitionPreparedListener(@NonNull OnTransitionPreparedListener listener); final void clearOnTransitionPreparedListener(); final void setPartialDuration(int partialDuration); final void setPartialDelay(int partialDelay); final void setPartialInterpolator(TimeInterpolator partialInterpolator);  }