Package com.unblu.sdk.core.ui
Interface UnbluModalViewHandler
- All Known Implementing Classes:
UnbluBottomSheetModalViewHandler
,UnbluDefaultModalViewHandler
public interface UnbluModalViewHandler
Interface for a handler responsible for displaying the UnbluView as a modal.
The UnbluView is displayed on a limited scope and is detached from its parent
view as soon as it loses scope (i.e., when it is dismissed or destroyed).
Register this handler using UnbluClient.setUnbluModaViewHandler(UnbluModalViewHandler)
.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onDisposeModal
(android.content.Context context) Invoked when the modal UnbluView is to be disposed.void
onPresentAsModal
(android.view.View unbluView, UnbluAnimationData animSourceData) Invoked when the UnbluView needs to be displayed as a modal.default boolean
Invoked when Unblu needs to assess whether it should be presented modally.
-
Method Details
-
shouldPresentAsModal
default boolean shouldPresentAsModal()Invoked when Unblu needs to assess whether it should be presented modally. If true, it will callonPresentAsModal(View, UnbluAnimationData)
to present modally. If false, it will emit aUiVisibilityRequestModel
event -
onPresentAsModal
@NonNull void onPresentAsModal(@NonNull android.view.View unbluView, @NonNull UnbluAnimationData animSourceData) Invoked when the UnbluView needs to be displayed as a modal. This can occur in scenarios such as clicking an avatar or when an in-app picture-in-picture is activated.Note: If you opt to use
Also keep a reference to theWindowManager
to display the modal, it is your responsibility to dispose of the view yourself. Keep a reference to the view so you can properly dispose of it inonDisposeModal(Context)
.UnbluAnimationData
animSourceData in order to be able to properly animate the view.- Parameters:
unbluView
- The UnbluView that needs to be displayed as a modal.animSourceData
-UnbluAnimationData
the source data to assist in case animations are to be used in order to display the view.
-
onDisposeModal
@NonNull void onDisposeModal(@NonNull android.content.Context context) Invoked when the modal UnbluView is to be disposed. This method allows any necessary cleanup operations to take place.- Parameters:
context
- The current Android context, which may be needed for any cleanup operations.
-