SwipeDismissFrameLayout

public class SwipeDismissFrameLayout extends DismissibleFrameLayout


A layout enabling left-to-right swipe-to-dismiss, intended for use within an activity.

At least one listener must be added to act on a dismissal action. A listener will typically remove a containing view or fragment from the current activity.

To suppress a swipe-dismiss gesture, at least one contained view must be scrollable, indicating that it would like to consume any horizontal touch gestures in that direction. In this case this view will only allow swipe-to-dismiss on the very edge of the left-hand-side of the screen. If you wish to entirely disable the swipe-to-dismiss gesture, setSwipeable can be used for more direct control over the feature.

Summary

Nested types

SwipeDismissFrameLayout.Callback

Implement this callback to act on particular stages of the dismissal.

Constants

static final @NonNull float

Public constructors

Simple constructor to use when creating a view from code.

SwipeDismissFrameLayout(
    @NonNull Context context,
    @NonNull AttributeSet attrs
)

Constructor that is called when inflating a view from XML.

SwipeDismissFrameLayout(
    @NonNull Context context,
    @NonNull AttributeSet attrs,
    @NonNull int defStyle
)

Perform inflation from XML and apply a class-specific base style from a theme attribute.

SwipeDismissFrameLayout(
    @NonNull Context context,
    @NonNull AttributeSet attrs,
    @NonNull int defStyle,
    @NonNull int defStyleRes
)

Perform inflation from XML and apply a class-specific base style from a theme attribute.

Public methods

@NonNull void

Adds a callback for dismissal.

@NonNull float

Gets the minimum ratio of the screen after which the swipe gesture is treated as swipe-to-dismiss.

@NonNull boolean

Returns true if the frame layout can be dismissed by swipe gestures.

@NonNull void

Removes a callback that was added with addCallback.

@NonNull void

Sets the minimum ratio of the screen after which the swipe gesture is treated as swipe-to-dismiss.

@NonNull void
setSwipeable(@NonNull boolean swipeable)

Set the layout to be dismissible by swipe or not.

Inherited methods

From class DismissibleFrameLayout
@Override @NonNull boolean
@NonNull boolean

Returns true if the frame layout would be dismissed with back button click

@NonNull boolean

Returns true if the frame layout can be dismissed by swipe gestures.

@Override @NonNull boolean
@Override @NonNull boolean
final @UiThread @NonNull void

Registers a callback for dismissal.

@Override @NonNull void
requestDisallowInterceptTouchEvent(@NonNull boolean disallowIntercept)

Following methods overriding are only required with swipe-to-dismiss to handle touch event for detect swipe gesture.

final @NonNull void
setBackButtonDismissible(@NonNull boolean backButtonDismissible)

Sets the frame layout to be back button dismissible or not.

final @NonNull void
setSwipeDismissible(@NonNull boolean swipeDismissible)

Sets the frame layout to be swipe dismissible or not.

final @UiThread @NonNull void

Removes a callback that was added with registerCallback.

From class FrameLayout
From class View
@NonNull void
@NonNull void
@NonNull void
@NonNull ViewPropertyAnimator
@NonNull void
@NonNull void
@NonNull void
@NonNull void

This method is deprecated.

@NonNull void
@NonNull boolean
@NonNull boolean
@NonNull boolean
@NonNull boolean
@NonNull boolean
@NonNull boolean
canScrollVertically(@NonNull int direction)
final @NonNull void
@NonNull void
final @NonNull void
@NonNull boolean
@NonNull void
@NonNull void
static @NonNull int
combineMeasuredStates(@NonNull int curState, @NonNull int newState)
@NonNull void
@NonNull WindowInsets
computeSystemWindowInsets(
    @NonNull WindowInsets in,
    @NonNull Rect outLocalInsets
)
@NonNull AccessibilityNodeInfo
@NonNull void
@NonNull void

This method is deprecated.

@NonNull boolean
@NonNull boolean
dispatchNestedFling(
    @NonNull float velocityX,
    @NonNull float velocityY,
    @NonNull boolean consumed
)
@NonNull boolean
dispatchNestedPreFling(@NonNull float velocityX, @NonNull float velocityY)
@NonNull boolean
dispatchNestedPrePerformAccessibilityAction(
    @NonNull int action,
    @NonNull Bundle arguments
)
@NonNull boolean
dispatchNestedPreScroll(
    @NonNull int dx,
    @NonNull int dy,
    @NonNull Array<@NonNull int> consumed,
    @NonNull Array<@NonNull int> offsetInWindow
)
@NonNull boolean
dispatchNestedScroll(
    @NonNull int dxConsumed,
    @NonNull int dyConsumed,
    @NonNull int dxUnconsumed,
    @NonNull int dyUnconsumed,
    @NonNull Array<@NonNull int> offsetInWindow
)
@NonNull boolean
@NonNull void
draw(@NonNull Canvas canvas)
@NonNull void
drawableHotspotChanged(@NonNull float x, @NonNull float y)
final @NonNull T
<T extends View> findViewById(@NonNull int id)
final @NonNull T
<T extends View> findViewWithTag(@NonNull Object tag)
@NonNull void
forceHasOverlappingRendering(@NonNull boolean hasOverlappingRendering)
@NonNull void
@NonNull void
generateDisplayHash(
    @NonNull String hashAlgorithm,
    @NonNull Rect bounds,
    @NonNull Executor executor,
    @NonNull DisplayHashResultCallback callback
)
static @NonNull int
@NonNull View.AccessibilityDelegate
@NonNull int
@NonNull AccessibilityNodeProvider
@NonNull CharSequence
@NonNull int