public class DefaultInAppMessageViewWrapper extends java.lang.Object implements IInAppMessageViewWrapper
Modifier and Type | Field and Description |
---|---|
protected java.util.List<android.view.View> |
mButtonViews |
protected android.view.View |
mClickableInAppMessageView |
protected android.view.View |
mCloseButton |
protected android.view.animation.Animation |
mClosingAnimation |
protected BrazeConfigurationProvider |
mConfigurationProvider |
protected java.lang.Runnable |
mDismissRunnable |
protected IInAppMessage |
mInAppMessage |
protected InAppMessageCloser |
mInAppMessageCloser |
protected android.view.View |
mInAppMessageView |
protected IInAppMessageViewLifecycleListener |
mInAppMessageViewLifecycleListener |
protected boolean |
mIsAnimatingClose |
protected android.view.animation.Animation |
mOpeningAnimation |
protected android.view.View |
mPreviouslyFocusedView
The
View that previously held focus before a message is displayed as
given via Activity.getCurrentFocus() . |
protected java.util.Map<java.lang.Integer,java.lang.Integer> |
mViewAccessibilityFlagMap
A mapping of the view accessibility flags of views before overriding them.
|
Constructor and Description |
---|
DefaultInAppMessageViewWrapper(android.view.View inAppMessageView,
IInAppMessage inAppMessage,
IInAppMessageViewLifecycleListener inAppMessageViewLifecycleListener,
BrazeConfigurationProvider configurationProvider,
android.view.animation.Animation openingAnimation,
android.view.animation.Animation closingAnimation,
android.view.View clickableInAppMessageView)
Constructor for base and slideup view wrappers.
|
DefaultInAppMessageViewWrapper(android.view.View inAppMessageView,
IInAppMessage inAppMessage,
IInAppMessageViewLifecycleListener inAppMessageViewLifecycleListener,
BrazeConfigurationProvider configurationProvider,
android.view.animation.Animation openingAnimation,
android.view.animation.Animation closingAnimation,
android.view.View clickableInAppMessageView,
java.util.List<android.view.View> buttonViews,
android.view.View closeButton)
Constructor for immersive in-app message view wrappers.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addDismissRunnable() |
protected void |
addInAppMessageViewToViewGroup(android.view.ViewGroup parentViewGroup,
IInAppMessage inAppMessage,
android.view.View inAppMessageView,
IInAppMessageViewLifecycleListener inAppMessageViewLifecycleListener)
Adds the
IInAppMessageView to the parent ViewGroup . |
protected void |
announceForAccessibilityIfNecessary()
Calls
announceForAccessibilityIfNecessary(String) with a
preset fallback message. |
protected void |
announceForAccessibilityIfNecessary(java.lang.String fallbackAccessibilityMessage)
Calls
View.announceForAccessibility(CharSequence) with the IInAppMessage.getMessage()
if the IInAppMessageView is IInAppMessageImmersiveView or the fallback message
IInAppMessageView is a InAppMessageHtmlBaseView . |
void |
close()
Closes an
IInAppMessage . |
protected void |
closeInAppMessageView()
Closes the in-app message view.
|
protected android.view.animation.Animation.AnimationListener |
createAnimationListener(boolean opening) |
protected android.view.View.OnClickListener |
createButtonClickListener() |
protected android.view.View.OnClickListener |
createClickListener()
Creates a
View.OnClickListener that calls
IInAppMessageViewLifecycleListener.onClicked(InAppMessageCloser, View, IInAppMessage) . |
protected android.view.View.OnClickListener |
createCloseInAppMessageClickListener() |
protected SwipeDismissTouchListener.DismissCallbacks |
createDismissCallbacks() |
protected TouchAwareSwipeDismissTouchListener.ITouchListener |
createTouchAwareListener() |
protected void |
finalizeViewBeforeDisplay(IInAppMessage inAppMessage,
android.view.View inAppMessageView,
IInAppMessageViewLifecycleListener inAppMessageViewLifecycleListener)
Performs any last actions before calling
IInAppMessageViewLifecycleListener.beforeOpened(View, IInAppMessage) . |
IInAppMessage |
getInAppMessage() |
android.view.View |
getInAppMessageView() |
boolean |
getIsAnimatingClose() |
protected android.view.ViewGroup.LayoutParams |
getLayoutParams(IInAppMessage inAppMessage)
Creates the
ViewGroup.LayoutParams used for adding the
IInAppMessageView to the ViewGroup returned by
getParentViewGroup(Activity) . |
protected android.view.ViewGroup |
getParentViewGroup(android.app.Activity activity)
Gets the
ViewGroup which will display the in-app message. |
void |
open(android.app.Activity activity)
Opens an
IInAppMessage on the Activity . |
protected static void |
resetAllViewGroupChildrenToPreviousAccessibilityFlagOrAuto(android.view.ViewGroup viewGroup,
java.util.Map<java.lang.Integer,java.lang.Integer> viewAccessibilityFlagMap)
Sets all
View children of the ViewGroup as their previously
mapped accessibility flag, or ViewCompat#IMPORTANT_FOR_ACCESSIBILITY_AUTO if
not found in the mapping. |
protected static void |
setAllViewGroupChildrenAsNonAccessibilityImportant(android.view.ViewGroup viewGroup,
java.util.Map<java.lang.Integer,java.lang.Integer> viewAccessibilityFlagMap)
Sets all
View children of the ViewGroup
as ViewCompat#IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS . |
protected void |
setAndStartAnimation(boolean opening)
Instantiates and executes the correct animation for the current in-app message.
|
protected final android.view.View mInAppMessageView
protected final IInAppMessage mInAppMessage
protected final IInAppMessageViewLifecycleListener mInAppMessageViewLifecycleListener
protected final android.view.animation.Animation mOpeningAnimation
protected final android.view.animation.Animation mClosingAnimation
protected final BrazeConfigurationProvider mConfigurationProvider
protected final InAppMessageCloser mInAppMessageCloser
protected boolean mIsAnimatingClose
protected java.lang.Runnable mDismissRunnable
protected final android.view.View mClickableInAppMessageView
protected android.view.View mCloseButton
protected java.util.List<android.view.View> mButtonViews
protected android.view.View mPreviouslyFocusedView
View
that previously held focus before a message is displayed as
given via Activity.getCurrentFocus()
.protected java.util.Map<java.lang.Integer,java.lang.Integer> mViewAccessibilityFlagMap
BrazeConfig.Builder.setIsInAppMessageAccessibilityExclusiveModeEnabled(boolean)
public DefaultInAppMessageViewWrapper(android.view.View inAppMessageView, IInAppMessage inAppMessage, IInAppMessageViewLifecycleListener inAppMessageViewLifecycleListener, BrazeConfigurationProvider configurationProvider, android.view.animation.Animation openingAnimation, android.view.animation.Animation closingAnimation, android.view.View clickableInAppMessageView)
inAppMessageView
- In-app message top level view.inAppMessage
- In-app message model.inAppMessageViewLifecycleListener
- In-app message lifecycle listener.configurationProvider
- Configuration provider.clickableInAppMessageView
- View for which click actions apply.public DefaultInAppMessageViewWrapper(android.view.View inAppMessageView, IInAppMessage inAppMessage, IInAppMessageViewLifecycleListener inAppMessageViewLifecycleListener, BrazeConfigurationProvider configurationProvider, android.view.animation.Animation openingAnimation, android.view.animation.Animation closingAnimation, android.view.View clickableInAppMessageView, java.util.List<android.view.View> buttonViews, android.view.View closeButton)
inAppMessageView
- In-app message top level view.inAppMessage
- In-app message model.inAppMessageViewLifecycleListener
- In-app message lifecycle listener.configurationProvider
- Configuration provider.buttonViews
- List of views corresponding to MessageButton objects stored in the in-app message model object.
These views should map one to one with the MessageButton objects.closeButton
- The View
responsible for closing the in-app message.public void open(android.app.Activity activity)
IInAppMessageViewWrapper
IInAppMessage
on the Activity
. As a
result of this call, it is expected that an IInAppMessage
is visible and interactable by the user.
Note that this method is expected to be called
on the main UI thread and should run synchronously.open
in interface IInAppMessageViewWrapper
public void close()
IInAppMessageViewWrapper
IInAppMessage
. As a
result of this call, it is expected that an IInAppMessage
is no longer visible and not interactable by the user.
Note that this method is expected to be called
on the main UI thread and should run synchronously.close
in interface IInAppMessageViewWrapper
public android.view.View getInAppMessageView()
getInAppMessageView
in interface IInAppMessageViewWrapper
View
representing the IInAppMessage
that is visible to the user.public IInAppMessage getInAppMessage()
getInAppMessage
in interface IInAppMessageViewWrapper
IInAppMessage
being wrapped.public boolean getIsAnimatingClose()
getIsAnimatingClose
in interface IInAppMessageViewWrapper
IInAppMessage
view is
currently in the process of its close animation.protected android.view.ViewGroup getParentViewGroup(android.app.Activity activity)
ViewGroup
which will display the in-app message. Note that
if this implementation is overridden, then
getLayoutParams(IInAppMessage)
should
also most likely be overridden to match the ViewGroup
subclass
returned here.protected android.view.ViewGroup.LayoutParams getLayoutParams(IInAppMessage inAppMessage)
ViewGroup.LayoutParams
used for adding the
IInAppMessageView
to the ViewGroup
returned by
getParentViewGroup(Activity)
.
Note that the exact subclass of ViewGroup.LayoutParams
should
match that of the ViewGroup
returned by
getParentViewGroup(Activity)
.protected void addInAppMessageViewToViewGroup(android.view.ViewGroup parentViewGroup, IInAppMessage inAppMessage, android.view.View inAppMessageView, IInAppMessageViewLifecycleListener inAppMessageViewLifecycleListener)
IInAppMessageView
to the parent ViewGroup
. Also
calls IInAppMessageViewLifecycleListener.beforeOpened(View, IInAppMessage)
and
IInAppMessageViewLifecycleListener.afterOpened(View, IInAppMessage)
.protected void announceForAccessibilityIfNecessary()
announceForAccessibilityIfNecessary(String)
with a
preset fallback message.protected void announceForAccessibilityIfNecessary(java.lang.String fallbackAccessibilityMessage)
View.announceForAccessibility(CharSequence)
with the IInAppMessage.getMessage()
if the IInAppMessageView
is IInAppMessageImmersiveView
or the fallback message
IInAppMessageView
is a InAppMessageHtmlBaseView
.protected android.view.View.OnClickListener createClickListener()
View.OnClickListener
that calls
IInAppMessageViewLifecycleListener.onClicked(InAppMessageCloser, View, IInAppMessage)
.
IInAppMessageViewLifecycleListener.onClicked(InAppMessageCloser, View, IInAppMessage)
is called and
can be used to turn off the close animation. Full and modal in-app messages can
only be clicked directly when they do not contain buttons.
Slideup in-app messages are always clickable.protected android.view.View.OnClickListener createButtonClickListener()
IInAppMessageViewLifecycleListener.onButtonClicked(InAppMessageCloser, MessageButton, IInAppMessageImmersive)
if the clicked View.getId()
matches that of a MessageButton
's View
.protected android.view.View.OnClickListener createCloseInAppMessageClickListener()
protected void addDismissRunnable()
protected void setAndStartAnimation(boolean opening)
opening
- protected void closeInAppMessageView()
IInAppMessageViewLifecycleListener.afterClosed(IInAppMessage)
is called. protected void finalizeViewBeforeDisplay(IInAppMessage inAppMessage, android.view.View inAppMessageView, IInAppMessageViewLifecycleListener inAppMessageViewLifecycleListener)
IInAppMessageViewLifecycleListener.beforeOpened(View, IInAppMessage)
.protected SwipeDismissTouchListener.DismissCallbacks createDismissCallbacks()
protected TouchAwareSwipeDismissTouchListener.ITouchListener createTouchAwareListener()
protected android.view.animation.Animation.AnimationListener createAnimationListener(boolean opening)
protected static void setAllViewGroupChildrenAsNonAccessibilityImportant(android.view.ViewGroup viewGroup, java.util.Map<java.lang.Integer,java.lang.Integer> viewAccessibilityFlagMap)
View
children of the ViewGroup
as ViewCompat#IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
.protected static void resetAllViewGroupChildrenToPreviousAccessibilityFlagOrAuto(android.view.ViewGroup viewGroup, java.util.Map<java.lang.Integer,java.lang.Integer> viewAccessibilityFlagMap)
View
children of the ViewGroup
as their previously
mapped accessibility flag, or ViewCompat#IMPORTANT_FOR_ACCESSIBILITY_AUTO
if
not found in the mapping.