Class DrawableCrossFadeTransition
- java.lang.Object
-
- com.bumptech.glide.request.transition.DrawableCrossFadeTransition
-
- All Implemented Interfaces:
Transition<android.graphics.drawable.Drawable>
public class DrawableCrossFadeTransition extends java.lang.Object implements Transition<android.graphics.drawable.Drawable>
A cross fadeTransitionforDrawables that uses anTransitionDrawableto 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 onTransitionDrawable.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.bumptech.glide.request.transition.Transition
Transition.ViewAdapter
-
-
Constructor Summary
Constructors Constructor Description DrawableCrossFadeTransition(int duration, boolean isCrossFadeEnabled)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleantransition(android.graphics.drawable.Drawable current, Transition.ViewAdapter adapter)Animates from the previous drawable to the current drawable in one of two ways.
-
-
-
Constructor Detail
-
DrawableCrossFadeTransition
public DrawableCrossFadeTransition(int duration, boolean isCrossFadeEnabled)- Parameters:
duration- The duration that the cross fade animation should run if there is something to cross fade from when a newDrawableis put.isCrossFadeEnabled- Iftrue, animates the previous resource's alpha to 0 while animating the new resource's alpha to 100. Otherwise, only animates the new resource's alpha to 100 while leaving the previous resource's alpha at 100. SeeTransitionDrawable.setCrossFadeEnabled(boolean).
-
-
Method Detail
-
transition
public boolean transition(android.graphics.drawable.Drawable current, Transition.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:
transitionin interfaceTransition<android.graphics.drawable.Drawable>- Parameters:
current- The new resource that will be displayed in the view.adapter- TheTransition.ViewAdapterwrapping a view that can at least return anViewfromTransition.ViewAdapter.getView().- Returns:
- True if in the process of running the transition, the new resource was put on the view, false if the caller needs to manually put the current resource on the view.
-
-