DismissibleFrameLayout
@UiThread
class DismissibleFrameLayout : FrameLayout
| kotlin.Any | ||||
| ↳ | android.view.View | |||
| ↳ | android.view.ViewGroup | |||
| ↳ | android.widget.FrameLayout | |||
| ↳ | androidx.wear.widget.DismissibleFrameLayout |
SwipeDismissFrameLayout |
A layout enabling left-to-right swipe-to-dismiss, intended for use within an activity. |
Special FrameLayout that is dismissible by the Back button press, and by left to right swipe when the SwipeToDismiss is been enabled on the device config or themes.
Summary
Nested types |
|---|
@UiThreadImplement this callback to act on particular stage of the dismissal. |
Public constructors |
|---|
DismissibleFrameLayout(context: Context)Simple constructor to use when creating a view from code. |
DismissibleFrameLayout(context: Context, attrs: AttributeSet?)Constructor that is called when inflating a view from XML. |
DismissibleFrameLayout(Perform inflation from XML and apply a class-specific base style from a theme attribute. |
DismissibleFrameLayout(Perform inflation from XML and apply a class-specific base style from a theme attribute. |
Public functions |
|
|---|---|
Boolean |
canScrollHorizontally(direction: Int) |
Boolean |
Returns true if the frame layout would be dismissed with back button click |
Boolean |
Returns true if the frame layout can be dismissed by swipe gestures. |
Boolean |
|
Boolean |
onTouchEvent(ev: MotionEvent) |
Unit |
Registers a callback for dismissal. |
Unit |
requestDisallowInterceptTouchEvent(disallowIntercept: Boolean)Following methods overriding are only required with swipe-to-dismiss to handle touch event for detect swipe gesture. |
Unit |
setBackButtonDismissible(backButtonDismissible: Boolean)Sets the frame layout to be back button dismissible or not. |
Unit |
setSwipeDismissible(swipeDismissible: Boolean)Sets the frame layout to be swipe dismissible or not. |
Unit |
Removes a callback that was added with |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Public constructors
DismissibleFrameLayout
DismissibleFrameLayout(context: Context)
Simple constructor to use when creating a view from code.
DismissibleFrameLayout
DismissibleFrameLayout(context: Context, attrs: AttributeSet?)
Constructor that is called when inflating a view from XML. This is called when a view is being constructed from an XML file, supplying attributes that were specified in the XML file. This version uses a default style of 0, so the only attribute values applied are those in the Context's Theme and the given AttributeSet.
The method onFinishInflate() will be called after all children have been added.
| Parameters | |
|---|---|
context: Context |
The |
attrs: AttributeSet? |
The attributes of the XML tag that is inflating the view. |
DismissibleFrameLayout
DismissibleFrameLayout(
context: Context,
attrs: AttributeSet?,
defStyle: Int
)
Perform inflation from XML and apply a class-specific base style from a theme attribute. This constructor allows subclasses to use their own base style when they are inflating.
| Parameters | |
|---|---|
context: Context |
The |
attrs: AttributeSet? |
The attributes of the XML tag that is inflating the view. |
defStyle: Int |
An attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults. |
DismissibleFrameLayout
DismissibleFrameLayout(
context: Context,
attrs: AttributeSet?,
defStyle: Int,
defStyleRes: Int
)
Perform inflation from XML and apply a class-specific base style from a theme attribute. This constructor allows subclasses to use their own base style when they are inflating.
| Parameters | |
|---|---|
context: Context |
The |
attrs: AttributeSet? |
The attributes of the XML tag that is inflating the view. |
defStyle: Int |
An attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults. |
defStyleRes: Int |
It allows a style resource to be specified when creating the view. |
Public functions
isDismissableByBackButton
fun isDismissableByBackButton(): Boolean
Returns true if the frame layout would be dismissed with back button click
isDismissableBySwipe
fun isDismissableBySwipe(): Boolean
Returns true if the frame layout can be dismissed by swipe gestures.
registerCallback
@UiThread
fun registerCallback(callback: DismissibleFrameLayout.Callback): Unit
Registers a callback for dismissal.
requestDisallowInterceptTouchEvent
fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean): Unit
Following methods overriding are only required with swipe-to-dismiss to handle touch event for detect swipe gesture.
setBackButtonDismissible
fun setBackButtonDismissible(backButtonDismissible: Boolean): Unit
Sets the frame layout to be back button dismissible or not.
| Parameters | |
|---|---|
backButtonDismissible: Boolean |
boolean value to enable/disable the back button dismiss |
setSwipeDismissible
fun setSwipeDismissible(swipeDismissible: Boolean): Unit
Sets the frame layout to be swipe dismissible or not.
| Parameters | |
|---|---|
swipeDismissible: Boolean |
whether the layout should react to the swipe gesture |
unregisterCallback
@UiThread
fun unregisterCallback(callback: DismissibleFrameLayout.Callback): Unit
Removes a callback that was added with registerCallback.
Protected functions
performDismissCanceledCallbacks
protected fun performDismissCanceledCallbacks(): Unit
performDismissFinishedCallbacks
protected fun performDismissFinishedCallbacks(): Unit