Merge "Replace stream operation with simple iteration"
This commit is contained in:
committed by
Android (Google) Code Review
commit
0debe0b7f5
@@ -374,21 +374,21 @@ final class SmartSelectSprite {
|
||||
final List<RoundedRectangleShape> shapes = new LinkedList<>();
|
||||
final List<Animator> cornerAnimators = new LinkedList<>();
|
||||
|
||||
final RectF centerRectangle = destinationRectangles
|
||||
.stream()
|
||||
.filter((r) -> contains(r, start))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalArgumentException(
|
||||
"Center point is not inside any of the rectangles!"));
|
||||
RectF centerRectangle = null;
|
||||
|
||||
int startingOffset = 0;
|
||||
for (RectF rectangle : destinationRectangles) {
|
||||
if (rectangle.equals(centerRectangle)) {
|
||||
if (contains(rectangle, start)) {
|
||||
centerRectangle = rectangle;
|
||||
break;
|
||||
}
|
||||
startingOffset += rectangle.width();
|
||||
}
|
||||
|
||||
if (centerRectangle == null) {
|
||||
throw new IllegalArgumentException("Center point is not inside any of the rectangles!");
|
||||
}
|
||||
|
||||
startingOffset += start.x - centerRectangle.left;
|
||||
|
||||
final float centerRectangleHalfHeight = centerRectangle.height() / 2;
|
||||
|
||||
Reference in New Issue
Block a user