-
public class RightSheetBehavior<V extends View> extends BottomSheetBehavior<V>
-
-
Constructor Summary
Constructors Constructor Description RightSheetBehavior(Context context, AttributeSet attrs)
-
Method Summary
Modifier and Type Method Description boolean
onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection)
Called when the parent CoordinatorLayout is about the lay out the given child view. boolean
onInterceptTouchEvent(@NonNull() CoordinatorLayout parent, @NonNull() V child, @NonNull() MotionEvent event)
Respond to CoordinatorLayout touch events before they are dispatched to child views. boolean
onTouchEvent(@NonNull() CoordinatorLayout parent, @NonNull() V child, @NonNull() MotionEvent event)
Respond to CoordinatorLayout touch events after this Behavior has started intercepting them. boolean
onStartNestedScroll(@NonNull() CoordinatorLayout coordinatorLayout, @NonNull() V child, @NonNull() View directTargetChild, @NonNull() View target, int axes, int type)
Called when a descendant of the CoordinatorLayout attempts to initiate a nested scroll. void
onNestedPreScroll(@NonNull() CoordinatorLayout coordinatorLayout, @NonNull() V child, @NonNull() View target, int dx, int dy, @NonNull() Array<int> consumed, int type)
Called when a nested scroll in progress is about to update, before the target has consumedany of the scrolled distance. void
onStopNestedScroll(@NonNull() CoordinatorLayout coordinatorLayout, @NonNull() V child, @NonNull() View target, int type)
Called when a nested scroll has ended. -
Methods inherited from class com.tds.common.widgets.behavior.BottomSheetBehavior
addBottomSheetCallback, from, getExpandedOffset, getHalfExpandedRatio, getPeekHeight, getSaveFlags, getSkipCollapsed, getState, isDraggable, isFitToContents, isGestureInsetBottomIgnored, isHideable, onAttachedToLayoutParams, onDetachedFromLayoutParams, onLayoutChild, onNestedPreFling, onNestedScroll, onRestoreInstanceState, onSaveInstanceState, removeBottomSheetCallback, setBottomSheetCallback, setDraggable, setExpandedOffset, setFitToContents, setGestureInsetBottomIgnored, setHalfExpandedRatio, setHideable, setPeekHeight, setPeekHeight, setSaveFlags, setSkipCollapsed, setState
-
Methods inherited from class tds.androidx.coordinatorlayout.widget.CoordinatorLayout.Behavior
blocksInteractionBelow, getInsetDodgeRect, getScrimColor, getScrimOpacity, getTag, layoutDependsOn, onApplyWindowInsets, onAttachedToLayoutParams, onDependentViewChanged, onDependentViewRemoved, onInterceptTouchEvent, onLayoutChild, onMeasureChild, onNestedFling, onNestedPreFling, onNestedPreScroll, onNestedPreScroll, onNestedScroll, onNestedScroll, onNestedScroll, onNestedScrollAccepted, onNestedScrollAccepted, onRequestChildRectangleOnScreen, onRestoreInstanceState, onStartNestedScroll, onStartNestedScroll, onStopNestedScroll, onStopNestedScroll, onTouchEvent, setTag
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
RightSheetBehavior
RightSheetBehavior(Context context, AttributeSet attrs)
-
-
Method Detail
-
onLayoutChild
boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection)
Called when the parent CoordinatorLayout is about the lay out the given child view.
This method can be used to perform custom or modified layout of a child viewin place of the default child layout behavior. The Behavior's implementation can delegate tothe standard CoordinatorLayout measurement behavior by calling parent.onLayoutChild.
If a Behavior implements onDependentViewChanged to change the position of aview in response to a dependent view changing, it should also implement
onLayoutChild
in such a way that respects those dependent views.onLayoutChild
will always be called for a dependent viewafter its dependency has been laid out.- Parameters:
parent
- the parent CoordinatorLayoutchild
- child view to lay outlayoutDirection
- the resolved layout direction for the CoordinatorLayout, such as LAYOUT_DIRECTION_LTR or LAYOUT_DIRECTION_RTL.
-
onInterceptTouchEvent
boolean onInterceptTouchEvent(@NonNull() CoordinatorLayout parent, @NonNull() V child, @NonNull() MotionEvent event)
Respond to CoordinatorLayout touch events before they are dispatched to child views.
Behaviors can use this to monitor inbound touch events until one decides tointercept the rest of the event stream to take an action on its associated child view. Thismethod will return false until it detects the proper intercept conditions, then return trueonce those conditions have occurred.
Once a Behavior intercepts touch events, the rest of the event stream willbe sent to the onTouchEvent method.
This method will be called regardless of the visibility of the associated childof the behavior. If you only wish to handle touch events when the child is visible, youshould add a check to isShown on the given child.
The default implementation of this method always returns false.
- Parameters:
parent
- the parent view currently receiving this touch eventchild
- the child view associated with this Behavior
-
onTouchEvent
boolean onTouchEvent(@NonNull() CoordinatorLayout parent, @NonNull() V child, @NonNull() MotionEvent event)
Respond to CoordinatorLayout touch events after this Behavior has started intercepting them.
Behaviors may intercept touch events in order to help the CoordinatorLayoutmanipulate its child views. For example, a Behavior may allow a user to drag a UI pane openor closed. This method should perform actual mutations of view layout state.
This method will be called regardless of the visibility of the associated childof the behavior. If you only wish to handle touch events when the child is visible, youshould add a check to isShown on the given child.
- Parameters:
parent
- the parent view currently receiving this touch eventchild
- the child view associated with this Behavior
-
onStartNestedScroll
boolean onStartNestedScroll(@NonNull() CoordinatorLayout coordinatorLayout, @NonNull() V child, @NonNull() View directTargetChild, @NonNull() View target, int axes, int type)
Called when a descendant of the CoordinatorLayout attempts to initiate a nested scroll.
Any Behavior associated with any direct child of the CoordinatorLayout may respondto this event and return true to indicate that the CoordinatorLayout should act as a nestedscrolling parent for this scroll. Only Behaviors that return true from this method willreceive subsequent nested scroll events.
- Parameters:
coordinatorLayout
- the CoordinatorLayout parent of the view this Behavior is associatedwithchild
- the child view of the CoordinatorLayout this Behavior is associated withdirectTargetChild
- the child view of the CoordinatorLayout that either is or containsthe target of the nested scroll operationtarget
- the descendant view of the CoordinatorLayout initiating the nested scrollaxes
- the axes that this nested scroll applies to.type
- the type of input which cause this scroll event
-
onNestedPreScroll
void onNestedPreScroll(@NonNull() CoordinatorLayout coordinatorLayout, @NonNull() V child, @NonNull() View target, int dx, int dy, @NonNull() Array<int> consumed, int type)
Called when a nested scroll in progress is about to update, before the target has consumedany of the scrolled distance.
Any Behavior associated with the direct child of the CoordinatorLayout may electto accept the nested scroll as part of onStartNestedScroll. Each Behavior thatreturned true will receive subsequent nested scroll events for that nested scroll.
onNestedPreScroll
is called each time the nested scroll is updatedby the nested scrolling child, before the nested scrolling child has consumed the scrolldistance itself. Each Behavior responding to the nested scroll will receive the samevalues. The CoordinatorLayout will report as consumed the maximum number of pixels ineither direction that any Behavior responding to the nested scroll reported as consumed.- Parameters:
coordinatorLayout
- the CoordinatorLayout parent of the view this Behavior is associatedwithchild
- the child view of the CoordinatorLayout this Behavior is associated withtarget
- the descendant view of the CoordinatorLayout performing the nested scrolldx
- the raw horizontal number of pixels that the user attempted to scrolldy
- the raw vertical number of pixels that the user attempted to scrollconsumed
- out parameter.type
- the type of input which cause this scroll event
-
onStopNestedScroll
void onStopNestedScroll(@NonNull() CoordinatorLayout coordinatorLayout, @NonNull() V child, @NonNull() View target, int type)
Called when a nested scroll has ended.
Any Behavior associated with any direct child of the CoordinatorLayout may electto accept the nested scroll as part of onStartNestedScroll. Each Behavior thatreturned true will receive subsequent nested scroll events for that nested scroll.
onStopNestedScroll
marks the end of a single nested scroll eventsequence. This is a good place to clean up any state related to the nested scroll.- Parameters:
coordinatorLayout
- the CoordinatorLayout parent of the view this Behavior is associatedwithchild
- the child view of the CoordinatorLayout this Behavior is associated withtarget
- the descendant view of the CoordinatorLayout that initiated the nested scrolltype
- the type of input which cause this scroll event
-
-
-
-