public class Reveal
extends android.transition.Visibility
Visibility transition implementation that tracks changes to the visibility of target
views in the start and end scenes and reveals or conceals views in the scene. Visibility is
determined by the View.setVisibility(int) state of the views.
A Reveal transition uses ViewAnimationUtils.createCircularReveal(View, int, int, float, float)
to create a circular reveal/conceal animator that is used to animate its target views. A center
coordinates of revealing/concealing circle can be specified via setCenterX(Float) and
setCenterY(Float) or by using fractions via setCenterXFraction(float) and
setCenterYFraction(float). If specifying a gravity for the center of the animating circle
is enough, the desired gravity flags may be specified via setCenterGravity(Integer).
Reveal transition can be described in a resource file by using the transition tag with
class attribute set to universum.studios.android.transition.Reveal, along with
Xml attributes referenced below.
Reveal Attributes| Modifier and Type | Class and Description |
|---|---|
static interface |
Reveal.RevealMode
Defines an annotation for determining set of allowed modes for Reveal transition.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
CONCEAL
Mode to indicate that Reveal transition should play conceal animation, that is to
'downscale' the animating circle of an animating view from its initial size to a smaller one.
|
static int |
REVEAL
Mode to indicate that Reveal transition should play reveal animation, that is to
'upscale' the animating circle of an animating view from its initial size to a larger one.
|
| Constructor and Description |
|---|
Reveal()
Same as
Reveal(int) with REVEAL mode. |
Reveal(android.content.Context context,
android.util.AttributeSet attrs)
Creates a new instance of Reveal transition with animation property values set from the
specified attrs.
|
Reveal(int mode)
Creates a new instance of Reveal transition with the specified mode.
|
| Modifier and Type | Method and Description |
|---|---|
static float |
calculateRadius(float width,
float height)
Calculates the radius of the specified width and height dimension for
purpose of circular reveal animation.
|
static float |
calculateRadius(android.view.View view)
Same as
calculateRadius(float, float) where width and height of the given view
will be used for radius calculation. |
static android.animation.Animator |
createAnimator(android.view.View view,
float startRadius,
float endRadius)
Same as
createAnimator(View, int, int, float, float) where the center coordinates
will be automatically resolved using the given view. |
static android.animation.Animator |
createAnimator(android.view.View view,
int centerX,
int centerY,
float startRadius,
float endRadius)
Creates a new instance of circular reveal Animator for the specified view.
|
int |
getAppearVisibility()
Returns the visibility flag that will be set to a revealing view whenever this transition is
requested to create an appear animator.
|
Integer |
getCenterGravity()
Returns the gravity flags that will be used to resolve center for animating circle of the
reveal animation.
|
int |
getCenterHorizontalOffset()
Returns the offset for the center x coordinate for animating circle of the reveal animation.
|
int |
getCenterVerticalOffset()
Returns the offset for the center y coordinate for animating circle of the reveal animation.
|
Float |
getCenterX()
Returns the x coordinate of the center for animating circle of the reveal animation.
|
float |
getCenterXFraction()
Returns the fraction of the center x coordinate.
|
Float |
getCenterY()
Returns the y coordinate of the center for animating circle of the reveal animation.
|
float |
getCenterYFraction()
Returns the fraction of the center y coordinate.
|
int |
getDisappearVisibility()
Returns the visibility flag that will be set to a revealing view whenever this transition is
requested to created a disappear animator.
|
Float |
getEndRadius()
Returns the end radius for animating circle of the reveal animation.
|
int |
getEndVisibility()
Returns the visibility flag that will be set to a revealing view whenever this transition ends.
|
int |
getMode()
Returns the reveal mode of this transition.
|
Float |
getStartRadius()
Returns the start radius for animating circle of the reveal animation.
|
int |
getStartVisibility()
Returns the visibility flag that will be set to a revealing view whenever this transition
(its animation) starts.
|
android.animation.Animator |
onAppear(android.view.ViewGroup sceneRoot,
android.view.View view,
android.transition.TransitionValues startValues,
android.transition.TransitionValues endValues) |
android.animation.Animator |
onDisappear(android.view.ViewGroup sceneRoot,
android.view.View view,
android.transition.TransitionValues startValues,
android.transition.TransitionValues endValues) |
static float[] |
resolveCenter(android.view.View view)
Same as
resolveCenter(View, float, float) with fraction 0.5 for booth center
coordinates. |
static float[] |
resolveCenter(android.view.View view,
float centerXFraction,
float centerYFraction)
Resolves the center of the specified view based on its current width and
height according to the requested fractions.
|
static float[] |
resolveCenterPosition(android.view.View view)
Same as
resolveCenterPosition(View, float, float) with fraction 0.5 for booth
center coordinates. |
static float[] |
resolveCenterPosition(android.view.View view,
float centerXFraction,
float centerYFraction)
Like
resolveCenter(View, float, float) this method will resolve center of the specified
view based on its current width and height but also takes into count
its current x and y coordinate. |
void |
setAppearVisibility(int visibility)
Sets a visibility flag that should be set to a revealing view whenever this transition has
been requested to create an appear animator via
onAppear(ViewGroup, View, TransitionValues, TransitionValues). |
void |
setCenterGravity(Integer gravity)
Sets a gravity flags that should be used to resolve center for animating circle of the reveal
animation.
|
void |
setCenterHorizontalOffset(int offset)
Sets an offset for the center x coordinate for animating circle of the reveal animation.
|
void |
setCenterVerticalOffset(int offset)
Sets an offset for the center y coordinate for animating circle of the reveal animation.
|
void |
setCenterX(Float centerX)
Sets a center x coordinate for animating circle of the reveal animation.
|
void |
setCenterXFraction(float fractionX)
Sets a fraction for the center x coordinate.
|
void |
setCenterY(Float centerY)
Sets a center y coordinate for animating circle of the reveal animation.
|
void |
setCenterYFraction(float fractionY)
Sets a fraction for the center y coordinate.
|
void |
setDisappearVisibility(int visibility)
Sets a visibility flag that should be set to a revealing view whenever this transition has
been requested to create a disappear animator via
onDisappear(ViewGroup, View, TransitionValues, TransitionValues). |
void |
setEndRadius(Float radius)
Sets an end radius for animating circle of the reveal animation.
|
void |
setEndVisibility(int visibility)
Sets a visibility flag that should be set to a revealing view whenever this transition
(its animation) ends.
|
void |
setMode(int mode)
Sets a mode in which should this transition run.
|
void |
setStartRadius(Float radius)
Sets a start radius for animating circle of the reveal animation.
|
void |
setStartVisibility(int visibility)
Sets a visibility flag that should be set to a revealing view whenever this transition starts.
|
captureEndValues, captureStartValues, createAnimator, getTransitionProperties, isTransitionRequired, isVisible, onAppear, onDisappearaddListener, addTarget, addTarget, addTarget, addTarget, canRemoveViews, clone, excludeChildren, excludeChildren, excludeChildren, excludeTarget, excludeTarget, excludeTarget, excludeTarget, getDuration, getEpicenter, getEpicenterCallback, getInterpolator, getName, getPathMotion, getPropagation, getStartDelay, getTargetIds, getTargetNames, getTargets, getTargetTypes, getTransitionValues, removeListener, removeTarget, removeTarget, removeTarget, removeTarget, setDuration, setEpicenterCallback, setInterpolator, setMatchOrder, setPathMotion, setPropagation, setStartDelay, toStringpublic static final int REVEAL
This mode can be used as well for appearing targets as for disappearing ones.
public static final int CONCEAL
This mode can be used as well for disappearing targets as for appearing ones.
public Reveal()
Reveal(int) with REVEAL mode.public Reveal(int mode)
public Reveal(android.content.Context context,
android.util.AttributeSet attrs)
context - Context used to obtain values from the specified attrs.attrs - Set of attributes from which to obtain property values for the reveal animation.public static float calculateRadius(android.view.View view)
calculateRadius(float, float) where width and height of the given view
will be used for radius calculation.view - The view of which radius to calculate.public static float calculateRadius(float width,
float height)
width - The width or horizontal distance from which to calculate radius.height - The height or vertical distance from which to calculate radius.public static float[] resolveCenterPosition(android.view.View view)
resolveCenterPosition(View, float, float) with fraction 0.5 for booth
center coordinates.public static float[] resolveCenterPosition(android.view.View view,
float centerXFraction,
float centerYFraction)
resolveCenter(View, float, float) this method will resolve center of the specified
view based on its current width and height but also takes into count
its current x and y coordinate.view - The view of which center position to resolve.centerXFraction - Fraction to resolve x coordinate of the center. Should be from the
[0.0, 1.0] range.centerYFraction - Fraction to resolve y coordinate of the center. Should be from the
[0.0, 1.0] range.public static float[] resolveCenter(android.view.View view)
resolveCenter(View, float, float) with fraction 0.5 for booth center
coordinates.public static float[] resolveCenter(android.view.View view,
float centerXFraction,
float centerYFraction)
view - The view of which center to resolve.centerXFraction - Fraction to resolve x coordinate of the center. Should be from the
[0.0, 1.0] range.centerYFraction - Fraction to resolve y coordinate of the center. Should be from the
[0.0, 1.0] range.public static android.animation.Animator createAnimator(android.view.View view,
float startRadius,
float endRadius)
createAnimator(View, int, int, float, float) where the center coordinates
will be automatically resolved using the given view.resolveCenterPosition(View)public static android.animation.Animator createAnimator(android.view.View view,
int centerX,
int centerY,
float startRadius,
float endRadius)
view - The view for which to create the requested animator.centerX - X coordinate of a center from where should the reveal animation start.centerY - Y coordinate of a center from where should the reveal animation start.startRadius - Radius of the specified view at the start of the reveal animation.endRadius - Radius of the specified view at the end of the reveal animation.ViewAnimationUtils.createCircularReveal(View, int, int, float, float)public final void setMode(int mode)
Default value: REVEAL
public final int getMode()
public void setStartRadius(Float radius)
setEndRadius(Float)
or grater one otherwise there will be nothing to reveal/conceal.radius - The desired radius in pixels. May be null to use the default approach
to compute start radius based on the reveal mode.ui:uiStartRadius,
getStartRadius(),
setEndRadius(Float)public Float getStartRadius()
null if this radius will be calculated based on the
reveal mode.setStartRadius(Float)public void setEndRadius(Float radius)
setStartRadius(Float)
or smaller one otherwise there will be nothing to reveal/conceal.radius - The desired radius in pixels. May be null to use the default approach
to compute end radius based on the reveal mode.ui:uiEndRadius,
getEndRadius(),
setStartRadius(Float)public Float getEndRadius()
null if this radius will be calculated based on the
reveal mode.setEndRadius(Float)public void setStartVisibility(int visibility)
Default value: VISIBLE
visibility - One of View.VISIBLE, View.INVISIBLE or View.GONE.ui:uiStartVisibility,
getStartVisibility()public int getStartVisibility()
View.VISIBLE, View.INVISIBLE or View.GONE.setStartVisibility(int)public void setEndVisibility(int visibility)
Default value: VISIBLE
visibility - One of View.VISIBLE, View.INVISIBLE or View.GONE.ui:uiEndVisibility,
getEndVisibility()public int getEndVisibility()
View.VISIBLE, View.INVISIBLE or View.GONE.setEndVisibility(int)public void setAppearVisibility(int visibility)
onAppear(ViewGroup, View, TransitionValues, TransitionValues).
Default value: VISIBLE
visibility - One of View.VISIBLE, View.INVISIBLE or View.GONE.ui:uiAppearVisibility,
getAppearVisibility()public int getAppearVisibility()
View.VISIBLE, View.INVISIBLE or View.GONE.setAppearVisibility(int)public void setDisappearVisibility(int visibility)
onDisappear(ViewGroup, View, TransitionValues, TransitionValues).
Default value: VISIBLE
visibility - One of View.VISIBLE, View.INVISIBLE or View.GONE.ui:uiDisappearVisibility,
getDisappearVisibility()public int getDisappearVisibility()
View.VISIBLE, View.INVISIBLE or View.GONE.setDisappearVisibility(int)public void setCenterGravity(Integer gravity)
Sometimes the gravity is not enough to specify exact center coordinates for the reveal animation.
In such case you can move the center coordinates calculated by the requested gravity by
specifying horizontal and vertical offset via setCenterHorizontalOffset(int) and
setCenterVerticalOffset(int).
Default value: null
gravity - One of Gravity.CENTER, Gravity.CENTER_VERTICAL, Gravity.CENTER_HORIZONTAL,
Gravity.TOP, Gravity.BOTTOM, Gravity.START, Gravity.END
or theirs combination. May be null to use either specified exact center
coordinates or the specified fractions to calculate such coordinates.ui:uiCenterGravity,
getCenterGravity(),
setCenterX(Float),
setCenterY(Float),
setCenterXFraction(float),
setCenterYFraction(float)public Integer getCenterGravity()
Gravity.CENTER, Gravity.CENTER_VERTICAL, Gravity.CENTER_HORIZONTAL,
Gravity.TOP, Gravity.BOTTOM, Gravity.START, Gravity.END or
theirs combination or null if no gravity has been specified so either center coordinates
specified via setCenterX(Float) and setCenterY(Float) will be used or calculated
using the current center fraction values.setCenterGravity(Integer)public void setCenterHorizontalOffset(int offset)
Default value: 0
offset - The desired offset in pixels. If negative the center x coordinate will be moved
the the left, if positive it will be moved to the right, otherwise remains
unchanged.ui:uiCenterHorizontalOffset,
getCenterHorizontalOffset(),
setCenterVerticalOffset(int)public int getCenterHorizontalOffset()
setCenterHorizontalOffset(int)public void setCenterVerticalOffset(int offset)
Default value: 0
offset - The desired offset in pixels. If negative the center y coordinate will be moved
the the top, if positive it will be moved to the bottom, otherwise remains
unchanged.ui:uiCenterVerticalOffset,
getCenterVerticalOffset(),
setCenterHorizontalOffset(int)public int getCenterVerticalOffset()
setCenterVerticalOffset(int)public void setCenterX(Float centerX)
Default value: null
centerX - The desired center x coordinate in pixels. May be null to use center
x fraction specified via setCenterXFraction(float) instead.getCenterX(),
setCenterXFraction(float),
setCenterY(Float)public Float getCenterX()
null if no coordinate
has been specified so the fraction will be used to calculate this center coordinate.setCenterX(Float)public void setCenterY(Float centerY)
Default value: null
centerY - The desired center y coordinate in pixels. May be null to use center
y fraction specified via setCenterYFraction(float) instead.getCenterY(),
setCenterYFraction(float),
setCenterX(Float)public Float getCenterY()
null if no coordinate
has been specified so the fraction will be used to calculate this center coordinate.setCenterY(Float)public void setCenterXFraction(float fractionX)
setCenterX(Float).
Sometimes the fraction is not enough to specify exact center coordinate for the reveal animation.
In such case you can move the center coordinates calculated by the requested fractions by
specifying horizontal and vertical offset via setCenterHorizontalOffset(int) and
setCenterVerticalOffset(int).
Default value: 0.5
fractionX - The desired fraction from the [0.0, 1.0] range.android:centerX,
getCenterXFraction(),
setCenterYFraction(float),
setCenterX(Float)public float getCenterXFraction()
[0.0, 1.0] range.setCenterXFraction(float)public void setCenterYFraction(float fractionY)
setCenterY(Float).
Sometimes the fraction is not enough to specify exact center coordinate for the reveal animation.
In such case you can move the center coordinates calculated by the requested fractions by
specifying horizontal and vertical offset via setCenterHorizontalOffset(int) and
setCenterVerticalOffset(int).
Default value: 0.5
fractionY - The desired fraction from the [0.0, 1.0] range.android:centerY,
getCenterYFraction(),
setCenterXFraction(float),
setCenterY(Float)public float getCenterYFraction()
[0.0, 1.0] range.setCenterYFraction(float)public android.animation.Animator onAppear(android.view.ViewGroup sceneRoot,
android.view.View view,
android.transition.TransitionValues startValues,
android.transition.TransitionValues endValues)
onAppear in class android.transition.Visibilitypublic android.animation.Animator onDisappear(android.view.ViewGroup sceneRoot,
android.view.View view,
android.transition.TransitionValues startValues,
android.transition.TransitionValues endValues)
onDisappear in class android.transition.Visibility