-
- All Implemented Interfaces:
-
tds.androidx.core.view.NestedScrollingParent
public interface NestedScrollingParent2 implements NestedScrollingParent
This interface should be implemented by ViewGroup subclasses that wish to support scrolling operations delegated by a nested child view.
Classes implementing this interface should create a final instance of a NestedScrollingParentHelper as a field and delegate any View or ViewGroup methods to the
NestedScrollingParentHelper
methods of the same signature.Views invoking nested scrolling functionality should always do so from the relevant ViewCompat, ViewGroupCompat or ViewParentCompat compatibility shim static methods. This ensures interoperability with nested scrolling views on all versions of Android.
-
-
Method Summary
Modifier and Type Method Description abstract boolean
onStartNestedScroll(@NonNull() View child, @NonNull() View target, int axes, int type)
React to a descendant view initiating a nestable scroll operation, claiming thenested scroll operation if appropriate. abstract void
onNestedScrollAccepted(@NonNull() View child, @NonNull() View target, int axes, int type)
React to the successful claiming of a nested scroll operation. abstract void
onStopNestedScroll(@NonNull() View target, int type)
React to a nested scroll operation ending. abstract void
onNestedScroll(@NonNull() View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type)
React to a nested scroll in progress. abstract void
onNestedPreScroll(@NonNull() View target, int dx, int dy, @NonNull() Array<int> consumed, int type)
React to a nested scroll in progress before the target view consumes a portion of the scroll. -
Methods inherited from class tds.androidx.core.view.NestedScrollingParent
getNestedScrollAxes, onNestedFling, onNestedPreFling, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onStartNestedScroll, onStopNestedScroll
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
onStartNestedScroll
abstract boolean onStartNestedScroll(@NonNull() View child, @NonNull() View target, int axes, int type)
React to a descendant view initiating a nestable scroll operation, claiming thenested scroll operation if appropriate.
This method will be called in response to a descendant view invoking startNestedScroll. Each parent up the view hierarchy will begiven an opportunity to respond and claim the nested scrolling operation by returning
true
.This method may be overridden by ViewParent implementations to indicate when the viewis willing to support a nested scrolling operation that is about to begin. If it returnstrue, this ViewParent will become the target view's nested scrolling parent for the durationof the scroll operation in progress. When the nested scroll is finished this ViewParentwill receive a call to onStopNestedScroll.
- Parameters:
child
- Direct child of this ViewParent containing targettarget
- View that initiated the nested scrollaxes
- Flags consisting of SCROLL_AXIS_HORIZONTAL,SCROLL_AXIS_VERTICAL or bothtype
- the type of input which cause this scroll event
-
onNestedScrollAccepted
abstract void onNestedScrollAccepted(@NonNull() View child, @NonNull() View target, int axes, int type)
React to the successful claiming of a nested scroll operation.
This method will be called after onStartNestedScroll returns true. Itoffers an opportunity for the view and its superclasses to perform initial configurationfor the nested scroll. Implementations of this method should always call their superclass'simplementation of this method if one is present.
- Parameters:
child
- Direct child of this ViewParent containing targettarget
- View that initiated the nested scrollaxes
- Flags consisting of SCROLL_AXIS_HORIZONTAL,SCROLL_AXIS_VERTICAL or bothtype
- the type of input which cause this scroll event
-
onStopNestedScroll
abstract void onStopNestedScroll(@NonNull() View target, int type)
React to a nested scroll operation ending.
Perform cleanup after a nested scrolling operation.This method will be called when a nested scroll stops, for example when a nested touchscroll ends with a ACTION_UP or ACTION_CANCEL event.Implementations of this method should always call their superclass's implementation of thismethod if one is present.
- Parameters:
target
- View that initiated the nested scrolltype
- the type of input which cause this scroll event
-
onNestedScroll
abstract void onNestedScroll(@NonNull() View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed, int type)
React to a nested scroll in progress.
This method will be called when the ViewParent's current nested scrolling child viewdispatches a nested scroll event. To receive calls to this method the ViewParent must havepreviously returned
true
for a call to onStartNestedScroll.Both the consumed and unconsumed portions of the scroll distance are reported to theViewParent. An implementation may choose to use the consumed portion to match or chase scrollposition of multiple child elements, for example. The unconsumed portion may be used toallow continuous dragging of multiple scrolling or draggable elements, such as scrollinga list within a vertical drawer where the drawer begins dragging once the edge of innerscrolling content is reached.
- Parameters:
target
- The descendent view controlling the nested scrolldxConsumed
- Horizontal scroll distance in pixels already consumed by targetdyConsumed
- Vertical scroll distance in pixels already consumed by targetdxUnconsumed
- Horizontal scroll distance in pixels not consumed by targetdyUnconsumed
- Vertical scroll distance in pixels not consumed by targettype
- the type of input which cause this scroll event
-
onNestedPreScroll
abstract void onNestedPreScroll(@NonNull() View target, int dx, int dy, @NonNull() Array<int> consumed, int type)
React to a nested scroll in progress before the target view consumes a portion of the scroll.
When working with nested scrolling often the parent view may want an opportunityto consume the scroll before the nested scrolling child does. An example of this is adrawer that contains a scrollable list. The user will want to be able to scroll the listfully into view before the list itself begins scrolling.
onNestedPreScroll
is called when a nested scrolling child invokes dispatchNestedPreScroll. The implementation shouldreport how any pixels of the scroll reported by dx, dy were consumed in theconsumed
array. Index 0 corresponds to dx and index 1 corresponds to dy.This parameter will never be null. Initial values for consumed[0] and consumed[1]will always be 0.- Parameters:
target
- View that initiated the nested scrolldx
- Horizontal scroll distance in pixelsdy
- Vertical scroll distance in pixelsconsumed
- Output.type
- the type of input which cause this scroll event
-
-
-
-