@Test public void noViewsFoundWithinGivenBounds() { setUpViews(mParentBound1, mChildrenBound1); @ViewBoundsCheck.ViewBounds int preferredBoundsFlag = (ViewBoundsCheck.FLAG_CVS_LT_PVS | ViewBoundsCheck.FLAG_CVE_GT_PVE); @ViewBoundsCheck.ViewBounds int acceptableBoundsFlag = preferredBoundsFlag; View view = mBoundCheck.findOneViewWithinBoundFlags(0, mChildren.length, preferredBoundsFlag, acceptableBoundsFlag); assertNull("Null should be returned since no views are within the given bounds", view); }
View findOneViewWithinBoundFlags(int fromIndex, int toIndex, @ViewBounds int preferredBoundFlags, @ViewBounds int acceptableBoundFlags) { final int start = mCallback.getParentStart(); final int end = mCallback.getParentEnd(); final int next = toIndex > fromIndex ? 1 : -1; View acceptableMatch = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = mCallback.getChildAt(i); final int childStart = mCallback.getChildStart(child); final int childEnd = mCallback.getChildEnd(child); mBoundFlags.setBounds(start, end, childStart, childEnd); if (preferredBoundFlags != 0) { mBoundFlags.resetFlags(); mBoundFlags.addFlags(preferredBoundFlags); if (mBoundFlags.boundsMatch()) { return child; } } if (acceptableBoundFlags != 0) { mBoundFlags.resetFlags(); mBoundFlags.addFlags(acceptableBoundFlags); if (mBoundFlags.boundsMatch()) { acceptableMatch = child; } } } return acceptableMatch; }
ViewBoundsCheck { View findOneViewWithinBoundFlags(int fromIndex, int toIndex, @ViewBounds int preferredBoundFlags, @ViewBounds int acceptableBoundFlags) { final int start = mCallback.getParentStart(); final int end = mCallback.getParentEnd(); final int next = toIndex > fromIndex ? 1 : -1; View acceptableMatch = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = mCallback.getChildAt(i); final int childStart = mCallback.getChildStart(child); final int childEnd = mCallback.getChildEnd(child); mBoundFlags.setBounds(start, end, childStart, childEnd); if (preferredBoundFlags != 0) { mBoundFlags.resetFlags(); mBoundFlags.addFlags(preferredBoundFlags); if (mBoundFlags.boundsMatch()) { return child; } } if (acceptableBoundFlags != 0) { mBoundFlags.resetFlags(); mBoundFlags.addFlags(acceptableBoundFlags); if (mBoundFlags.boundsMatch()) { acceptableMatch = child; } } } return acceptableMatch; } }
ViewBoundsCheck { View findOneViewWithinBoundFlags(int fromIndex, int toIndex, @ViewBounds int preferredBoundFlags, @ViewBounds int acceptableBoundFlags) { final int start = mCallback.getParentStart(); final int end = mCallback.getParentEnd(); final int next = toIndex > fromIndex ? 1 : -1; View acceptableMatch = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = mCallback.getChildAt(i); final int childStart = mCallback.getChildStart(child); final int childEnd = mCallback.getChildEnd(child); mBoundFlags.setBounds(start, end, childStart, childEnd); if (preferredBoundFlags != 0) { mBoundFlags.resetFlags(); mBoundFlags.addFlags(preferredBoundFlags); if (mBoundFlags.boundsMatch()) { return child; } } if (acceptableBoundFlags != 0) { mBoundFlags.resetFlags(); mBoundFlags.addFlags(acceptableBoundFlags); if (mBoundFlags.boundsMatch()) { acceptableMatch = child; } } } return acceptableMatch; } ViewBoundsCheck(Callback callback); }
ViewBoundsCheck { View findOneViewWithinBoundFlags(int fromIndex, int toIndex, @ViewBounds int preferredBoundFlags, @ViewBounds int acceptableBoundFlags) { final int start = mCallback.getParentStart(); final int end = mCallback.getParentEnd(); final int next = toIndex > fromIndex ? 1 : -1; View acceptableMatch = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = mCallback.getChildAt(i); final int childStart = mCallback.getChildStart(child); final int childEnd = mCallback.getChildEnd(child); mBoundFlags.setBounds(start, end, childStart, childEnd); if (preferredBoundFlags != 0) { mBoundFlags.resetFlags(); mBoundFlags.addFlags(preferredBoundFlags); if (mBoundFlags.boundsMatch()) { return child; } } if (acceptableBoundFlags != 0) { mBoundFlags.resetFlags(); mBoundFlags.addFlags(acceptableBoundFlags); if (mBoundFlags.boundsMatch()) { acceptableMatch = child; } } } return acceptableMatch; } ViewBoundsCheck(Callback callback);  }
ViewBoundsCheck { View findOneViewWithinBoundFlags(int fromIndex, int toIndex, @ViewBounds int preferredBoundFlags, @ViewBounds int acceptableBoundFlags) { final int start = mCallback.getParentStart(); final int end = mCallback.getParentEnd(); final int next = toIndex > fromIndex ? 1 : -1; View acceptableMatch = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = mCallback.getChildAt(i); final int childStart = mCallback.getChildStart(child); final int childEnd = mCallback.getChildEnd(child); mBoundFlags.setBounds(start, end, childStart, childEnd); if (preferredBoundFlags != 0) { mBoundFlags.resetFlags(); mBoundFlags.addFlags(preferredBoundFlags); if (mBoundFlags.boundsMatch()) { return child; } } if (acceptableBoundFlags != 0) { mBoundFlags.resetFlags(); mBoundFlags.addFlags(acceptableBoundFlags); if (mBoundFlags.boundsMatch()) { acceptableMatch = child; } } } return acceptableMatch; } ViewBoundsCheck(Callback callback);   }