Skip to content

Most visited

Recently visited

navigation

EdgeEffectCompat

public final class EdgeEffectCompat
extends Object

java.lang.Object
   ↳ android.support.v4.widget.EdgeEffectCompat


Helper for accessing EdgeEffect in a backwards compatible fashion. 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.

Summary

Public constructors

EdgeEffectCompat(Context context)

This constructor was deprecated in API level 26.0.0-alpha1. Use EdgeEffect constructor directly.

Public methods

boolean draw(Canvas canvas)

This method was deprecated in API level 26.0.0-alpha1. Use draw(Canvas) directly.

void finish()

This method was deprecated in API level 26.0.0-alpha1. Use finish() directly.

boolean isFinished()

This method was deprecated in API level 26.0.0-alpha1. Use isFinished() directly.

boolean onAbsorb(int velocity)

This method was deprecated in API level 26.0.0-alpha1. Use onAbsorb(int) directly.

boolean onPull(float deltaDistance)

This method was deprecated in API level 22.1.0. Use onPull(EdgeEffect, float, float).

boolean onPull(float deltaDistance, float displacement)

This method was deprecated in API level 26.0.0-alpha1. Use onPull(float) directly.

static void onPull(EdgeEffect edgeEffect, float deltaDistance, float displacement)

A view should call this when content is pulled away from an edge by the user.

boolean onRelease()

This method was deprecated in API level 26.0.0-alpha1. Use onRelease() directly.

void setSize(int width, int height)

This method was deprecated in API level 26.0.0-alpha1. Use setSize(int, int) directly.

Inherited methods

From class java.lang.Object

Public constructors

EdgeEffectCompat

EdgeEffectCompat (Context context)

This constructor was deprecated in API level 26.0.0-alpha1.
Use EdgeEffect constructor directly.

Construct a new EdgeEffect themed using the given context.

Note: On platform versions that do not support EdgeEffect, all operations on the newly constructed object will be mocked/no-ops.

Parameters
context Context: Context to use for theming the effect

Public methods

draw

boolean draw (Canvas canvas)

This method was deprecated in API level 26.0.0-alpha1.
Use draw(Canvas) directly.

Draw into the provided canvas. Assumes that the canvas has been rotated accordingly and the size has been set. The effect will be drawn the full width of X=0 to X=width, beginning from Y=0 and extending to some factor < 1.f of height.

Parameters
canvas Canvas: Canvas to draw into
Returns
boolean true if drawing should continue beyond this frame to continue the animation

finish

void finish ()

This method was deprecated in API level 26.0.0-alpha1.
Use finish() directly.

Immediately finish the current animation. After this call isFinished() will return true.

isFinished

boolean isFinished ()

This method was deprecated in API level 26.0.0-alpha1.
Use isFinished() directly.

Reports if this EdgeEffectCompat's animation is finished. If this method returns false after a call to draw(Canvas) the host widget should schedule another drawing pass to continue the animation.

Returns
boolean true if animation is finished, false if drawing should continue on the next frame.

onAbsorb

boolean onAbsorb (int velocity)

This method was deprecated in API level 26.0.0-alpha1.
Use onAbsorb(int) directly.

Call when the effect absorbs an impact at the given velocity. Used when a fling reaches the scroll boundary.

When using a Scroller or OverScroller, the method getCurrVelocity will provide a reasonable approximation to use here.

Parameters
velocity int: Velocity at impact in pixels per second.
Returns
boolean true if the host view should invalidate, false if it should not.

onPull

boolean onPull (float deltaDistance)

This method was deprecated in API level 22.1.0.
Use onPull(EdgeEffect, float, float).

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 method returns true and draw the results accordingly.

Parameters
deltaDistance float: Change in distance since the last call. Values may be 0 (no change) to 1.f (full length of the view) or negative values to express change back toward the edge reached to initiate the effect.
Returns
boolean true if the host view should call invalidate, false if it should not.

onPull

boolean onPull (float deltaDistance, 
                float displacement)

This method was deprecated in API level 26.0.0-alpha1.
Use onPull(float) directly.

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 method returns true and draw the results accordingly. Views using EdgeEffect should favor onPull(float, float) when the displacement of the pull point is known.

Parameters
deltaDistance float: Change in distance since the last call. Values may be 0 (no change) to 1.f (full length of the view) or negative values to express change back toward the edge reached to initiate the effect.
displacement float: The displacement from the starting side of the effect of the point initiating the pull. In the case of touch this is the finger position. Values may be from 0-1.
Returns
boolean true if the host view should call invalidate, false if it should not.

onPull

void onPull (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 method and draw the results accordingly.

Parameters
edgeEffect EdgeEffect: The EdgeEffect that is attached to the view that is getting pulled away from an edge by the user.
deltaDistance float: Change in distance since the last call. Values may be 0 (no change) to 1.f (full length of the view) or negative values to express change back toward the edge reached to initiate the effect.
displacement float: The displacement from the starting side of the effect of the point initiating the pull. In the case of touch this is the finger position. Values may be from 0-1.

See also:

onRelease

boolean onRelease ()

This method was deprecated in API level 26.0.0-alpha1.
Use onRelease() directly.

Call when the object is released after being pulled. This will begin the "decay" phase of the effect. After calling this method the host view should invalidate() if this method returns true and thereby draw the results accordingly.

Returns
boolean true if the host view should invalidate, false if it should not.

setSize

void setSize (int width, 
                int height)

This method was deprecated in API level 26.0.0-alpha1.
Use setSize(int, int) directly.

Set the size of this edge effect in pixels.

Parameters
width int: Effect width in pixels
height int: Effect height in pixels
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.