# EdgeEffectCompat

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Ctors](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#pubctors)\|[Methods](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#)  

# EdgeEffectCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
EdgeEffectCompat
`  
`

extends Object


``


`

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

<br />

*** ** * ** ***

Helper for accessing[EdgeEffect](https://developer.android.com/reference/android/widget/EdgeEffect.html). This class is used to access[EdgeEffect](https://developer.android.com/reference/android/widget/EdgeEffect.html)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](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#EdgeEffectCompat(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context.html)` context) ` *This constructor was deprecated in API level 26.1.0. Use[EdgeEffect](https://developer.android.com/reference/android/widget/EdgeEffect.html)constructor directly.* |

|                                                                                                                                                                                                     ### Public methods                                                                                                                                                                                                     ||
|----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean`     | ` `[draw](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#draw(android.graphics.Canvas))`(`[Canvas](https://developer.android.com/reference/android/graphics/Canvas.html)` canvas) ` *This method was deprecated in API level 26.1.0. Use[draw(Canvas)](https://developer.android.com/reference/android/widget/EdgeEffect.html#draw(android.graphics.Canvas))directly.* |
| ` void`        | ` `[finish](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#finish())`() ` *This method was deprecated in API level 26.1.0. Use[finish()](https://developer.android.com/reference/android/widget/EdgeEffect.html#finish())directly.*                                                                                                                                    |
| ` boolean`     | ` `[isFinished](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#isFinished())`() ` *This method was deprecated in API level 26.1.0. Use[isFinished()](https://developer.android.com/reference/android/widget/EdgeEffect.html#isFinished())directly.*                                                                                                                    |
| ` boolean`     | ` `[onAbsorb](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#onAbsorb(int))`(int velocity) ` *This method was deprecated in API level 26.1.0. Use[onAbsorb(int)](https://developer.android.com/reference/android/widget/EdgeEffect.html#onAbsorb(int))directly.*                                                                                                       |
| ` boolean`     | ` `[onPull](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#onPull(float))`(float deltaDistance) ` *This method was deprecated in API level 22.1.0. Use[onPull(EdgeEffect, float, float)](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#onPull(android.widget.EdgeEffect, float, float)).*                                         |
| ` boolean`     | ` `[onPull](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#onPull(float, float))`(float deltaDistance, float displacement) ` *This method was deprecated in API level 26.1.0. Use[onPull(float)](https://developer.android.com/reference/android/widget/EdgeEffect.html#onPull(float))directly.*                                                                       |
| ` static void` | ` `[onPull](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#onPull(android.widget.EdgeEffect, float, float))`(`[EdgeEffect](https://developer.android.com/reference/android/widget/EdgeEffect.html)` edgeEffect, float deltaDistance, float displacement) ` A view should call this when content is pulled away from an edge by the user.                               |
| ` boolean`     | ` `[onRelease](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#onRelease())`() ` *This method was deprecated in API level 26.1.0. Use[onRelease()](https://developer.android.com/reference/android/widget/EdgeEffect.html#onRelease())directly.*                                                                                                                        |
| ` void`        | ` `[setSize](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#setSize(int, int))`(int width, int height) ` *This method was deprecated in API level 26.1.0. Use[setSize(int, int)](https://developer.android.com/reference/android/widget/EdgeEffect.html#setSize(int, int))directly.*                                                                                   |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public constructors

### EdgeEffectCompat

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
EdgeEffectCompat (Context context)
```

<br />

**This constructor was deprecated in API level 26.1.0.**   
Use[EdgeEffect](https://developer.android.com/reference/android/widget/EdgeEffect.html)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.

<br />

<br />

|                             Parameters                             ||
|-----------|---------------------------------------------------------|
| `context` | `Context`: Context to use for theming the effect <br /> |

## Public methods

### draw

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean draw (Canvas canvas)
```

<br />

**This method was deprecated in API level 26.1.0.**   
Use[draw(Canvas)](https://developer.android.com/reference/android/widget/EdgeEffect.html#draw(android.graphics.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.

<br />

|                   Parameters                   ||
|----------|--------------------------------------|
| `canvas` | `Canvas`: Canvas to draw into <br /> |

|                                            Returns                                            ||
|-----------|------------------------------------------------------------------------------------|
| `boolean` | true if drawing should continue beyond this frame to continue the animation <br /> |

### finish

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void finish ()
```

<br />

**This method was deprecated in API level 26.1.0.**   
Use[finish()](https://developer.android.com/reference/android/widget/EdgeEffect.html#finish())directly.

Immediately finish the current animation. After this call[isFinished()](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#isFinished())will return true.

<br />

### isFinished

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean isFinished ()
```

<br />

**This method was deprecated in API level 26.1.0.**   
Use[isFinished()](https://developer.android.com/reference/android/widget/EdgeEffect.html#isFinished())directly.

Reports if this EdgeEffectCompat's animation is finished. If this method returns false after a call to[draw(Canvas)](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#draw(android.graphics.Canvas))the host widget should schedule another drawing pass to continue the animation.

<br />

|                                               Returns                                                ||
|-----------|-------------------------------------------------------------------------------------------|
| `boolean` | true if animation is finished, false if drawing should continue on the next frame. <br /> |

### onAbsorb

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean onAbsorb (int velocity)
```

<br />

**This method was deprecated in API level 26.1.0.**   
Use[onAbsorb(int)](https://developer.android.com/reference/android/widget/EdgeEffect.html#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](https://developer.android.com/reference/android/widget/Scroller.html)or[OverScroller](https://developer.android.com/reference/android/widget/OverScroller.html), the method`getCurrVelocity`will provide a reasonable approximation to use here.

<br />

<br />

|                             Parameters                             ||
|------------|--------------------------------------------------------|
| `velocity` | `int`: Velocity at impact in pixels per second. <br /> |

|                                      Returns                                       ||
|-----------|-------------------------------------------------------------------------|
| `boolean` | true if the host view should invalidate, false if it should not. <br /> |

### onPull

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean onPull (float deltaDistance)
```

<br />

**This method was deprecated in API level 22.1.0.**   
Use[onPull(EdgeEffect, float, float)](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat#onPull(android.widget.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()](https://developer.android.com/reference/android/view/View.html#invalidate())if this method returns true and draw the results accordingly.

<br />

|                                                                                                           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. <br /> |

|                                         Returns                                         ||
|-----------|------------------------------------------------------------------------------|
| `boolean` | true if the host view should call invalidate, false if it should not. <br /> |

### onPull

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean onPull (float deltaDistance, 
                float displacement)
```

<br />

**This method was deprecated in API level 26.1.0.**   
Use[onPull(float)](https://developer.android.com/reference/android/widget/EdgeEffect.html#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()](https://developer.android.com/reference/android/view/View.html#invalidate())if this method returns true and draw the results accordingly. Views using[EdgeEffect](https://developer.android.com/reference/android/widget/EdgeEffect.html)should favor[onPull(float, float)](https://developer.android.com/reference/android/widget/EdgeEffect.html#onPull(float, float))when the displacement of the pull point is known.

<br />

|                                                                                                           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. <br /> |
| `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. <br />                              |

|                                         Returns                                         ||
|-----------|------------------------------------------------------------------------------|
| `boolean` | true if the host view should call invalidate, false if it should not. <br /> |

### onPull

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
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()](https://developer.android.com/reference/android/view/View.html#invalidate())after call this method and draw the results accordingly.

<br />

|                                                                                                           Parameters                                                                                                            ||
|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `edgeEffect`    | `EdgeEffect`: The EdgeEffect that is attached to the view that is getting pulled away from an edge by the user. <br />                                                                                         |
| `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. <br /> |
| `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. <br />                              |

**See also:**

- [ERROR(EdgeEffect#onPull(float, float)}
/{@link EdgeEffect#onPull(float, float)})](https://developer.android.com/)  

### onRelease

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean onRelease ()
```

<br />

**This method was deprecated in API level 26.1.0.**   
Use[onRelease()](https://developer.android.com/reference/android/widget/EdgeEffect.html#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()](https://developer.android.com/reference/android/view/View.html#invalidate())if this method returns true and thereby draw the results accordingly.

<br />

|                                      Returns                                       ||
|-----------|-------------------------------------------------------------------------|
| `boolean` | true if the host view should invalidate, false if it should not. <br /> |

### setSize

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setSize (int width, 
                int height)
```

<br />

**This method was deprecated in API level 26.1.0.**   
Use[setSize(int, int)](https://developer.android.com/reference/android/widget/EdgeEffect.html#setSize(int, int))directly.

Set the size of this edge effect in pixels.

<br />

|                   Parameters                    ||
|----------|---------------------------------------|
| `width`  | `int`: Effect width in pixels <br />  |
| `height` | `int`: Effect height in pixels <br /> |

-

  ## Interfaces

  - [DrawerLayout.DrawerListener](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.DrawerListener)
  - [NestedScrollView.OnScrollChangeListener](https://developer.android.com/reference/android/support/v4/widget/NestedScrollView.OnScrollChangeListener)
  - [SimpleCursorAdapter.CursorToStringConverter](https://developer.android.com/reference/android/support/v4/widget/SimpleCursorAdapter.CursorToStringConverter)
  - [SimpleCursorAdapter.ViewBinder](https://developer.android.com/reference/android/support/v4/widget/SimpleCursorAdapter.ViewBinder)
  - [SlidingPaneLayout.PanelSlideListener](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.PanelSlideListener)
  - [SwipeRefreshLayout.OnChildScrollUpCallback](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.OnChildScrollUpCallback)
  - [SwipeRefreshLayout.OnRefreshListener](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.OnRefreshListener)
  - [TintableCompoundButton](https://developer.android.com/reference/android/support/v4/widget/TintableCompoundButton)
-

  ## Classes

  - [AutoScrollHelper](https://developer.android.com/reference/android/support/v4/widget/AutoScrollHelper)
  - [CircularProgressDrawable](https://developer.android.com/reference/android/support/v4/widget/CircularProgressDrawable)
  - [CompoundButtonCompat](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat)
  - [ContentLoadingProgressBar](https://developer.android.com/reference/android/support/v4/widget/ContentLoadingProgressBar)
  - [CursorAdapter](https://developer.android.com/reference/android/support/v4/widget/CursorAdapter)
  - [DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)
  - [DrawerLayout.LayoutParams](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.LayoutParams)
  - [DrawerLayout.SavedState](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.SavedState)
  - [DrawerLayout.SimpleDrawerListener](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.SimpleDrawerListener)
  - [EdgeEffectCompat](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat)
  - [ExploreByTouchHelper](https://developer.android.com/reference/android/support/v4/widget/ExploreByTouchHelper)
  - [ImageViewCompat](https://developer.android.com/reference/android/support/v4/widget/ImageViewCompat)
  - [ListPopupWindowCompat](https://developer.android.com/reference/android/support/v4/widget/ListPopupWindowCompat)
  - [ListViewAutoScrollHelper](https://developer.android.com/reference/android/support/v4/widget/ListViewAutoScrollHelper)
  - [ListViewCompat](https://developer.android.com/reference/android/support/v4/widget/ListViewCompat)
  - [NestedScrollView](https://developer.android.com/reference/android/support/v4/widget/NestedScrollView)
  - [PopupMenuCompat](https://developer.android.com/reference/android/support/v4/widget/PopupMenuCompat)
  - [PopupWindowCompat](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat)
  - [ResourceCursorAdapter](https://developer.android.com/reference/android/support/v4/widget/ResourceCursorAdapter)
  - [ScrollerCompat](https://developer.android.com/reference/android/support/v4/widget/ScrollerCompat)
  - [SimpleCursorAdapter](https://developer.android.com/reference/android/support/v4/widget/SimpleCursorAdapter)
  - [SlidingPaneLayout](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout)
  - [SlidingPaneLayout.LayoutParams](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.LayoutParams)
  - [SlidingPaneLayout.SimplePanelSlideListener](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.SimplePanelSlideListener)
  - [Space](https://developer.android.com/reference/android/support/v4/widget/Space)
  - [SwipeRefreshLayout](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout)
  - [TextViewCompat](https://developer.android.com/reference/android/support/v4/widget/TextViewCompat)
  - [ViewDragHelper](https://developer.android.com/reference/android/support/v4/widget/ViewDragHelper)
  - [ViewDragHelper.Callback](https://developer.android.com/reference/android/support/v4/widget/ViewDragHelper.Callback)