lib / tv.spotx.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

configuration

The SxConfiguration used for all loadAd calls.

open val configuration: SxConfiguration

di

val di: IKoinDi

Functions

loadAd

Same as SxAdSlotController.loadAd but with Strings instead of Uris for the Url's.

open fun loadAd(ad: String, autoPlay: Boolean, opener: String?, closer: String?, bumper: String?): Unit

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

open fun loadAd(ad: Uri, autoPlay: Boolean, opener: Uri?, closer: Uri?, bumper: Uri?): 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 within the parent Activity/Fragment onResume() 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 implementing class is not needed anymore.

open fun release(): Unit

startAd

Only use in the following cases:

open fun startAd(): Unit

Extension Functions

onClick

infix fun <T : View> T?.onClick(block: (T) -> Unit): Unit?