use of android.graphics.Rect in project kickmaterial by byoutline.
the class CircleTransition method createAnimator.
@Override
public Animator createAnimator(final ViewGroup sceneRoot, TransitionValues startValues, final TransitionValues endValues) {
if (startValues == null || endValues == null) {
return null;
}
Rect startBounds = (Rect) startValues.values.get(PROPERTY_BOUNDS);
Rect endBounds = (Rect) endValues.values.get(PROPERTY_BOUNDS);
boolean boundsEqual = startBounds == null || endBounds == null || startBounds.equals(endBounds);
if (boundsEqual) {
return null;
}
int[] sceneRootLoc = new int[2];
sceneRoot.getLocationInWindow(sceneRootLoc);
int[] startLoc = (int[]) startValues.values.get(PROPERTY_POSITION);
final View startView = getStartView(sceneRoot, startValues, sceneRootLoc, startLoc);
final View endView = endValues.view;
endView.setAlpha(0f);
Path circlePath = getMovePath(endValues, startView, sceneRootLoc, startLoc, endView);
Animator circleAnimator = ObjectAnimator.ofFloat(startView, View.TRANSLATION_X, View.TRANSLATION_Y, circlePath);
circleAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
startView.setVisibility(View.INVISIBLE);
endView.setAlpha(1f);
sceneRoot.getOverlay().remove(startView);
}
});
AnimatorSet moveSet = new AnimatorSet();
float scaleRatio = ((float) endView.getWidth()) / startView.getWidth();
ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(startView, View.SCALE_X, 1, scaleRatio);
ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(startView, View.SCALE_Y, 1, scaleRatio);
moveSet.playTogether(circleAnimator, scaleXAnimator, scaleYAnimator);
return moveSet;
}
use of android.graphics.Rect in project UltimateAndroid by cymcsg.
the class SwipeLayout method layoutPullOut.
void layoutPullOut() {
Rect rect = computeSurfaceLayoutArea(false);
getSurfaceView().layout(rect.left, rect.top, rect.right, rect.bottom);
rect = computeBottomLayoutAreaViaSurface(ShowMode.PullOut, rect);
getBottomView().layout(rect.left, rect.top, rect.right, rect.bottom);
bringChildToFront(getSurfaceView());
}
use of android.graphics.Rect in project UltimateAndroid by cymcsg.
the class Lanes method getChildFrame.
public void getChildFrame(Rect outRect, int childWidth, int childHeight, LaneInfo laneInfo, Direction direction) {
final Rect startRect = mLanes[laneInfo.startLane];
// The anchor lane only applies when we're get child frame in the direction
// of the forward scroll. We'll need to rethink this once we start working on
// RTL support.
final int anchorLane = (direction == Direction.END ? laneInfo.anchorLane : laneInfo.startLane);
final Rect anchorRect = mLanes[anchorLane];
if (mIsVertical) {
outRect.left = startRect.left;
outRect.top = (direction == Direction.END ? anchorRect.bottom : anchorRect.top - childHeight);
} else {
outRect.top = startRect.top;
outRect.left = (direction == Direction.END ? anchorRect.right : anchorRect.left - childWidth);
}
outRect.right = outRect.left + childWidth;
outRect.bottom = outRect.top + childHeight;
}
use of android.graphics.Rect in project UltimateAndroid by cymcsg.
the class Lanes method pushChildFrame.
public int pushChildFrame(Rect outRect, int lane, int margin, Direction direction) {
final int delta;
final Rect laneRect = mLanes[lane];
if (mIsVertical) {
if (direction == Direction.END) {
delta = outRect.top - laneRect.bottom;
laneRect.bottom = outRect.bottom + margin;
} else {
delta = outRect.bottom - laneRect.top;
laneRect.top = outRect.top - margin;
}
} else {
if (direction == Direction.END) {
delta = outRect.left - laneRect.right;
laneRect.right = outRect.right + margin;
} else {
delta = outRect.right - laneRect.left;
laneRect.left = outRect.left - margin;
}
}
invalidateEdges();
return delta;
}
use of android.graphics.Rect in project UltimateAndroid by cymcsg.
the class Lanes method reset.
public void reset(int offset) {
for (int i = 0; i < mLanes.length; i++) {
final Rect laneRect = mLanes[i];
laneRect.offsetTo(mIsVertical ? laneRect.left : offset, mIsVertical ? offset : laneRect.top);
if (mIsVertical) {
laneRect.bottom = laneRect.top;
} else {
laneRect.right = laneRect.left;
}
}
invalidateEdges();
}
Aggregations