Methods Summary |
---|
public void | applyToTaskView(android.view.View v, int duration, android.view.animation.Interpolator interp, boolean allowLayers, boolean allowShadows, ValueAnimator.AnimatorUpdateListener updateCallback)Applies this transform to a view.
// Check to see if any properties have changed, and update the task view
if (duration > 0) {
ViewPropertyAnimator anim = v.animate();
boolean requiresLayers = false;
// Animate to the final state
if (hasTranslationYChangedFrom(v.getTranslationY())) {
anim.translationY(translationY);
}
if (allowShadows && hasTranslationZChangedFrom(v.getTranslationZ())) {
anim.translationZ(translationZ);
}
if (hasScaleChangedFrom(v.getScaleX())) {
anim.scaleX(scale)
.scaleY(scale);
requiresLayers = true;
}
if (hasAlphaChangedFrom(v.getAlpha())) {
// Use layers if we animate alpha
anim.alpha(alpha);
requiresLayers = true;
}
if (requiresLayers && allowLayers) {
anim.withLayer();
}
if (updateCallback != null) {
anim.setUpdateListener(updateCallback);
} else {
anim.setUpdateListener(null);
}
anim.setStartDelay(startDelay)
.setDuration(duration)
.setInterpolator(interp)
.start();
} else {
// Set the changed properties
if (hasTranslationYChangedFrom(v.getTranslationY())) {
v.setTranslationY(translationY);
}
if (allowShadows && hasTranslationZChangedFrom(v.getTranslationZ())) {
v.setTranslationZ(translationZ);
}
if (hasScaleChangedFrom(v.getScaleX())) {
v.setScaleX(scale);
v.setScaleY(scale);
}
if (hasAlphaChangedFrom(v.getAlpha())) {
v.setAlpha(alpha);
}
}
|
public boolean | hasAlphaChangedFrom(float v)Convenience functions to compare against current property values
return (Float.compare(alpha, v) != 0);
|
public boolean | hasScaleChangedFrom(float v)
return (Float.compare(scale, v) != 0);
|
public boolean | hasTranslationYChangedFrom(float v)
return (Float.compare(translationY, v) != 0);
|
public boolean | hasTranslationZChangedFrom(float v)
return (Float.compare(translationZ, v) != 0);
|
public void | reset()Resets the current transform
startDelay = 0;
translationY = 0;
translationZ = 0;
scale = 1f;
alpha = 1f;
visible = false;
rect.setEmpty();
p = 0f;
|
public static void | reset(android.view.View v)Reset the transform on a view.
v.setTranslationX(0f);
v.setTranslationY(0f);
v.setTranslationZ(0f);
v.setScaleX(1f);
v.setScaleY(1f);
v.setAlpha(1f);
|
public java.lang.String | toString()
return "TaskViewTransform delay: " + startDelay + " y: " + translationY + " z: " + translationZ +
" scale: " + scale + " alpha: " + alpha + " visible: " + visible + " rect: " + rect +
" p: " + p;
|