public static class BottomSheet.Builder
extends java.lang.Object
| Constructor and Description |
|---|
Builder(android.content.Context context)
Creates a new builder, which allows to create bottom sheets, which are designed according
to Android 5's Material Design guidelines even on pre-Lollipop devices.
|
Builder(android.content.Context context,
int themeResourceId)
Creates a new builder, which allows to create bottom sheets, which are designed according
to Android 5's Material Design guidelines even on pre-Lollipop devices.
|
| Modifier and Type | Method and Description |
|---|---|
BottomSheet.Builder |
addDivider()
Adds a new divider to the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
addDivider(java.lang.CharSequence title)
Adds a new divider to the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
addDivider(int titleId)
Adds a new divider to the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
addItem(int id,
java.lang.CharSequence title)
Adds a new item to the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
addItem(int id,
java.lang.CharSequence title,
android.graphics.drawable.Drawable icon)
Adds a new item to the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
addItem(int id,
int titleId)
Adds a new item to the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
addItem(int id,
int titleId,
int iconId)
Adds a new item to the bottom sheet, which is created by the builder.
|
BottomSheet |
create()
Creates a bottom sheet with the arguments, which have been supplied to the builder.
|
android.content.Context |
getContext()
Returns the context, which is used by the builder.
|
BottomSheet |
maximize()
Creates a bottom sheet with the arguments, which have been supplied to the builder and
immediately maximizes it.
|
BottomSheet.Builder |
setBackground(android.graphics.Bitmap background)
Sets the background of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setBackground(int resourceId)
Sets the background of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setBackgroundColor(int color)
Sets the background color of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setCancelable(boolean cancelable)
Sets, whether the bottom sheet, which is created by the builder, should be cancelable, or
not.
|
BottomSheet.Builder |
setCustomTitle(int resourceId)
Sets the custom view, which should be used to show the title of the bottom sheet, which
is created by the builder.
|
BottomSheet.Builder |
setCustomTitle(android.view.View view)
Sets the custom view, which should be used to show the title of the bottom sheet, which
is created by the builder.
|
BottomSheet.Builder |
setDimAmount(float dimAmount)
Sets the dim amount, which should be used to darken the area outside the bottom sheet,
which is created by the builder.
|
BottomSheet.Builder |
setDividerColor(int color)
Sets the color of the dividers of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setDragSensitivity(float dragSensitivity)
Sets the sensitivity, which specifies the distance after which dragging has an effect on
the bottom sheet, in relation to an internal value range.
|
BottomSheet.Builder |
setIcon(android.graphics.Bitmap icon)
Sets the icon of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setIcon(int resourceId)
Sets the icon of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setIconAttribute(int attributeId)
Set the icon of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setIntent(android.app.Activity activity,
android.content.Intent intent)
Adds the apps, which are able to handle a specific intent, as items to the bottom sheet,
which is created by the builder.
|
BottomSheet.Builder |
setItemColor(int color)
Sets the color of the items of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setItemEnabled(int index,
boolean enabled)
Sets, whether the item at a specific index should be enabled, or not.
|
BottomSheet.Builder |
setOnCancelListener(android.content.DialogInterface.OnCancelListener listener)
Sets the listener, which should be notified, when the bottom sheet, which is created by
the builder, is canceled.
|
BottomSheet.Builder |
setOnDismissListener(android.content.DialogInterface.OnDismissListener listener)
Sets the listener, which should be notified, when the bottom sheet, which is created by
the builder, is dismissed for any reason.
|
BottomSheet.Builder |
setOnItemClickListener(android.widget.AdapterView.OnItemClickListener listener)
Sets the listener, which should be notified, when an item of the bottom sheet has been
clicked.
|
BottomSheet.Builder |
setOnItemLongClickListener(android.widget.AdapterView.OnItemLongClickListener listener)
Sets the listener, which should be notified, when an item of the bottom sheet has been
long-clicked.
|
BottomSheet.Builder |
setOnKeyListener(android.content.DialogInterface.OnKeyListener listener)
Sets the listener, which should be notified, if a key is dispatched to the bottom sheet,
which is created by the builder.
|
BottomSheet.Builder |
setOnMaximizeListener(OnMaximizeListener listener)
Sets the listener, which should be notified, when the bottom sheet, which is created by
the builder, has been maximized.
|
BottomSheet.Builder |
setStyle(BottomSheet.Style style)
Sets the style of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setTitle(java.lang.CharSequence title)
Sets the title of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setTitle(int resourceId)
Sets the title of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setTitleColor(int color)
Sets the color of the title of the bottom sheet, which is created by the builder.
|
BottomSheet.Builder |
setView(int resourceId)
Sets the custom view, which should be shown by the bottom sheet, which is created by the
builder.
|
BottomSheet.Builder |
setView(android.view.View view)
Sets the custom view, which should be shown by the bottom sheet, which is created by the
builder.
|
BottomSheet.Builder |
setWidth(int width)
Sets the width of the bottom sheet, which is created by the builder.
|
BottomSheet |
show()
Creates a bottom sheet with the arguments, which have been supplied to the builder and
immediately displays it.
|
public Builder(android.content.Context context)
context - The context, which should be used by the builder, as an instance of the class
Context. The context may not be nullpublic Builder(android.content.Context context,
int themeResourceId)
context - The context, which should be used by the builder, as an instance of the class
Context. The context may not be nullthemeResourceId - The resource id of the theme, which should be used by the bottom sheet, as an
Integer value. The resource id must correspond to a valid themepublic final android.content.Context getContext()
Contextpublic final BottomSheet.Builder setCancelable(boolean cancelable)
cancelable - True, if the bottom sheet, which is created by the builder, should be cancelable,
false otherwiseBottomSheet.Builderpublic final BottomSheet.Builder setStyle(BottomSheet.Style style)
style - The style, which should be set, as a value of the enum BottomSheet.Style. The style
may either be LIST, LIST_COLUMNS or GRIDBottomSheet.Builderpublic final BottomSheet.Builder setOnItemClickListener(android.widget.AdapterView.OnItemClickListener listener)
listener - The listener, which should be set, as an instance of the type AdapterView.OnItemClickListener or null, if no listener should be notifiedBottomSheet.Builderpublic final BottomSheet.Builder setOnItemLongClickListener(android.widget.AdapterView.OnItemLongClickListener listener)
listener - The listener, which should be set, as an instance of the type AdapterView.OnItemLongClickListener or null, if no listener should be notifiedBottomSheet.Builderpublic final BottomSheet.Builder setOnMaximizeListener(OnMaximizeListener listener)
listener - The listener, which should be set, as an instance of the type OnMaximizeListener or null, if no listener should be notifiedBottomSheet.Builderpublic BottomSheet.Builder setOnCancelListener(android.content.DialogInterface.OnCancelListener listener)
setOnDismissListener.listener - The listener, which should be set, as an instance of the type OnCancelListener, or null, if no listener should be setBottomSheet.BuildersetOnDismissListener(android.content.DialogInterface.OnDismissListener)public final BottomSheet.Builder setOnDismissListener(android.content.DialogInterface.OnDismissListener listener)
listener - The listener, which should be set, as an instance of the type OnDismissListener, or null, if no listener should be setBottomSheet.Builderpublic final BottomSheet.Builder setOnKeyListener(android.content.DialogInterface.OnKeyListener listener)
listener - The listener, which should be set, as an instance of the type OnKeyListener, or null, if no listener should be setBottomSheet.Builderpublic final BottomSheet.Builder setTitleColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom
color should be setBottomSheet.Builderpublic final BottomSheet.Builder setItemColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom
color should be setBottomSheet.Builderpublic final BottomSheet.Builder setDividerColor(int color)
color - The color, which should be set, as an Integer value or -1, if no custom
color should be setBottomSheet.Builderpublic final BottomSheet.Builder setBackground(android.graphics.Bitmap background)
background - The background, which should be set, as an instance of the class Bitmap
or null, if no custom background should be setBottomSheet.Builderpublic final BottomSheet.Builder setBackground(int resourceId)
resourceId - The resource id of the background, which should be set, as an Integer
value. The resource id must correspond to a valid drawable resourceBottomSheet.Builderpublic final BottomSheet.Builder setBackgroundColor(int color)
color - The background color, which should be set, as an Integer value or -1, if
no custom background color should be setBottomSheet.Builderpublic final BottomSheet.Builder setTitle(java.lang.CharSequence title)
title - The title, which should be set, as an instance of the type CharSequence
or null, if no title should be shownBottomSheet.Builderpublic final BottomSheet.Builder setTitle(int resourceId)
resourceId - The resource id of the title, which should be set, as an Integer value.
The resource id must correspond to a valid string resourceBottomSheet.Builderpublic final BottomSheet.Builder setIcon(android.graphics.Bitmap icon)
icon - The icon, which should be set, as an instance of the class Bitmap or
null, if no icon should be shownBottomSheet.Builderpublic final BottomSheet.Builder setIcon(int resourceId)
resourceId - The resource id of the icon, which should be set, as an Integer value.
The resource id must correspond to a valid drawable resourceBottomSheet.Builderpublic final BottomSheet.Builder setIconAttribute(int attributeId)
attributeId - The id of the theme attribute, which supplies the icon, which should be set, as
an Integer value. The id must point to a valid drawable resourceBottomSheet.Builderpublic final BottomSheet.Builder setView(android.view.View view)
view - The view, which should be set, as an instance of the class View or null,
if no custom view should be shownBottomSheet.Builderpublic final BottomSheet.Builder setView(int resourceId)
resourceId - The resource id of the view, which should be set, as an Integer value.
The resource id must correspond to a valid layout resourceBottomSheet.Builderpublic final BottomSheet.Builder setCustomTitle(android.view.View view)
view - The view, which should be set, as an instance of the class View or null,
if no custom view should be used to show the titleBottomSheet.Builderpublic final BottomSheet.Builder setCustomTitle(int resourceId)
resourceId - The resource id of the view, which should be set, as an Integer value.
The resource id must correspond to a valid layout resourceBottomSheet.Builderpublic final BottomSheet.Builder setDragSensitivity(float dragSensitivity)
dragSensitivity - The drag sensitivity, which should be set, as a Float value. The drag
sensitivity must be at lest 0 and at maximum 1BottomSheet.Builderpublic final BottomSheet.Builder setDimAmount(float dimAmount)
dimAmount - The dim amount, which should be set, as a Float value. The dim amount
must be at least 0 (fully transparent) and at maximum 1 (fully opaque)BottomSheet.Builderpublic final BottomSheet.Builder setWidth(int width)
width - The width, which should be set, in pixels as an Integer value. The width
must be at least 1BottomSheet.Builderpublic final BottomSheet.Builder addItem(int id, java.lang.CharSequence title)
id - The id of the item, which should be added, as an Integer value. The id
must be at least 0title - The title of the item, which should be added, as an instance of the type CharSequence. The title may neither be null, nor emptyBottomSheet.Builderpublic final BottomSheet.Builder addItem(int id, java.lang.CharSequence title, android.graphics.drawable.Drawable icon)
id - The id of the item, which should be added, as an Integer value. The id
must be at least 0title - The title of the item, which should be added, as an instance of the type CharSequence. The title may neither be null, nor emptyicon - The icon of the item, which should be added, as an instance of the class Drawable, or null, if no item should be usedBottomSheet.Builderpublic final BottomSheet.Builder addItem(int id, int titleId)
id - The id of the item, which should be added, as an Integer value. The id
must be at least 0titleId - The resource id of the title of the item, which should be added, as an Integer value. The resource id must correspond to a valid string resourceBottomSheet.Builderpublic final BottomSheet.Builder addItem(int id, int titleId, int iconId)
id - The id of the item, which should be added, as an Integer value. The id
must be at least 0titleId - The resource id of the title of the item, which should be added, as an Integer value. The resource id must correspond to a valid string resourceiconId - The resource id of the icon of the item, which should be added, as an Integer value. The resource id must correspond to a valid drawable resourceBottomSheet.Builderpublic final BottomSheet.Builder addDivider()
BottomSheet.Builderpublic final BottomSheet.Builder addDivider(java.lang.CharSequence title)
title - The title of the divider, which should be added, as an instance of the type
CharSequence, or null, if no title should be usedpublic final BottomSheet.Builder addDivider(int titleId)
titleId - The resource id of the title, which should be added, as an Integer value.
The resource id must correspond to a valid string resourceBottomSheet.Builderpublic final BottomSheet.Builder setItemEnabled(int index, boolean enabled)
index - The index of the item as an Integer valueenabled - True, if the item should be enabled, false otherwiseBottomSheet.Builderpublic final BottomSheet.Builder setIntent(android.app.Activity activity, android.content.Intent intent)
activity - The activity, the bottom sheet, which is created by the builder, belongs to, as
an instance of the class Activity. The activity may not be nullintent - The intent as an instance of the class Intent. The intent may not be
nullBottomSheet.Builderpublic final BottomSheet create()
BottomSheetpublic final BottomSheet show()
BottomSheetpublic final BottomSheet maximize()
BottomSheet