lib / tv.smartclip.smartclientandroid.lib / SxAdView

SxAdView

open class SxAdView : ConstraintLayout, AdView, Releasable

View that should be used for outstream use cases. It uses the ExoPlayer to display the requested advertisement tag (incl. it's opener, closer and/or bumper). onResume and onPause must be called in the corresponding android lifecycle callbacks. release must be called when this view is not needed anymore. To change the used SxConfiguration you can use all xml attributes defined in R.styleable.SxAdView or overwrite SxAdView and implement the configuration property.

Parameters

context - current Context

attrs - AttributeSet for this view

defStyleAttr - style attributes for this view

Constructors

<init>

View that should be used for outstream use cases. It uses the ExoPlayer to display the requested advertisement tag (incl. it's opener, closer and/or bumper). onResume and onPause must be called in the corresponding android lifecycle callbacks. release must be called when this view is not needed anymore. To change the used SxConfiguration you can use all xml attributes defined in R.styleable.SxAdView or overwrite SxAdView and implement the configuration property.

SxAdView(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0)

Properties

adInfo

Current SxAdInfo instance or null of there is none.

open val adInfo: SxAdInfo?

configuration

SxConfiguration used for all loaded SxAdSlots.

open val configuration: SxConfiguration

di

val di: IKoinDi

publicAd

Current SxPublicAd instance or null of there is none.

open val publicAd: SxPublicAd?

publicAdSlot

Current SxPublicAdSlot instance or null of there is none.

open val publicAdSlot: SxPublicAdSlot?

Functions

addAdInfoListener

open fun addAdInfoListener(listener: IOnChangedScope<SxAdInfo>.(SxAdInfo) -> Unit): () -> Unit

addPublicAdListener

open fun addPublicAdListener(listener: IOnChangedScope<SxPublicAd>.(SxPublicAd) -> Unit): () -> Unit

addPublicAdSlotListener

open fun addPublicAdSlotListener(listener: IOnChangedScope<SxPublicAdSlot>.(SxPublicAdSlot) -> Unit): () -> Unit

loadAd

Request the initialization of the provided ad tag and its optional opener, closer and bumper from the smartcore.

open fun loadAd(adSlot: SxAdSlot): Unit

onAttachedToWindow

open fun onAttachedToWindow(): Unit

onPause

Must be called within the parent Activity/Fragment onPause() method.

open fun onPause(): Unit

onResume

Must be called from within the View.onWindowFocusChanged method.

open fun onResume(): Unit

onVisibilityChanged

Must be called from within the View.onVisibilityChanged method.

open fun onVisibilityChanged(changedView: View, visibility: Int): Unit

onWindowFocusChanged

Must be called from within the View.onWindowFocusChanged method.

open fun onWindowFocusChanged(hasWindowFocus: Boolean): Unit

release

Removes all external class references. Has to be called when the instance of this class is not needed anymore.

open fun release(): Unit

startAd

Only use in the following cases:

open fun startAd(): Unit