public static class

BannerDisplayContent.Builder

extends Object
java.lang.Object
   ↳ com.urbanairship.iam.banner.BannerDisplayContent.Builder

Class Overview

Banner Display Content Builder.

Summary

Public Methods
BannerDisplayContent.Builder addAction(String actionName, JsonValue actionValue)
Adds an action to run when the banner is clicked.
BannerDisplayContent.Builder addButton(ButtonInfo buttonInfo)
Adds a button to the banner.
BannerDisplayContent build()
Builds the banner display content.
BannerDisplayContent.Builder setActions(Map<StringJsonValue> actions)
Sets the actions to run when the banner is clicked.
BannerDisplayContent.Builder setBackgroundColor(int color)
Sets the background color.
BannerDisplayContent.Builder setBody(TextInfo body)
Sets the banner's body.
BannerDisplayContent.Builder setBorderRadius(float borderRadius)
Sets the border radius in dps.
BannerDisplayContent.Builder setButtonLayout(String buttonLayout)
Sets the button layout.
BannerDisplayContent.Builder setButtons(List<ButtonInfo> buttons)
Sets the banner's buttons.
BannerDisplayContent.Builder setDismissButtonColor(int color)
Sets the dismiss button color.
BannerDisplayContent.Builder setDuration(long duration, TimeUnit timeUnit)
Sets the display duration.
BannerDisplayContent.Builder setHeading(TextInfo heading)
Sets the banner's heading.
BannerDisplayContent.Builder setMedia(MediaInfo media)
Sets the banner media.
BannerDisplayContent.Builder setPlacement(String placement)
Sets the banner's placement.
BannerDisplayContent.Builder setTemplate(String template)
Sets the banner's template.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public BannerDisplayContent.Builder addAction (String actionName, JsonValue actionValue)

Adds an action to run when the banner is clicked.

Parameters
actionName The action name.
actionValue The action value.
Returns
  • The builder instance.

public BannerDisplayContent.Builder addButton (ButtonInfo buttonInfo)

Adds a button to the banner. Only 2 buttons are supported.

Parameters
buttonInfo Adds a button to the banner.
Returns
  • The builder instance.

public BannerDisplayContent build ()

Builds the banner display content.

Returns
  • The banner display content.
Throws
IllegalArgumentException If more than 2 button are defined, if the supplied media is not an image, or if the banner does not define at least a heading, body, or buttons.

public BannerDisplayContent.Builder setActions (Map<StringJsonValue> actions)

Sets the actions to run when the banner is clicked.

Parameters
actions The action map.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setBackgroundColor (int color)

Sets the background color. Defaults to white.

Parameters
color The background color.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setBody (TextInfo body)

Sets the banner's body.

Parameters
body The banner's body.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setBorderRadius (float borderRadius)

Sets the border radius in dps. Defaults to 0.

Parameters
borderRadius The border radius.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setButtonLayout (String buttonLayout)

Sets the button layout. Defaults to BUTTON_LAYOUT_SEPARATE.

Parameters
buttonLayout The button layout.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setButtons (List<ButtonInfo> buttons)

Sets the banner's buttons. Only 2 buttons are supported.

Parameters
buttons A list of button infos.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setDismissButtonColor (int color)

Sets the dismiss button color. Defaults to black.

Parameters
color The dismiss button color.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setDuration (long duration, TimeUnit timeUnit)

Sets the display duration. Defaults to DEFAULT_DURATION_MS.

Parameters
duration The duration in milliseconds.
timeUnit The time unit.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setHeading (TextInfo heading)

Sets the banner's heading.

Parameters
heading The banner's heading.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setMedia (MediaInfo media)

Sets the banner media. Only TYPE_IMAGE is supported.

Parameters
media The media info.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setPlacement (String placement)

Sets the banner's placement. Defaults to PLACEMENT_BOTTOM.

Parameters
placement The banner's placement.
Returns
  • The builder instance.

public BannerDisplayContent.Builder setTemplate (String template)

Sets the banner's template. Defaults to TEMPLATE_LEFT_MEDIA.

Parameters
template The banner's template.
Returns
  • The builder instance.