public static class RecyclerViewSwipeDecorator.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder(android.content.Context context,
android.graphics.Canvas canvas,
RecyclerView recyclerView,
RecyclerView.ViewHolder viewHolder,
float dX,
float dY,
int actionState,
boolean isCurrentlyActive)
Create a builder for a RecyclerViewsSwipeDecorator
|
Modifier and Type | Method and Description |
---|---|
RecyclerViewSwipeDecorator.Builder |
addActionIcon(int drawableId)
Add an action icon to both swiping directions
|
RecyclerViewSwipeDecorator.Builder |
addBackgroundColor(int color)
Add a background color to both swiping directions
|
RecyclerViewSwipeDecorator.Builder |
addSwipeLeftActionIcon(int drawableId)
Add an action icon while swiping left
|
RecyclerViewSwipeDecorator.Builder |
addSwipeLeftBackgroundColor(int color)
Adds a background color while swiping left
|
RecyclerViewSwipeDecorator.Builder |
addSwipeLeftLabel(java.lang.String label)
Add a label to be shown while swiping left
|
RecyclerViewSwipeDecorator.Builder |
addSwipeRightActionIcon(int drawableId)
Add an action icon while swiping right
|
RecyclerViewSwipeDecorator.Builder |
addSwipeRightBackgroundColor(int color)
Add a background color while swiping right
|
RecyclerViewSwipeDecorator.Builder |
addSwipeRightLabel(java.lang.String label)
Add a label to be shown while swiping right
|
RecyclerViewSwipeDecorator |
create()
Create a RecyclerViewSwipeDecorator
|
RecyclerViewSwipeDecorator.Builder |
setActionIconTint(int color)
Set the tint color for either (left/right) action icons
|
RecyclerViewSwipeDecorator.Builder |
setIconHorizontalMargin(int pixels)
Deprecated.
in RecyclerViewSwipeDecorator 1.2, use
setIconHorizontalMargin(int, int) instead. |
RecyclerViewSwipeDecorator.Builder |
setIconHorizontalMargin(int unit,
int iconHorizontalMargin)
Set the horizontal margin of the icon in the given unit (default is 16dp)
|
RecyclerViewSwipeDecorator.Builder |
setSwipeLeftActionIconTint(int color)
Set the tint color for action icon shown while swiping left
|
RecyclerViewSwipeDecorator.Builder |
setSwipeLeftLabelColor(int color)
Set the color of the label to be shown while swiping left
|
RecyclerViewSwipeDecorator.Builder |
setSwipeLeftLabelTextSize(int unit,
float size)
Set the size of the label to be shown while swiping left
|
RecyclerViewSwipeDecorator.Builder |
setSwipeLeftLabelTypeface(android.graphics.Typeface typeface)
Set the Typeface of the label to be shown while swiping left
|
RecyclerViewSwipeDecorator.Builder |
setSwipeRightActionIconTint(int color)
Set the tint color for action icon shown while swiping right
|
RecyclerViewSwipeDecorator.Builder |
setSwipeRightLabelColor(int color)
Set the color of the label to be shown while swiping right
|
RecyclerViewSwipeDecorator.Builder |
setSwipeRightLabelTextSize(int unit,
float size)
Set the size of the label to be shown while swiping right
|
RecyclerViewSwipeDecorator.Builder |
setSwipeRightLabelTypeface(android.graphics.Typeface typeface)
Set the Typeface of the label to be shown while swiping right
|
public Builder(android.content.Context context, android.graphics.Canvas canvas, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive)
context
- A valid Context object for the RecyclerViewcanvas
- The canvas which RecyclerView is drawing its childrenrecyclerView
- The RecyclerView to which ItemTouchHelper is attached toviewHolder
- The ViewHolder which is being interacted by the User or it was interacted and simply animating to its original positiondX
- The amount of horizontal displacement caused by user's actiondY
- The amount of vertical displacement caused by user's actionactionState
- The type of interaction on the View. Is either ACTION_STATE_DRAG or ACTION_STATE_SWIPE.isCurrentlyActive
- True if this view is currently being controlled by the user or false it is simply animating back to its original statepublic RecyclerViewSwipeDecorator.Builder addBackgroundColor(int color)
color
- A single color value in the form 0xAARRGGBBpublic RecyclerViewSwipeDecorator.Builder addActionIcon(int drawableId)
drawableId
- The resource id of the icon to be setpublic RecyclerViewSwipeDecorator.Builder setActionIconTint(int color)
color
- a color in ARGB format (e.g. 0xFF0000FF for blue)public RecyclerViewSwipeDecorator.Builder addSwipeRightBackgroundColor(int color)
color
- A single color value in the form 0xAARRGGBBpublic RecyclerViewSwipeDecorator.Builder addSwipeRightActionIcon(int drawableId)
drawableId
- The resource id of the icon to be setpublic RecyclerViewSwipeDecorator.Builder setSwipeRightActionIconTint(int color)
color
- a color in ARGB format (e.g. 0xFF0000FF for blue)public RecyclerViewSwipeDecorator.Builder addSwipeRightLabel(java.lang.String label)
label
- The string to be shown as labelpublic RecyclerViewSwipeDecorator.Builder setSwipeRightLabelColor(int color)
color
- the color to be setpublic RecyclerViewSwipeDecorator.Builder setSwipeRightLabelTextSize(int unit, float size)
unit
- the unit to convert fromsize
- the size to be setpublic RecyclerViewSwipeDecorator.Builder setSwipeRightLabelTypeface(android.graphics.Typeface typeface)
typeface
- the Typeface to be setpublic RecyclerViewSwipeDecorator.Builder addSwipeLeftBackgroundColor(int color)
color
- A single color value in the form 0xAARRGGBBpublic RecyclerViewSwipeDecorator.Builder addSwipeLeftActionIcon(int drawableId)
drawableId
- The resource id of the icon to be setpublic RecyclerViewSwipeDecorator.Builder setSwipeLeftActionIconTint(int color)
color
- a color in ARGB format (e.g. 0xFF0000FF for blue)public RecyclerViewSwipeDecorator.Builder addSwipeLeftLabel(java.lang.String label)
label
- The string to be shown as labelpublic RecyclerViewSwipeDecorator.Builder setSwipeLeftLabelColor(int color)
color
- the color to be setpublic RecyclerViewSwipeDecorator.Builder setSwipeLeftLabelTextSize(int unit, float size)
unit
- the unit to convert fromsize
- the size to be setpublic RecyclerViewSwipeDecorator.Builder setSwipeLeftLabelTypeface(android.graphics.Typeface typeface)
typeface
- the Typeface to be set@Deprecated public RecyclerViewSwipeDecorator.Builder setIconHorizontalMargin(int pixels)
setIconHorizontalMargin(int, int)
instead.pixels
- margin in pixelspublic RecyclerViewSwipeDecorator.Builder setIconHorizontalMargin(int unit, int iconHorizontalMargin)
unit
- TypedValueiconHorizontalMargin
- the margin in the given unitpublic RecyclerViewSwipeDecorator create()