List of usage examples for android.animation PropertyValuesHolder getPropertyName
public String getPropertyName()
From source file:com.taobao.weex.dom.transition.WXTransition.java
private void doLayoutPropertyValuesHolderAnimation(PropertyValuesHolder[] holders) { layoutValueAnimator = ValueAnimator.ofPropertyValuesHolder(holders); layoutValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override//from w w w . jav a2 s.c om public void onAnimationUpdate(ValueAnimator animation) { PropertyValuesHolder holders[] = animation.getValues(); for (PropertyValuesHolder holder : holders) { String property = holder.getPropertyName(); switch (property) { case Constants.Name.WIDTH: { domObject.setStyleWidth((Float) animation.getAnimatedValue(property)); } break; case Constants.Name.HEIGHT: { domObject.setStyleHeight((Float) animation.getAnimatedValue(property)); } break; case Constants.Name.MARGIN_TOP: { domObject.setMargin(Spacing.TOP, (Float) animation.getAnimatedValue(property)); } break; case Constants.Name.MARGIN_LEFT: { domObject.setMargin(Spacing.LEFT, (Float) animation.getAnimatedValue(property)); } break; case Constants.Name.MARGIN_RIGHT: { domObject.setMargin(Spacing.RIGHT, (Float) animation.getAnimatedValue(property)); } break; case Constants.Name.MARGIN_BOTTOM: { domObject.setMargin(Spacing.BOTTOM, (Float) animation.getAnimatedValue(property)); } break; case Constants.Name.LEFT: { domObject.setPositionLeft((Float) animation.getAnimatedValue(property)); } break; case Constants.Name.RIGHT: { domObject.setPositionRight((Float) animation.getAnimatedValue(property)); } break; case Constants.Name.BOTTOM: { domObject.setPositionBottom((Float) animation.getAnimatedValue(property)); } break; case Constants.Name.TOP: { domObject.setPositionTop((Float) animation.getAnimatedValue(property)); } break; case Constants.Name.PADDING_TOP: { domObject.setPadding(Spacing.TOP, (Float) animation.getAnimatedValue(property)); } break; case Constants.Name.PADDING_BOTTOM: { domObject.setPadding(Spacing.BOTTOM, (Float) animation.getAnimatedValue(property)); } break; case Constants.Name.PADDING_LEFT: { domObject.setPadding(Spacing.LEFT, (Float) animation.getAnimatedValue(property)); } break; case Constants.Name.PADDING_RIGHT: { domObject.setPadding(Spacing.RIGHT, (Float) animation.getAnimatedValue(property)); } break; default: break; } } DOMActionContext domActionContext = WXSDKManager.getInstance().getWXDomManager() .getDomContext(domObject.getDomContext().getInstanceId()); if (domActionContext == null) { return; } domActionContext.markDirty(); WXSDKManager.getInstance().getWXDomManager() .sendEmptyMessageDelayed(WXDomHandler.MsgType.WX_DOM_TRANSITION_BATCH, 0); if (WXEnvironment.isApkDebugable()) { WXLogUtils.d("WXTransition send layout batch msg"); } } }); layoutValueAnimator.addListener(new AnimatorListenerAdapter() { boolean hasCancel = false; @Override public void onAnimationCancel(Animator animation) { super.onAnimationCancel(animation); hasCancel = true; } @Override public void onAnimationEnd(Animator animation) { if (hasCancel) { return; } super.onAnimationEnd(animation); if (WXEnvironment.isApkDebugable()) { WXLogUtils.d("WXTransition layout onTransitionAnimationEnd " + domObject.getRef()); } WXTransition.this.onTransitionAnimationEnd(); } }); if (interpolator != null) { layoutValueAnimator.setInterpolator(interpolator); } layoutValueAnimator.setStartDelay((long) (delay)); layoutValueAnimator.setDuration((long) (duration)); layoutValueAnimator.start(); }