Bug 817721/817735/817732 - Add support for width animations in PropertyAnimator (r=mfinkle)

This commit is contained in:
Lucas Rocha 2013-02-22 07:22:36 +00:00
parent f1c0dc32a9
commit 024e7080f7
2 changed files with 22 additions and 0 deletions

View File

@ -57,6 +57,23 @@ public class AnimatorProxy {
return proxy;
}
public int getWidth() {
View view = mImpl.getView();
if (view != null)
return view.getWidth();
return 0;
}
public void setWidth(int width) {
View view = mImpl.getView();
if (view != null) {
ViewGroup.LayoutParams lp = view.getLayoutParams();
lp.width = width;
view.setLayoutParams(lp);
}
}
public int getHeight() {
View view = mImpl.getView();
if (view != null)

View File

@ -26,6 +26,7 @@ public class PropertyAnimator implements Runnable {
TRANSLATION_Y,
SCROLL_X,
SCROLL_Y,
WIDTH,
HEIGHT
}
@ -121,6 +122,8 @@ public class PropertyAnimator implements Runnable {
element.from = element.proxy.getScrollY();
else if (element.property == Property.SCROLL_X)
element.from = element.proxy.getScrollX();
else if (element.property == Property.WIDTH)
element.from = element.proxy.getWidth();
else if (element.property == Property.HEIGHT)
element.from = element.proxy.getHeight();
@ -195,6 +198,8 @@ public class PropertyAnimator implements Runnable {
element.proxy.scrollTo(element.proxy.getScrollX(), (int) delta);
else if (element.property == Property.SCROLL_X)
element.proxy.scrollTo((int) delta, element.proxy.getScrollY());
else if (element.property == Property.WIDTH)
element.proxy.setWidth((int) delta);
else if (element.property == Property.HEIGHT)
element.proxy.setHeight((int) delta);
}