Fadepublic class Fade extends Visibility This transition tracks changes to the visibility of target views in the
start and end scenes and fades views in or out when they become visible
or non-visible. Visibility is determined by both the
{@link View#setVisibility(int)} state of the view as well as whether it
is parented in the current view hierarchy.
The ability of this transition to fade out a particular view, and the
way that that fading operation takes place, is based on
the situation of the view in the view hierarchy. For example, if a view was
simply removed from its parent, then the view will be added into a {@link
android.view.ViewGroupOverlay} while fading. If a visible view is
changed to be {@link View#GONE} or {@link View#INVISIBLE}, then the
visibility will be changed to {@link View#VISIBLE} for the duration of
the animation. However, if a view is in a hierarchy which is also altering
its visibility, the situation can be more complicated. In general, if a
view that is no longer in the hierarchy in the end scene still has a
parent (so its parent hierarchy was removed, but it was not removed from
its parent), then it will be left alone to avoid side-effects from
improperly removing it from its parent. The only exception to this is if
the previous {@link Scene} was
{@link Scene#getSceneForLayout(android.view.ViewGroup, int, android.content.Context)
created from a layout resource file}, then it is considered safe to un-parent
the starting scene view in order to fade it out.
A Fade transition can be described in a resource file by using the
tag fade , along with the standard
attributes of {@link android.R.styleable#Fade} and
{@link android.R.styleable#Transition}. |
Fields Summary |
---|
private static boolean | DBG | private static final String | LOG_TAG | public static final int | INFading mode used in {@link #Fade(int)} to make the transition
operate on targets that are appearing. Maybe be combined with
{@link #OUT} to fade both in and out. Equivalent to
{@link Visibility#MODE_IN}. | public static final int | OUTFading mode used in {@link #Fade(int)} to make the transition
operate on targets that are disappearing. Maybe be combined with
{@link #IN} to fade both in and out. Equivalent to
{@link Visibility#MODE_OUT}. |
Constructors Summary |
---|
public Fade()Constructs a Fade transition that will fade targets in and out.
| public Fade(int fadingMode)Constructs a Fade transition that will fade targets in
and/or out, according to the value of fadingMode.
setMode(fadingMode);
| public Fade(android.content.Context context, android.util.AttributeSet attrs)
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Fade);
int fadingMode = a.getInt(R.styleable.Fade_fadingMode, getMode());
setMode(fadingMode);
|
Methods Summary |
---|
private android.animation.Animator | createAnimation(android.view.View view, float startAlpha, float endAlpha)Utility method to handle creating and running the Animator.
if (startAlpha == endAlpha) {
return null;
}
view.setTransitionAlpha(startAlpha);
final ObjectAnimator anim = ObjectAnimator.ofFloat(view, "transitionAlpha", endAlpha);
if (DBG) {
Log.d(LOG_TAG, "Created animator " + anim);
}
FadeAnimatorListener listener = new FadeAnimatorListener(view);
anim.addListener(listener);
anim.addPauseListener(listener);
return anim;
| public android.animation.Animator | onAppear(android.view.ViewGroup sceneRoot, android.view.View view, TransitionValues startValues, TransitionValues endValues)
if (DBG) {
View startView = (startValues != null) ? startValues.view : null;
Log.d(LOG_TAG, "Fade.onAppear: startView, startVis, endView, endVis = " +
startView + ", " + view);
}
return createAnimation(view, 0, 1);
| public android.animation.Animator | onDisappear(android.view.ViewGroup sceneRoot, android.view.View view, TransitionValues startValues, TransitionValues endValues)
return createAnimation(view, 1, 0);
|
|