com.bumptech.glide.request.animation
Class DrawableCrossFadeViewAnimation<T extends Drawable>
java.lang.Object
com.bumptech.glide.request.animation.DrawableCrossFadeViewAnimation<T>
- Type Parameters:
T
- The type of the Drawable
that will be animated.
- All Implemented Interfaces:
- GlideAnimation<T>
public class DrawableCrossFadeViewAnimation<T extends Drawable>
- extends Object
- implements GlideAnimation<T>
A cross fade GlideAnimation
for Drawable
s
that uses an TransitionDrawable
to transition from an existing drawable
already visible on the target to a new drawable. If no existing drawable exists, this class can instead fall back
to a default animation that doesn't rely on TransitionDrawable
.
Constructor Summary |
DrawableCrossFadeViewAnimation(Animation defaultAnimation,
int duration)
Constructor that takes a default animation and a duration in milliseconds that the cross fade animation should
last. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_DURATION
public static final int DEFAULT_DURATION
- See Also:
- Constant Field Values
DrawableCrossFadeViewAnimation
public DrawableCrossFadeViewAnimation(Animation defaultAnimation,
int duration)
- Constructor that takes a default animation and a duration in milliseconds that the cross fade animation should
last.
- Parameters:
defaultAnimation
- The default animation that will run if there is nothing to cross fade from when a new
Drawable
is set.duration
- The duration that the cross fade animation should run if there is something to cross fade from
when a new Drawable
is set.
animate
public boolean animate(T current,
GlideAnimation.ViewAdapter adapter)
- Animates from the previous drawable to the current drawable in one of two ways.
- Using the default animation provided in the constructor if the previous drawable is null
- Using the cross fade animation with the duration provided in the constructor if the previous
drawable is non null
- Specified by:
animate
in interface GlideAnimation<T extends Drawable>
- Parameters:
current
- The new resource that will be displayed in the view.adapter
- The GlideAnimation.ViewAdapter
wrapping a view that
can at least return an View
from
GlideAnimation.ViewAdapter.getView()
.
- Returns:
- True if int he process of running the animation the new resource was set on the view, false if the caller
needs to manually set the current resource on the view.