public abstract class InAppMessageBase extends java.lang.Object implements IInAppMessage, IInAppMessageThemeable
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
ANIMATE_IN |
protected static java.lang.String |
ANIMATE_OUT |
protected static java.lang.String |
CROP_TYPE |
static int |
INAPP_MESSAGE_DURATION_DEFAULT_MILLIS |
static int |
INAPP_MESSAGE_DURATION_MIN_MILLIS |
static java.lang.String |
IS_CONTROL |
protected IBrazeManager |
mBrazeManager |
protected CropType |
mCropType |
protected static java.lang.String |
MESSAGE_TEXT_ALIGN |
protected InAppMessageTheme |
mInAppMessageDarkThemeWrapper |
protected org.json.JSONObject |
mJsonObject |
protected TextAlign |
mMessageTextAlign |
protected boolean |
mOpenUriInWebview |
protected static java.lang.String |
OPEN_URI_IN_WEBVIEW |
static java.lang.String |
TYPE |
Modifier | Constructor and Description |
---|---|
protected |
InAppMessageBase() |
|
InAppMessageBase(org.json.JSONObject object,
IBrazeManager brazeManager) |
Modifier and Type | Method and Description |
---|---|
void |
enableDarkTheme()
Instructs the
IInAppMessage to apply any dark theme settings
and override any existing values present on the IInAppMessage . |
org.json.JSONObject |
forJsonPut()
Storing in-app messages serialized with this method is primarily
for storage as triggered actions.
|
boolean |
getAnimateIn()
Gets whether this in-app message will animate in or
appear suddenly.
|
boolean |
getAnimateOut()
Gets whether this in-app message will animate out or
disappear suddenly.
|
int |
getBackgroundColor()
Gets the background color on this in-app message.
|
ClickAction |
getClickAction()
Gets the click action of this in-app message.
|
CropType |
getCropType()
Gets the crop type for this in-app message's image.
|
DismissType |
getDismissType()
Gets the dismiss type of this in-app message.
|
int |
getDurationInMilliseconds()
Gets the duration of this in-app message.
|
long |
getExpirationTimestamp()
Get the UTC timestamp at which this message expires and will not be displayed.
|
java.util.Map<java.lang.String,java.lang.String> |
getExtras()
Gets the extras on this in-app message as a map
of key value pairs.
|
java.lang.String |
getIcon()
Gets the Font Awesome icon on this in-app message.
|
int |
getIconBackgroundColor()
Gets the icon background color on this in-app message.
|
int |
getIconColor()
Gets the icon color on this in-app message.
|
java.util.Map<java.lang.String,java.lang.String> |
getLocalPrefetchedAssetPaths()
Note that this class does not have an implementation for this method.
|
java.lang.String |
getMessage()
Gets the message text on this in-app message.
|
TextAlign |
getMessageTextAlign()
Get the text alignment for the message text.
|
int |
getMessageTextColor()
Gets the message text color on this in-app message.
|
boolean |
getOpenUriInWebView()
Whether to use AppboyWebViewActivity to open deep links from this in-app message.
|
Orientation |
getOrientation()
Gets the preferred screen orientation for this in-app message.
|
java.util.List<java.lang.String> |
getRemoteAssetPathsForPrefetch()
Returns a path to remote assets that can be pre-fetched.
|
android.net.Uri |
getUri()
Gets the URI on this in-app message.
|
boolean |
isControl()
Gets whether this in-app message is a control for multivariate testing.
|
boolean |
logClick()
Logs a click on this in-app message.
|
boolean |
logDisplayFailure(InAppMessageFailureType failureType)
Logs a display failure on this in-app message.
|
boolean |
logImpression()
Logs an impression on this in-app message.
|
void |
onAfterClosed()
Should be called on the in-app message once it is no longer being displayed, to allow it
to perform any cleanup or trigger further actions.
|
void |
setAnimateIn(boolean animateIn)
Sets whether this in-app message will animate in or
appear suddenly.
|
void |
setAnimateOut(boolean animateOut)
Sets whether this in-app message will animate out or
disappear suddenly.
|
void |
setBackgroundColor(int backgroundColor)
Sets the background color on this in-app message.
|
boolean |
setClickAction(ClickAction clickAction)
Sets the click action of this in-app message.
|
boolean |
setClickAction(ClickAction clickAction,
android.net.Uri uri)
Sets the click action of this in-app message.
|
void |
setCropType(CropType cropType)
Sets the crop type for this in-app message's image.
|
void |
setDismissType(DismissType dismissType)
Sets the dismiss type of this in-app message.
|
void |
setDurationInMilliseconds(int durationInMilliseconds)
Sets the duration of this in-app message.
|
void |
setExpirationTimestamp(long timestamp)
Set the UTC timestamp at which this message expires and will not be displayed.
|
void |
setExtras(java.util.Map<java.lang.String,java.lang.String> extras)
Sets or overrides the extras on this in-app message as a map
of key value pairs.
|
void |
setIcon(java.lang.String icon)
Sets the icon on this in-app message.
|
void |
setIconBackgroundColor(int iconBackgroundColor)
Sets the icon background color on this in-app message.
|
void |
setIconColor(int iconColor)
Sets the icon color on this in-app message.
|
void |
setLocalPrefetchedAssetPaths(java.util.Map<java.lang.String,java.lang.String> remotePathToLocalAssetMap)
The base In-App Message class does not have
assets of its own.
|
void |
setMessage(java.lang.String message)
Sets the message text of this in-app message.
|
void |
setMessageTextAlign(TextAlign textAlign)
Set the text alignment for the message text.
|
void |
setMessageTextColor(int textColor)
Sets the message text color on this in-app message.
|
void |
setOpenUriInWebView(boolean openUriInWebView)
Sets whether to use AppboyWebViewActivity to open deep links from this in-app message.
|
void |
setOrientation(Orientation orientation)
Sets the preferred screen orientation for this in-app message.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMessageType
public static final int INAPP_MESSAGE_DURATION_DEFAULT_MILLIS
public static final int INAPP_MESSAGE_DURATION_MIN_MILLIS
protected static final java.lang.String CROP_TYPE
protected static final java.lang.String MESSAGE_TEXT_ALIGN
protected static final java.lang.String ANIMATE_IN
protected static final java.lang.String ANIMATE_OUT
protected static final java.lang.String OPEN_URI_IN_WEBVIEW
public static final java.lang.String IS_CONTROL
public static final java.lang.String TYPE
protected CropType mCropType
protected TextAlign mMessageTextAlign
protected boolean mOpenUriInWebview
protected org.json.JSONObject mJsonObject
protected IBrazeManager mBrazeManager
protected InAppMessageTheme mInAppMessageDarkThemeWrapper
protected InAppMessageBase()
public InAppMessageBase(org.json.JSONObject object, IBrazeManager brazeManager) throws org.json.JSONException
org.json.JSONException
- if JSON is malformed. Constructed InAppMessageBase
objects are meant to be fully verified and good to go.public java.lang.String getMessage()
IInAppMessage
getMessage
in interface IInAppMessage
public java.util.Map<java.lang.String,java.lang.String> getExtras()
IInAppMessage
getExtras
in interface IInAppMessage
public void setExtras(java.util.Map<java.lang.String,java.lang.String> extras)
IInAppMessage
setExtras
in interface IInAppMessage
extras
- A map of extras on this in-app message.public int getDurationInMilliseconds()
IInAppMessage
getDurationInMilliseconds
in interface IInAppMessage
public int getBackgroundColor()
IInAppMessage
getBackgroundColor
in interface IInAppMessage
Color
public int getIconColor()
IInAppMessage
getIconColor
in interface IInAppMessage
Color
public int getIconBackgroundColor()
IInAppMessage
getIconBackgroundColor
in interface IInAppMessage
Color
public int getMessageTextColor()
IInAppMessage
getMessageTextColor
in interface IInAppMessage
Color
public java.lang.String getIcon()
IInAppMessage
getIcon
in interface IInAppMessage
public boolean getAnimateIn()
IInAppMessage
getAnimateIn
in interface IInAppMessage
public boolean getAnimateOut()
IInAppMessage
getAnimateOut
in interface IInAppMessage
public ClickAction getClickAction()
IInAppMessage
See ClickAction
getClickAction
in interface IInAppMessage
public android.net.Uri getUri()
IInAppMessage
See IInAppMessage.setClickAction(ClickAction, android.net.Uri)
getUri
in interface IInAppMessage
public DismissType getDismissType()
IInAppMessage
See DismissType
getDismissType
in interface IInAppMessage
public Orientation getOrientation()
IInAppMessage
In-app messages will only display if the preferred orientation matches the current activity orientation. However, there is an important exception for tablets For in-app messages that have a preferred orientation and are being displayed on tablet, the in-app message will appear in the style of the preferred orientation regardless of actual screen orientation.
getOrientation
in interface IInAppMessage
public CropType getCropType()
IInAppMessage
getCropType
in interface IInAppMessage
public TextAlign getMessageTextAlign()
IInAppMessage
getMessageTextAlign
in interface IInAppMessage
public long getExpirationTimestamp()
IInAppMessage
getExpirationTimestamp
in interface IInAppMessage
public boolean getOpenUriInWebView()
IInAppMessage
When true, the SDK will make a best effort to use AppboyWebViewActivity to open the deep link.
When false, deep links are opened using an Intent.ACTION_VIEW intent.
getOpenUriInWebView
in interface IInAppMessage
public void setOpenUriInWebView(boolean openUriInWebView)
IInAppMessage
setOpenUriInWebView
in interface IInAppMessage
openUriInWebView
- whether AppboyWebViewActivity should be used to open deep links from this
in-app message.public void setExpirationTimestamp(long timestamp)
IInAppMessage
setExpirationTimestamp
in interface IInAppMessage
timestamp
- expiration timestamp for the messagepublic void setMessageTextAlign(TextAlign textAlign)
IInAppMessage
setMessageTextAlign
in interface IInAppMessage
textAlign
- the text alignment for the message textpublic void setCropType(CropType cropType)
IInAppMessage
setCropType
in interface IInAppMessage
cropType
- the image crop type for this in-app message's image.public void setOrientation(Orientation orientation)
IInAppMessage
In-app messages will only display if the preferred orientation matches the current activity orientation. However, there is an important exception for tablets For in-app messages that have a preferred orientation and are being displayed on tablet, the in-app message will appear in the style of the preferred orientation regardless of actual screen orientation.
setOrientation
in interface IInAppMessage
orientation
- the preferred screen orientation for this in-app messagepublic void setMessage(java.lang.String message)
IInAppMessage
setMessage
in interface IInAppMessage
message
- the desired message text for this in-app message.public void setAnimateIn(boolean animateIn)
IInAppMessage
setAnimateIn
in interface IInAppMessage
animateIn
- whether to animate the in-app message in.public void setAnimateOut(boolean animateOut)
IInAppMessage
setAnimateOut
in interface IInAppMessage
animateOut
- whether to animate the in-app message out.public boolean setClickAction(ClickAction clickAction)
IInAppMessage
See ClickAction
setClickAction
in interface IInAppMessage
clickAction
- The desired click action.public boolean setClickAction(ClickAction clickAction, android.net.Uri uri)
IInAppMessage
See ClickAction
setClickAction
in interface IInAppMessage
clickAction
- The desired click action.uri
- A valid Uri to navigate to on click. To set the Uri,
the click action must be set to URI and a non-null Uri
must be specified.public void setDismissType(DismissType dismissType)
IInAppMessage
See DismissType
setDismissType
in interface IInAppMessage
dismissType
- Desired dismiss type.public void setDurationInMilliseconds(int durationInMilliseconds)
IInAppMessage
setDurationInMilliseconds
in interface IInAppMessage
durationInMilliseconds
- Desired in-app message duration. Inappropriately low or
high values should be set to a reasonable default.public void setBackgroundColor(int backgroundColor)
IInAppMessage
setBackgroundColor
in interface IInAppMessage
backgroundColor
- See Color
public void setIconColor(int iconColor)
IInAppMessage
setIconColor
in interface IInAppMessage
iconColor
- See Color
public void setIconBackgroundColor(int iconBackgroundColor)
IInAppMessage
setIconBackgroundColor
in interface IInAppMessage
iconBackgroundColor
- See Color
public void setMessageTextColor(int textColor)
IInAppMessage
setMessageTextColor
in interface IInAppMessage
textColor
- See Color
public void setIcon(java.lang.String icon)
IInAppMessage
setIcon
in interface IInAppMessage
icon
- Unicode string for the desired Font Awesome icon.public java.util.Map<java.lang.String,java.lang.String> getLocalPrefetchedAssetPaths()
getLocalPrefetchedAssetPaths
in interface IInAppMessage
public boolean logImpression()
IInAppMessage
logImpression
in interface IInAppMessage
public boolean logClick()
IInAppMessage
logClick
in interface IInAppMessage
public void onAfterClosed()
IInAppMessage
onAfterClosed
in interface IInAppMessage
public boolean isControl()
IInAppMessage
isControl
in interface IInAppMessage
public boolean logDisplayFailure(InAppMessageFailureType failureType)
IInAppMessage
In-app message display failures may affect campaign statistics so care should be taken when logging display failures.
logDisplayFailure
in interface IInAppMessage
failureType
- The precise type of the display failure.public void enableDarkTheme()
IInAppMessageThemeable
IInAppMessage
to apply any dark theme settings
and override any existing values present on the IInAppMessage
.enableDarkTheme
in interface IInAppMessageThemeable
public java.util.List<java.lang.String> getRemoteAssetPathsForPrefetch()
IInAppMessage
IInAppMessage.setLocalPrefetchedAssetPaths(Map)
getRemoteAssetPathsForPrefetch
in interface IInAppMessage
public void setLocalPrefetchedAssetPaths(java.util.Map<java.lang.String,java.lang.String> remotePathToLocalAssetMap)
setLocalPrefetchedAssetPaths
in interface IInAppMessage
remotePathToLocalAssetMap
- A map of remote assets Uris to local asset Uri paths.public org.json.JSONObject forJsonPut()
forJsonPut
in interface IPutIntoJson<org.json.JSONObject>