-
public final class EdgeEffectCompat
Helper for accessing EdgeEffect. This class is used to access EdgeEffect on platform versions that support it. When running on older platforms it will result in no-ops. It should be used by views that wish to use the standard Android visual effects at the edges of scrolling containers.
-
-
Constructor Summary
Constructors Constructor Description EdgeEffectCompat(Context context)
Construct a new EdgeEffect themed using the given context.
-
Method Summary
Modifier and Type Method Description void
setSize(int width, int height)
Set the size of this edge effect in pixels. boolean
isFinished()
Reports if this EdgeEffectCompat's animation is finished. void
finish()
Immediately finish the current animation. boolean
onPull(float deltaDistance)
A view should call this when content is pulled away from an edge by the user.This will update the state of the current visual effect and its associated animation. boolean
onPull(float deltaDistance, float displacement)
A view should call this when content is pulled away from an edge by the user.This will update the state of the current visual effect and its associated animation. static void
onPull(@NonNull() EdgeEffect edgeEffect, float deltaDistance, float displacement)
A view should call this when content is pulled away from an edge by the user.This will update the state of the current visual effect and its associated animation. boolean
onRelease()
Call when the object is released after being pulled.This will begin the "decay" phase of the effect. boolean
onAbsorb(int velocity)
Call when the effect absorbs an impact at the given velocity.Used when a fling reaches the scroll boundary. boolean
draw(Canvas canvas)
Draw into the provided canvas. -
-
Constructor Detail
-
EdgeEffectCompat
EdgeEffectCompat(Context context)
Construct a new EdgeEffect themed using the given context.- Parameters:
context
- Context to use for theming the effect
-
-
Method Detail
-
setSize
@Deprecated() void setSize(int width, int height)
Set the size of this edge effect in pixels.
- Parameters:
width
- Effect width in pixelsheight
- Effect height in pixels
-
isFinished
@Deprecated() boolean isFinished()
Reports if this EdgeEffectCompat's animation is finished. If this method returns falseafter a call to draw the host widget should schedule anotherdrawing pass to continue the animation.
-
finish
@Deprecated() void finish()
Immediately finish the current animation.After this call isFinished will return true.
-
onPull
@Deprecated() boolean onPull(float deltaDistance)
A view should call this when content is pulled away from an edge by the user.This will update the state of the current visual effect and its associated animation.The host view should always invalidate if this methodreturns true and draw the results accordingly.
- Parameters:
deltaDistance
- Change in distance since the last call.
-
onPull
@Deprecated() boolean onPull(float deltaDistance, float displacement)
A view should call this when content is pulled away from an edge by the user.This will update the state of the current visual effect and its associated animation.The host view should always invalidate if this methodreturns true and draw the results accordingly.Views using EdgeEffect should favor onPull whenthe displacement of the pull point is known.
- Parameters:
deltaDistance
- Change in distance since the last call.displacement
- The displacement from the starting side of the effect of the pointinitiating the pull.
-
onPull
static void onPull(@NonNull() EdgeEffect edgeEffect, float deltaDistance, float displacement)
A view should call this when content is pulled away from an edge by the user.This will update the state of the current visual effect and its associated animation.The host view should always invalidate after call this methodand draw the results accordingly.
- Parameters:
edgeEffect
- The EdgeEffect that is attached to the view that is getting pulled awayfrom an edge by the user.deltaDistance
- Change in distance since the last call.displacement
- The displacement from the starting side of the effect of the pointinitiating the pull.
-
onRelease
@Deprecated() boolean onRelease()
Call when the object is released after being pulled.This will begin the "decay" phase of the effect. After calling this methodthe host view should invalidate if this methodreturns true and thereby draw the results accordingly.
-
onAbsorb
@Deprecated() boolean onAbsorb(int velocity)
Call when the effect absorbs an impact at the given velocity.Used when a fling reaches the scroll boundary.
When using a android.widget.Scroller or android.widget.OverScroller,the method
getCurrVelocity
will provide a reasonable approximationto use here.- Parameters:
velocity
- Velocity at impact in pixels per second.
-
draw
@Deprecated() boolean draw(Canvas canvas)
Draw into the provided canvas. Assumes that the canvas has been rotatedaccordingly and the size has been set. The effect will be drawn the fullwidth of X=0 to X=width, beginning from Y=0 and extending to some factor <1.f of height.
- Parameters:
canvas
- Canvas to draw into
-
-
-
-