Package com.batch.android
Class BatchBannerView
java.lang.Object
com.batch.android.BatchBannerView
BatchBannerView handles operations related to a Batch In-App Messaging banner, when used in manual mode.
It is not actually a view that you can directly add to your hierarchy. You will have to use show(android.view.View)
and dismiss(boolean)
to control how it shows up.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
dismiss
(boolean animated) Dismiss the banner if it's still on screen.void
embed
(FrameLayout embedLayout) Shows the banner in the given layout.void
Shows the banner for the specified activity.void
Shows the banner for the specified anchor view.
-
Method Details
-
show
Shows the banner for the specified activity. This is equivalent to calling show(findViewById(android.R.id.content)). If you'd like to attach the banner on a CoordinatorLayout, you should useshow(android.view.View)
, or have your activity implementBatch.Messaging.DisplayHintProvider
.
This can only be called once per instance of BatchBannerView, even ifdismiss(boolean)
has been called.
You can run this method on any thread.- Parameters:
activity
- Activity to display the banner on. Can't be null, must currently be onscreen.
-
show
Shows the banner for the specified anchor view. Just like a Snackbar, the anchor view can be any view from your hierarchy. BatchBannerView will automatically explore your view hierarchy to find the most appropriate view to display itself onto. Usually, this should be a CoordinatorLayout, or your root view.
This can only be called once per instance of BatchBannerView, even ifdismiss(boolean)
has been called.
You can run this method on any thread.- Parameters:
anchorView
- View used as a base to find the best view to be attached to. Can't be null, must be in your hierarchy.
-
embed
Shows the banner in the given layout. Should only be used in very specific cases where none of the automatic display methods are appropriate.
Do not make any assumption about the views that Batch will add, as it is merely an implementation detail and subject to change.- Parameters:
embedLayout
- Layout to embed the banner in
-
dismiss
public void dismiss(boolean animated) Dismiss the banner if it's still on screen.Calling this doesn't allow you to call
show(android.view.View)
again.- Parameters:
animated
- true if the dismissal should be animated, false otherwise
-