Class CompanionAdManager
-
- All Implemented Interfaces:
public final class CompanionAdManagerManages the companion ad view from a list of VastCompanionAd objects.
-
-
Field Summary
Fields Modifier and Type Field Description private final MutableSharedFlow<MediaEvent>companionEventFlow
-
Constructor Summary
Constructors Constructor Description CompanionAdManager(Context context, CoroutineScope coroutineScope, CompanionTelemetryHelper companionTelemetryHelper, InMobiLogger logger)
-
Method Summary
Modifier and Type Method Description final MutableSharedFlow<MediaEvent>getCompanionEventFlow()final Unitinflate(List<VastCompanionAd> companionAds)Inflates the companion ad view asynchronously and sets the state to CompanionAdState.Available If the companion ad was successfully inflated. final BooleanisAvailable()Returns true if the companion ad view is available, false otherwise. final BooleancanInflate()Returns true if the companion ad view can be inflated, false otherwise. final UnitrenderCompanionView(FrameLayout parentView)Returns the companion ad view if it is available, throws a CompanionAdException otherwise. final Unitdestroy()Destroys the companion ad view and sets the state to CompanionAdState.Created. -
-
Constructor Detail
-
CompanionAdManager
CompanionAdManager(Context context, CoroutineScope coroutineScope, CompanionTelemetryHelper companionTelemetryHelper, InMobiLogger logger)
- Parameters:
context- The context.coroutineScope- The coroutine scope.logger- The logger.
-
-
Method Detail
-
getCompanionEventFlow
final MutableSharedFlow<MediaEvent> getCompanionEventFlow()
-
inflate
final Unit inflate(List<VastCompanionAd> companionAds)
Inflates the companion ad view asynchronously and sets the state to CompanionAdState.Available If the companion ad was successfully inflated. If the companion ad fails to inflate, the state is set to CompanionAdState.Failed. If no companion ad was successfully inflated, the state is set to CompanionAdState.Failed. If the companion ad is still loading, the state is set to CompanionAdState.Loading.
- Parameters:
companionAds- the list of companion ads to inflate.
-
isAvailable
final Boolean isAvailable()
Returns true if the companion ad view is available, false otherwise.
-
canInflate
final Boolean canInflate()
Returns true if the companion ad view can be inflated, false otherwise.
-
renderCompanionView
final Unit renderCompanionView(FrameLayout parentView)
Returns the companion ad view if it is available, throws a CompanionAdException otherwise.
- Returns:
the companion ad view.
-
destroy
final Unit destroy()
Destroys the companion ad view and sets the state to CompanionAdState.Created.
-
-
-
-