Merge "Set the bounds on the drawable for ChangeBounds reparenting." into mnc-dr-dev
This commit is contained in:
@@ -432,23 +432,24 @@ public class ChangeBounds extends Transition {
|
|||||||
return anim;
|
return anim;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int startX = (Integer) startValues.values.get(PROPNAME_WINDOW_X);
|
sceneRoot.getLocationInWindow(tempLocation);
|
||||||
int startY = (Integer) startValues.values.get(PROPNAME_WINDOW_Y);
|
int startX = (Integer) startValues.values.get(PROPNAME_WINDOW_X) - tempLocation[0];
|
||||||
int endX = (Integer) endValues.values.get(PROPNAME_WINDOW_X);
|
int startY = (Integer) startValues.values.get(PROPNAME_WINDOW_Y) - tempLocation[1];
|
||||||
int endY = (Integer) endValues.values.get(PROPNAME_WINDOW_Y);
|
int endX = (Integer) endValues.values.get(PROPNAME_WINDOW_X) - tempLocation[0];
|
||||||
|
int endY = (Integer) endValues.values.get(PROPNAME_WINDOW_Y) - tempLocation[1];
|
||||||
// TODO: also handle size changes: check bounds and animate size changes
|
// TODO: also handle size changes: check bounds and animate size changes
|
||||||
if (startX != endX || startY != endY) {
|
if (startX != endX || startY != endY) {
|
||||||
sceneRoot.getLocationInWindow(tempLocation);
|
final int width = view.getWidth();
|
||||||
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(),
|
final int height = view.getHeight();
|
||||||
Bitmap.Config.ARGB_8888);
|
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
view.draw(canvas);
|
view.draw(canvas);
|
||||||
final BitmapDrawable drawable = new BitmapDrawable(bitmap);
|
final BitmapDrawable drawable = new BitmapDrawable(bitmap);
|
||||||
|
drawable.setBounds(startX, startY, startX + width, startY + height);
|
||||||
final float transitionAlpha = view.getTransitionAlpha();
|
final float transitionAlpha = view.getTransitionAlpha();
|
||||||
view.setTransitionAlpha(0);
|
view.setTransitionAlpha(0);
|
||||||
sceneRoot.getOverlay().add(drawable);
|
sceneRoot.getOverlay().add(drawable);
|
||||||
Path topLeftPath = getPathMotion().getPath(startX - tempLocation[0],
|
Path topLeftPath = getPathMotion().getPath(startX, startY, endX, endY);
|
||||||
startY - tempLocation[1], endX - tempLocation[0], endY - tempLocation[1]);
|
|
||||||
PropertyValuesHolder origin = PropertyValuesHolder.ofObject(
|
PropertyValuesHolder origin = PropertyValuesHolder.ofObject(
|
||||||
DRAWABLE_ORIGIN_PROPERTY, null, topLeftPath);
|
DRAWABLE_ORIGIN_PROPERTY, null, topLeftPath);
|
||||||
ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(drawable, origin);
|
ObjectAnimator anim = ObjectAnimator.ofPropertyValuesHolder(drawable, origin);
|
||||||
|
|||||||
Reference in New Issue
Block a user