Package com.batch.android
Class BatchBannerView
- java.lang.Object
-
- com.batch.android.BatchBannerView
-
public class BatchBannerView extends java.lang.ObjectBatchBannerView 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(View)anddismiss(boolean)to control how it shows up.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddismiss(boolean animated)Dismiss the banner if it's still on screen.voidembed(android.widget.FrameLayout embedLayout)Shows the banner in the given layout.voidshow(android.app.Activity activity)Shows the banner for the specified activity.voidshow(android.view.View anchorView)Shows the banner for the specified anchor view.
-
-
-
Method Detail
-
show
public void show(@NonNull android.app.Activity activity)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(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
public void show(@NonNull android.view.View anchorView)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
public void embed(@NonNull android.widget.FrameLayout embedLayout)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(View)again.- Parameters:
animated- true if the dismissal should be animated, false otherwise
-
-