SwipeRefreshLayout

(SESL modified) The SwipeRefreshLayout should be used whenever the user can refresh the contents of a view via a vertical swipe gesture. The activity that instantiates this view should add an OnRefreshListener to be notified whenever the swipe to refresh gesture is completed. The SwipeRefreshLayout will notify the listener each and every time the gesture is completed again; the listener is responsible for correctly determining when to actually initiate a refresh of its content. If the listener determines there should not be a refresh, it must call setRefreshing(false) to cancel any visual indication of a refresh. If an activity wishes to show just the progress animation, it should call setRefreshing(true). To disable the gesture and progress animation, call setEnabled(false) on the view.

This layout should be made the parent of the view that will be refreshed as a result of the gesture and can only support one direct child. This view will also be made the target of the gesture and will be forced to match both the width and the height supplied in this layout. The SwipeRefreshLayout does not provide accessibility events; instead, a menu item must be provided to allow refresh of the content wherever this gesture is used.

Constructors

Link copied to clipboard
constructor(@NonNull context: Context)
Simple constructor to use when creating a SwipeRefreshLayout from code.
constructor(@NonNull context: Context, @Nullable attrs: AttributeSet)
Constructor that is called when inflating SwipeRefreshLayout from XML.

Types

Link copied to clipboard
Classes that wish to override canChildScrollUp method behavior should implement this interface.
Link copied to clipboard
Classes that wish to be notified when the swipe gesture correctly triggers a refresh should implement this interface.

Properties

Link copied to clipboard
val DEFAULT: Int = 1
Link copied to clipboard
Link copied to clipboard
val LARGE: Int = 0

Functions

Link copied to clipboard
Link copied to clipboard
open fun dispatchNestedFling(velocityX: Float, velocityY: Float, consumed: Boolean): Boolean
Link copied to clipboard
open fun dispatchNestedPreFling(velocityX: Float, velocityY: Float): Boolean
Link copied to clipboard
open fun dispatchNestedPreScroll(dx: Int, dy: Int, @Nullable consumed: Array<Int>, @Nullable offsetInWindow: Array<Int>): Boolean
open fun dispatchNestedPreScroll(dx: Int, dy: Int, @Nullable consumed: Array<Int>, @Nullable offsetInWindow: Array<Int>, type: Int): Boolean
Link copied to clipboard
open fun dispatchNestedScroll(dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: Array<Int>): Boolean
open fun dispatchNestedScroll(dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: Array<Int>, type: Int): Boolean
open fun dispatchNestedScroll(dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, @Nullable offsetInWindow: Array<Int>, type: Int, @NonNull consumed: Array<Int>)
Link copied to clipboard
Link copied to clipboard
Get the diameter of the progress circle that is displayed as part of the swipe to refresh layout.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun isRefreshing(): Boolean
Link copied to clipboard
Link copied to clipboard
open fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
Link copied to clipboard
open fun onNestedFling(target: View, velocityX: Float, velocityY: Float, consumed: Boolean): Boolean
Link copied to clipboard
open fun onNestedPreFling(target: View, velocityX: Float, velocityY: Float): Boolean
Link copied to clipboard
open fun onNestedPreScroll(target: View, dx: Int, dy: Int, consumed: Array<Int>)
open fun onNestedPreScroll(@NonNull target: View, dx: Int, dy: Int, @NonNull consumed: Array<Int>, type: Int)
Link copied to clipboard
open fun onNestedScroll(target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int)
open fun onNestedScroll(@NonNull target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, type: Int)
open fun onNestedScroll(@NonNull target: View, dxConsumed: Int, dyConsumed: Int, dxUnconsumed: Int, dyUnconsumed: Int, type: Int, @NonNull consumed: Array<Int>)
Link copied to clipboard
open fun onNestedScrollAccepted(child: View, target: View, axes: Int)
open fun onNestedScrollAccepted(@NonNull child: View, @NonNull target: View, axes: Int, type: Int)
Link copied to clipboard
open fun onStartNestedScroll(child: View, target: View, axes: Int): Boolean
open fun onStartNestedScroll(@NonNull child: View, @NonNull target: View, axes: Int, type: Int): Boolean
Link copied to clipboard
open fun onStopNestedScroll(target: View)
open fun onStopNestedScroll(@NonNull target: View, type: Int)
Link copied to clipboard
Link copied to clipboard
open fun seslSetRefreshOnce(once: Boolean)
Link copied to clipboard
open fun setColorScheme(@ColorRes colors: Array<Int>)
Link copied to clipboard
open fun setColorSchemeColors(@ColorInt colors: Array<Int>)
Set the colors used in the progress animation.
Link copied to clipboard
open fun setColorSchemeResources(@ColorRes colorResIds: Array<Int>)
Set the color resources used in the progress animation from color resources.
Link copied to clipboard
open fun setDistanceToTriggerSync(distance: Int)
Set the distance to trigger a sync in dips
Link copied to clipboard
open fun setEnabled(enabled: Boolean)
Enables the legacy behavior of requestDisallowInterceptTouchEvent from before 1.1.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Set the listener to be notified when a refresh is triggered via the swipe gesture.
Link copied to clipboard
open fun setProgressBackgroundColor(colorRes: Int)
Link copied to clipboard
Set the background color of the progress spinner disc.
Link copied to clipboard
Set the background color of the progress spinner disc.
Link copied to clipboard
open fun setProgressViewEndTarget(scale: Boolean, end: Int)
The refresh indicator resting position is always positioned near the top of the refreshing content.
Link copied to clipboard
open fun setProgressViewOffset(scale: Boolean, start: Int, end: Int)
The refresh indicator starting and resting position is always positioned near the top of the refreshing content.
Link copied to clipboard
open fun setRefreshing(refreshing: Boolean)
Notify the widget that refresh state has changed.
Link copied to clipboard
open fun setSize(size: Int)
One of DEFAULT, or LARGE.
Link copied to clipboard
open fun setSlingshotDistance(@Px slingshotDistance: Int)
Sets the distance that the refresh indicator can be pulled beyond its resting position during a swipe gesture.
Link copied to clipboard
open fun startNestedScroll(axes: Int): Boolean
open fun startNestedScroll(axes: Int, type: Int): Boolean
Link copied to clipboard
open fun stopNestedScroll()
open fun stopNestedScroll(type: Int)