public abstract class Visibility extends Transition
View.setVisibility(int)
state of views, but also whether
views exist in the current view hierarchy. The class is intended to be a
utility for subclasses such as Fade
, which use this visibility
information to determine the specific animations to run when visibility
changes occur. Subclasses should implement one or both of the methods
onAppear(ViewGroup, TransitionValues, int, TransitionValues, int)
,
onDisappear(ViewGroup, TransitionValues, int, TransitionValues, int)
,Transition.TransitionListener
Constructor and Description |
---|
Visibility() |
Modifier and Type | Method and Description |
---|---|
void |
captureEndValues(TransitionValues transitionValues)
Captures the values in the end scene for the properties that this
transition monitors.
|
void |
captureStartValues(TransitionValues transitionValues)
Captures the values in the start scene for the properties that this
transition monitors.
|
Animator |
createAnimator(ViewGroup sceneRoot,
TransitionValues startValues,
TransitionValues endValues) |
boolean |
isVisible(TransitionValues values)
Returns whether the view is 'visible' according to the given values
object.
|
Animator |
onAppear(ViewGroup sceneRoot,
TransitionValues startValues,
int startVisibility,
TransitionValues endValues,
int endVisibility)
The default implementation of this method does nothing.
|
Animator |
onDisappear(ViewGroup sceneRoot,
TransitionValues startValues,
int startVisibility,
TransitionValues endValues,
int endVisibility)
The default implementation of this method does nothing.
|
addListener, addTarget, addTarget, createAnimator, excludeChildren, excludeChildren, excludeChildren, excludeTarget, excludeTarget, excludeTarget, getDuration, getInterpolator, getName, getStartDelay, getTargetIds, getTargets, getTransitionProperties, getTransitionValues, removeListener, removeTarget, removeTarget, setDuration, setInterpolator, setStartDelay, toString
public void captureEndValues(@NonNull TransitionValues transitionValues)
Transition
Transition.createAnimator(ViewGroup, TransitionValues, TransitionValues)
.
The main concern for an implementation is what the
properties are that the transition cares about and what the values are
for all of those properties. The start and end values will be compared
later during the
Transition.createAnimator(ViewGroup, TransitionValues, TransitionValues)
method to determine what, if any, animations, should be run.
Subclasses must implement this method. The method should only be called by the transition system; it is not intended to be called from external classes.
captureEndValues
in class Transition
transitionValues
- The holder for any values that the Transition
wishes to store. Values are stored in the values
field
of this TransitionValues object and are keyed from
a String value. For example, to store a view's rotation value,
a transition might call
transitionValues.values.put("appname:transitionname:rotation",
view.getRotation())
. The target view will already be stored
in
the transitionValues structure when this method is called.Transition.captureStartValues(TransitionValues)
,
Transition.createAnimator(ViewGroup, TransitionValues, TransitionValues)
public void captureStartValues(@NonNull TransitionValues transitionValues)
Transition
Transition.createAnimator(ViewGroup, TransitionValues, TransitionValues)
.
The main concern for an implementation is what the
properties are that the transition cares about and what the values are
for all of those properties. The start and end values will be compared
later during the
Transition.createAnimator(ViewGroup, TransitionValues, TransitionValues)
method to determine what, if any, animations, should be run.
Subclasses must implement this method. The method should only be called by the transition system; it is not intended to be called from external classes.
captureStartValues
in class Transition
transitionValues
- The holder for any values that the Transition
wishes to store. Values are stored in the values
field
of this TransitionValues object and are keyed from
a String value. For example, to store a view's rotation value,
a transition might call
transitionValues.values.put("appname:transitionname:rotation",
view.getRotation())
. The target view will already be stored
in
the transitionValues structure when this method is called.Transition.captureEndValues(TransitionValues)
,
Transition.createAnimator(ViewGroup, TransitionValues, TransitionValues)
public boolean isVisible(TransitionValues values)
Transition.createAnimator(ViewGroup, TransitionValues, TransitionValues)
method. This method can be called by, for example, subclasses that want
to know whether the object is visible in the same way that Visibility
determines it for the actual animation.values
- The TransitionValues object that holds the information by
which visibility is determined.values
is visible,
false otherwise.public Animator onAppear(ViewGroup sceneRoot, TransitionValues startValues, int startVisibility, TransitionValues endValues, int endVisibility)
sceneRoot
- The root of the transition hierarchystartValues
- The target values in the start scenestartVisibility
- The target visibility in the start sceneendValues
- The target values in the end sceneendVisibility
- The target visibility in the end scenepublic Animator onDisappear(ViewGroup sceneRoot, TransitionValues startValues, int startVisibility, TransitionValues endValues, int endVisibility)
sceneRoot
- The root of the transition hierarchystartValues
- The target values in the start scenestartVisibility
- The target visibility in the start sceneendValues
- The target values in the end sceneendVisibility
- The target visibility in the end scenepublic Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues)