public static class Banner.Builder
extends java.lang.Object
| Constructor and Description |
|---|
Builder(android.content.Context context)
Creates a builder for a banner that uses the default banner style (either specified in
the app theme or in this library).
|
Builder(android.content.Context context,
int themeResId)
Creates a builder for a banner that uses an explicit style resource.
|
| Modifier and Type | Method and Description |
|---|---|
Banner |
create()
Creates a
Banner with the arguments supplied to this builder. |
Banner.Builder |
setIcon(android.graphics.drawable.Drawable icon)
Sets the resource id of the
Drawable to be used in the banner. |
Banner.Builder |
setIcon(int iconId)
Sets the
Drawable to be used in the banner. |
Banner.Builder |
setId(int id)
Sets the identifier for this banner.
|
Banner.Builder |
setLeftButton(int textId,
BannerInterface.OnClickListener listener)
Sets a listener to be invoked when the left button of the banner is pressed.
|
Banner.Builder |
setLeftButton(java.lang.String text,
BannerInterface.OnClickListener listener)
Sets a listener to be invoked when the left button of the banner is pressed.
|
Banner.Builder |
setMessage(int textId)
Sets the message to display in the banner using the given resource id.
|
Banner.Builder |
setMessage(java.lang.String text)
Sets the message to display in the banner.
|
Banner.Builder |
setOnDismissListener(BannerInterface.OnDismissListener listener)
Sets a listener to be invoked when the banner is dismissed.
|
Banner.Builder |
setOnShowListener(BannerInterface.OnShowListener listener)
Sets a listener to be invoked when the banner is shown.
|
Banner.Builder |
setParent(android.view.ViewGroup parent)
Sets the
ViewGroup that will be a parent view for this banner. |
Banner.Builder |
setParent(android.view.ViewGroup parent,
int index)
Sets the
ViewGroup that will be a parent view for this banner and specify
banner's index in the parent view. |
Banner.Builder |
setParent(android.view.ViewGroup parent,
int index,
android.view.ViewGroup.LayoutParams params)
Sets the
ViewGroup that will be a parent view for this banner and specify
banner's index in the parent view. |
Banner.Builder |
setRightButton(int textId,
BannerInterface.OnClickListener listener)
Sets a listener to be invoked when the right button of the banner is pressed.
|
Banner.Builder |
setRightButton(java.lang.String text,
BannerInterface.OnClickListener listener)
Sets a listener to be invoked when the right button of the banner is pressed.
|
Banner |
show()
Creates a
Banner with the arguments supplied to this builder and immediately
displays the banner. |
public Builder(android.content.Context context)
The default banner style is defined by R.attr#bannerStyle
within the parent context's theme.
context - the parent contextpublic Builder(android.content.Context context,
int themeResId)
context - the parent contextthemeResId - the resource ID of the theme against which to inflate this bannerpublic Banner.Builder setParent(android.view.ViewGroup parent)
ViewGroup that will be a parent view for this banner.
Note: the banner will be added as a first child to this view. To
specify an index use setParent(ViewGroup, int).
parent - the parent view to display the banner inBanner.Builder object to chain callssetParent(ViewGroup, int),
setParent(ViewGroup, int, ViewGroup.LayoutParams)public Banner.Builder setParent(android.view.ViewGroup parent, int index)
ViewGroup that will be a parent view for this banner and specify
banner's index in the parent view.parent - the parent view to display the banner inindex - the position at which to add the banner or -1 to add lastBanner.Builder object to chain callssetParent(ViewGroup),
setParent(ViewGroup, int, ViewGroup.LayoutParams)public Banner.Builder setParent(android.view.ViewGroup parent, int index, android.view.ViewGroup.LayoutParams params)
ViewGroup that will be a parent view for this banner and specify
banner's index in the parent view.parent - the parent view to display the banner inindex - the position at which to add the banner or -1 to add lastparams - the layout parameters to set on the bannerBanner.Builder object to chain callssetParent(ViewGroup),
setParent(ViewGroup, int)public Banner.Builder setId(int id)
id - A number used to identify the bannerBanner.Builder object to chain callspublic Banner.Builder setIcon(int iconId)
Drawable to be used in the banner.Banner.Builder object to chain callspublic Banner.Builder setIcon(android.graphics.drawable.Drawable icon)
Drawable to be used in the banner.Banner.Builder object to chain callspublic Banner.Builder setMessage(int textId)
Banner.Builder object to chain callspublic Banner.Builder setMessage(java.lang.String text)
Banner.Builder object to chain callspublic Banner.Builder setLeftButton(int textId, BannerInterface.OnClickListener listener)
Usually used for the dismissive action.
textId - The resource id of the text to display in the left buttonlistener - The BannerInterface.OnClickListener to useBanner.Builder object to chain callspublic Banner.Builder setLeftButton(java.lang.String text, BannerInterface.OnClickListener listener)
Usually used for the dismissive action.
text - The text to display in the left buttonlistener - The BannerInterface.OnClickListener to useBanner.Builder object to chain callspublic Banner.Builder setRightButton(int textId, BannerInterface.OnClickListener listener)
Usually used for the confirming action.
textId - The resource id of the text to display in the right buttonlistener - The BannerInterface.OnClickListener to useBanner.Builder object to chain callspublic Banner.Builder setRightButton(java.lang.String text, BannerInterface.OnClickListener listener)
Usually used for the confirming action.
text - The text to display in the right buttonlistener - The BannerInterface.OnClickListener to useBanner.Builder object to chain callspublic Banner.Builder setOnDismissListener(BannerInterface.OnDismissListener listener)
listener - The BannerInterface.OnDismissListener to useBanner.Builder object to chain callspublic Banner.Builder setOnShowListener(BannerInterface.OnShowListener listener)
listener - The BannerInterface.OnShowListener to useBanner.Builder object to chain callspublic Banner create()
Banner with the arguments supplied to this builder.
Calling this method does not display the banner. If no additional processing is
needed, show() may be called instead to both create and display the banner.