FileDocCategorySizeDatePackage
TaskViewTransform.javaAPI DocAndroid 5.1 API5046Thu Mar 12 22:22:42 GMT 2015com.android.systemui.recents.views

TaskViewTransform

public class TaskViewTransform extends Object

Fields Summary
public int
startDelay
public int
translationY
public float
translationZ
public float
scale
public float
alpha
public boolean
visible
public android.graphics.Rect
rect
float
p
Constructors Summary
public TaskViewTransform()


      
        // Do nothing
    
public TaskViewTransform(TaskViewTransform o)

        startDelay = o.startDelay;
        translationY = o.translationY;
        translationZ = o.translationZ;
        scale = o.scale;
        alpha = o.alpha;
        visible = o.visible;
        rect.set(o.rect);
        p = o.p;
    
Methods Summary
public voidapplyToTaskView(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 booleanhasAlphaChangedFrom(float v)
Convenience functions to compare against current property values

        return (Float.compare(alpha, v) != 0);
    
public booleanhasScaleChangedFrom(float v)

        return (Float.compare(scale, v) != 0);
    
public booleanhasTranslationYChangedFrom(float v)

        return (Float.compare(translationY, v) != 0);
    
public booleanhasTranslationZChangedFrom(float v)

        return (Float.compare(translationZ, v) != 0);
    
public voidreset()
Resets the current transform

        startDelay = 0;
        translationY = 0;
        translationZ = 0;
        scale = 1f;
        alpha = 1f;
        visible = false;
        rect.setEmpty();
        p = 0f;
    
public static voidreset(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.StringtoString()

        return "TaskViewTransform delay: " + startDelay + " y: " + translationY + " z: " + translationZ +
                " scale: " + scale + " alpha: " + alpha + " visible: " + visible + " rect: " + rect +
                " p: " + p;