FileDocCategorySizeDatePackage
ViewPropertyAnimatorCompat.javaAPI DocAndroid 5.1 API47087Thu Mar 12 22:22:56 GMT 2015android.support.v4.view

ViewPropertyAnimatorCompat

public class ViewPropertyAnimatorCompat extends Object

Fields Summary
private static final String
TAG
private WeakReference
mView
private Runnable
mStartAction
private Runnable
mEndAction
private int
mOldLayerType
static final int
LISTENER_TAG_ID
static final ViewPropertyAnimatorCompatImpl
IMPL
Constructors Summary
ViewPropertyAnimatorCompat(android.view.View view)



      
        mView = new WeakReference<View>(view);
    
Methods Summary
public android.support.v4.view.ViewPropertyAnimatorCompatalpha(float value)
This method will cause the View's alpha property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The value to be animated to.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.alpha(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatalphaBy(float value)
This method will cause the View's alpha property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The amount to be animated by, as an offset from the current value.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.alphaBy(this, view, value);
        }
        return this;
    
public voidcancel()
Cancels all property animations that are currently running or pending.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.cancel(this, view);
        }
    
public longgetDuration()
Returns the current duration of property animations. If the duration was set on this object, that value is returned. Otherwise, the default value of the underlying Animator is returned.

Prior to API 14, this method will return 0.

see
#setDuration(long)
return
The duration of animations, in milliseconds.

        View view;
        if ((view = mView.get()) != null) {
            return IMPL.getDuration(this, view);
        } else {
            return 0;
        }
    
public android.view.animation.InterpolatorgetInterpolator()
Returns the timing interpolator that this animation uses.

Prior to API 14, this method will return null.

return
The timing interpolator for this animation.

        View view;
        if ((view = mView.get()) != null) {
            return IMPL.getInterpolator(this, view);
        }
        else return null;
    
public longgetStartDelay()
Returns the current startDelay of property animations. If the startDelay was set on this object, that value is returned. Otherwise, the default value of the underlying Animator is returned.

Prior to API 14, this method will return 0.

see
#setStartDelay(long)
return
The startDelay of animations, in milliseconds.

        View view;
        if ((view = mView.get()) != null) {
            return IMPL.getStartDelay(this, view);
        } else {
            return 0;
        }
    
public android.support.v4.view.ViewPropertyAnimatorCompatrotation(float value)
This method will cause the View's rotation property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The value to be animated to.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.rotation(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatrotationBy(float value)
This method will cause the View's rotation property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The amount to be animated by, as an offset from the current value.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.rotationBy(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatrotationX(float value)
This method will cause the View's rotationX property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The value to be animated to.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.rotationX(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatrotationXBy(float value)
This method will cause the View's rotationX property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The amount to be animated by, as an offset from the current value.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.rotationXBy(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatrotationY(float value)
This method will cause the View's rotationY property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The value to be animated to.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.rotationY(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatrotationYBy(float value)
This method will cause the View's rotationY property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The amount to be animated by, as an offset from the current value.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.rotationYBy(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatscaleX(float value)
This method will cause the View's scaleX property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The value to be animated to.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.scaleX(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatscaleXBy(float value)
This method will cause the View's scaleX property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The amount to be animated by, as an offset from the current value.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.scaleXBy(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatscaleY(float value)
This method will cause the View's scaleY property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The value to be animated to.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.scaleY(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatscaleYBy(float value)
This method will cause the View's scaleY property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The amount to be animated by, as an offset from the current value.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.scaleYBy(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatsetDuration(long value)
Sets the duration for the underlying animator that animates the requested properties. By default, the animator uses the default value for ValueAnimator. Calling this method will cause the declared value to be used instead.

Prior to API 14, this method will do nothing.

param
value The length of ensuing property animations, in milliseconds. The value cannot be negative.
return
This object, allowing calls to methods in this class to be chained.

        final int version = android.os.Build.VERSION.SDK_INT;
        if (version >= 19) {
            IMPL = new KitKatViewPropertyAnimatorCompatImpl();
        } else if (version >= 18) {
            IMPL = new JBMr2ViewPropertyAnimatorCompatImpl();
        } else if (version >= 16) {
            IMPL = new JBViewPropertyAnimatorCompatImpl();
        } else if (version >= 14) {
            IMPL = new ICSViewPropertyAnimatorCompatImpl();
        } else {
            IMPL = new BaseViewPropertyAnimatorCompatImpl();
        }
    
        View view;
        if ((view = mView.get()) != null) {
            IMPL.setDuration(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatsetInterpolator(android.view.animation.Interpolator value)
Sets the interpolator for the underlying animator that animates the requested properties. By default, the animator uses the default interpolator for ValueAnimator. Calling this method will cause the declared object to be used instead.

Prior to API 14, this method will do nothing.

param
value The TimeInterpolator to be used for ensuing property animations.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.setInterpolator(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatsetListener(ViewPropertyAnimatorListener listener)
Sets a listener for events in the underlying Animators that run the property animations.

Prior to API 14, this method will do nothing.

param
listener The listener to be called with AnimatorListener events. A value of null removes any existing listener.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.setListener(this, view, listener);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatsetStartDelay(long value)
Sets the startDelay for the underlying animator that animates the requested properties. By default, the animator uses the default value for ValueAnimator. Calling this method will cause the declared value to be used instead.

Prior to API 14, this method will do nothing.

param
value The delay of ensuing property animations, in milliseconds. The value cannot be negative.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.setStartDelay(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatsetUpdateListener(ViewPropertyAnimatorUpdateListener listener)
Sets a listener for update events in the underlying Animator that runs the property animations.

Prior to API 19, this method will do nothing.

param
listener The listener to be called with update events. A value of null removes any existing listener.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.setUpdateListener(this, view, listener);
        }
        return this;
    
public voidstart()
Starts the currently pending property animations immediately. Calling start() is optional because all animations start automatically at the next opportunity. However, if the animations are needed to start immediately and synchronously (not at the time when the next event is processed by the hierarchy, which is when the animations would begin otherwise), then this method can be used.

Prior to API 14, this method will do nothing.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.start(this, view);
        }
    
public android.support.v4.view.ViewPropertyAnimatorCompattranslationX(float value)
This method will cause the View's translationX property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The value to be animated to.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.translationX(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompattranslationXBy(float value)
This method will cause the View's translationX property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The amount to be animated by, as an offset from the current value.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.translationXBy(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompattranslationY(float value)
This method will cause the View's translationY property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The value to be animated to.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.translationY(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompattranslationYBy(float value)
This method will cause the View's translationY property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The amount to be animated by, as an offset from the current value.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.translationYBy(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatwithEndAction(java.lang.Runnable runnable)
Specifies an action to take place when the next animation ends. The action is only run if the animation ends normally; if the ViewPropertyAnimator is canceled during that animation, the runnable will not run. This method, along with {@link #withStartAction(Runnable)}, is intended to help facilitate choreographing ViewPropertyAnimator animations with other animations or actions in the application.

For example, the following code animates a view to x=200 and then back to 0:

Runnable endAction = new Runnable() {
public void run() {
view.animate().x(0);
}
};
view.animate().x(200).withEndAction(endAction);

Prior to API 14, this method will run the action immediately.

For API 14 and 15, this method will run by setting a listener on the ViewPropertyAnimatorCompat object and running the action in that listener's {@link ViewPropertyAnimatorListener#onAnimationEnd(View)} method.

param
runnable The action to run when the next animation ends.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.withEndAction(this, view, runnable);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatwithLayer()
The View associated with this ViewPropertyAnimator will have its {@link ViewCompat#setLayerType(View, int, android.graphics.Paint) layer type} set to {@link ViewCompat#LAYER_TYPE_HARDWARE} for the duration of the next animation. As stated in the documentation for {@link ViewCompat#LAYER_TYPE_HARDWARE}, the actual type of layer used internally depends on the runtime situation of the view. If the activity and this view are hardware-accelerated, then the layer will be accelerated as well. If the activity or the view is not accelerated, then the layer will effectively be the same as {@link ViewCompat#LAYER_TYPE_SOFTWARE}.

This state is not persistent, either on the View or on this ViewPropertyAnimator: the layer type of the View will be restored when the animation ends to what it was when this method was called, and this setting on ViewPropertyAnimator is only valid for the next animation. Note that calling this method and then independently setting the layer type of the View (by a direct call to {@link ViewCompat#setLayerType(View, int, android.graphics.Paint)}) will result in some inconsistency, including having the layer type restored to its pre-withLayer() value when the animation ends.

Prior to API 14, this method will do nothing.

For API 14 and 15, this method will run by setting a listener on the ViewPropertyAnimatorCompat object, setting a hardware layer in the listener's {@link ViewPropertyAnimatorListener#onAnimationStart(View)} method, and then restoring the orignal layer type in the listener's {@link ViewPropertyAnimatorListener#onAnimationEnd(View)} method.

see
View#setLayerType(int, android.graphics.Paint)
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.withLayer(this, view);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatwithStartAction(java.lang.Runnable runnable)
Specifies an action to take place when the next animation runs. If there is a {@link #setStartDelay(long) startDelay} set on this ViewPropertyAnimator, then the action will run after that startDelay expires, when the actual animation begins. This method, along with {@link #withEndAction(Runnable)}, is intended to help facilitate choreographing ViewPropertyAnimator animations with other animations or actions in the application.

Prior to API 14, this method will run the action immediately.

For API 14 and 15, this method will run by setting a listener on the ViewPropertyAnimatorCompat object and running the action in that listener's {@link ViewPropertyAnimatorListener#onAnimationStart(View)} method.

param
runnable The action to run when the next animation starts.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.withStartAction(this, view, runnable);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatx(float value)
This method will cause the View's x property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The value to be animated to.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.x(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatxBy(float value)
This method will cause the View's x property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The amount to be animated by, as an offset from the current value.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.xBy(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompaty(float value)
This method will cause the View's y property to be animated to the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The value to be animated to.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.y(this, view, value);
        }
        return this;
    
public android.support.v4.view.ViewPropertyAnimatorCompatyBy(float value)
This method will cause the View's y property to be animated by the specified value. Animations already running on the property will be canceled.

Prior to API 14, this method will do nothing.

param
value The amount to be animated by, as an offset from the current value.
return
This object, allowing calls to methods in this class to be chained.

        View view;
        if ((view = mView.get()) != null) {
            IMPL.yBy(this, view, value);
        }
        return this;