Class AbstractCreative
- java.lang.Object
-
- org.prebid.mobile.rendering.models.AbstractCreative
-
- Direct Known Subclasses:
HTMLCreative,VideoCreativeProtocol
public abstract class AbstractCreative extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ref.WeakReference<android.content.Context>contextReferenceprotected CreativeVisibilityTrackercreativeVisibilityTrackerprotected InterstitialManagerinterstitialManagerprotected java.lang.ref.WeakReference<OmAdSessionManager>weakOmAdSessionManager
-
Constructor Summary
Constructors Constructor Description AbstractCreative(android.content.Context context, CreativeModel model, OmAdSessionManager omAdSessionManager, InterstitialManager interstitialManager)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddOmFriendlyObstruction(InternalFriendlyObstruction friendlyObstruction)voidchangeVisibilityTrackerState(boolean adWebViewWindowFocus)Changes thecreativeVisibilityTrackerstate based on ad webView window focus.abstract voidcreateOmAdSession()Create OM session for specific creative.voiddestroy()Specific creative cleanup.abstract voiddisplay()Specific creative display.CreativeModelgetCreativeModel()android.view.ViewgetCreativeView()CreativeViewListenergetCreativeViewListener()longgetMediaDuration()CreativeResolutionListenergetResolutionListener()longgetVideoSkipOffset()abstract voidhandleAdWindowFocus()Executed when window gains focus (e.g. when app is resumed from background) Used byAdViewManagerto handle refresh on view visibility changeabstract voidhandleAdWindowNoFocus()Executed when window loses focus (e.g. when app is going in background).booleanisBuiltInVideo()abstract booleanisDisplay()abstract booleanisEndCard()booleanisInterstitialClosed()booleanisPlaying()abstract booleanisResolved()abstract booleanisVideo()abstract voidload()Specific creative load.voidmute()Mute creativevoidpause()Pause creative executionvoidresume()Resume creative executionvoidsetCreativeView(android.view.View creativeView)Sets currently used creative view for specific creative.voidsetCreativeViewListener(CreativeViewListener creativeViewListener)voidsetResolutionListener(CreativeResolutionListener resolutionListener)protected voidstartOmSession(OmAdSessionManager omAdSessionManager, android.view.View view)abstract voidstartViewabilityTracker()abstract voidtrackAdLoaded()Executed after processing transaction and creating OmAdSession inAdViewManagervoidtrackVideoEvent(VideoAdEvent.Event event)VideoAdEvent.Event to trackvoidtrackVideoStateChange(InternalPlayerState state)Track video state change to OmEventTrackervoidunmute()UnMute creativevoidupdateAdView(android.view.View view)
-
-
-
Field Detail
-
contextReference
protected java.lang.ref.WeakReference<android.content.Context> contextReference
-
weakOmAdSessionManager
protected java.lang.ref.WeakReference<OmAdSessionManager> weakOmAdSessionManager
-
interstitialManager
protected InterstitialManager interstitialManager
-
creativeVisibilityTracker
protected CreativeVisibilityTracker creativeVisibilityTracker
-
-
Constructor Detail
-
AbstractCreative
public AbstractCreative(android.content.Context context, CreativeModel model, OmAdSessionManager omAdSessionManager, InterstitialManager interstitialManager) throws AdException- Throws:
AdException
-
-
Method Detail
-
isDisplay
public abstract boolean isDisplay()
-
isVideo
public abstract boolean isVideo()
-
isResolved
public abstract boolean isResolved()
-
isEndCard
public abstract boolean isEndCard()
-
pause
public void pause()
Pause creative execution
-
resume
public void resume()
Resume creative execution
-
unmute
public void unmute()
UnMute creative
-
mute
public void mute()
Mute creative
-
isPlaying
public boolean isPlaying()
- Returns:
- Whether the creative is playing
-
trackVideoStateChange
public void trackVideoStateChange(InternalPlayerState state)
Track video state change to OmEventTracker- Parameters:
state- to track
-
isInterstitialClosed
public boolean isInterstitialClosed()
- Returns:
- if current creative is serving as interstitial that was closed
-
getMediaDuration
public long getMediaDuration()
- Returns:
- media duration in ms
-
getVideoSkipOffset
public long getVideoSkipOffset()
- Returns:
- video skip offset in ms
-
trackVideoEvent
public void trackVideoEvent(VideoAdEvent.Event event)
VideoAdEvent.Event to track
-
isBuiltInVideo
public boolean isBuiltInVideo()
- Returns:
- if the current ad config suggests that this is a video
-
load
public abstract void load() throws AdExceptionSpecific creative load.- Throws:
AdException
-
trackAdLoaded
public abstract void trackAdLoaded()
Executed after processing transaction and creating OmAdSession inAdViewManager
-
display
public abstract void display()
Specific creative display.
-
createOmAdSession
public abstract void createOmAdSession()
Create OM session for specific creative. Each creative must create appropriate OM AdSession (e.g. for HTML and Native)
-
startViewabilityTracker
public abstract void startViewabilityTracker()
-
destroy
public void destroy()
Specific creative cleanup. Creative must cleanup it's internal state.
-
handleAdWindowFocus
public abstract void handleAdWindowFocus()
Executed when window gains focus (e.g. when app is resumed from background) Used byAdViewManagerto handle refresh on view visibility change
-
handleAdWindowNoFocus
public abstract void handleAdWindowNoFocus()
Executed when window loses focus (e.g. when app is going in background). Used byAdViewManagerto handle refresh on view visibility change
-
changeVisibilityTrackerState
public void changeVisibilityTrackerState(boolean adWebViewWindowFocus)
Changes thecreativeVisibilityTrackerstate based on ad webView window focus. If ad webView has no window focus -creativeVisibilityTrackerexecution will be stopped. If ad webView has window focus -creativeVisibilityTrackerexecution will be restarted.- Parameters:
adWebViewWindowFocus- adWebView focus state
-
setResolutionListener
public void setResolutionListener(CreativeResolutionListener resolutionListener)
-
getResolutionListener
public CreativeResolutionListener getResolutionListener()
-
setCreativeViewListener
public void setCreativeViewListener(CreativeViewListener creativeViewListener)
-
setCreativeView
public void setCreativeView(android.view.View creativeView)
Sets currently used creative view for specific creative.- Parameters:
creativeView- individual creative view. E.g. webView for HTMLCreative.
-
getCreativeView
public android.view.View getCreativeView()
- Returns:
- individual creative view. E.g. webView for HTMLCreative.
-
getCreativeModel
public CreativeModel getCreativeModel()
- Returns:
CreativeModelwhich can be used to track events or to access specific creative ad configuration.
-
updateAdView
public void updateAdView(android.view.View view)
-
getCreativeViewListener
public CreativeViewListener getCreativeViewListener()
-
addOmFriendlyObstruction
public void addOmFriendlyObstruction(InternalFriendlyObstruction friendlyObstruction)
-
startOmSession
protected void startOmSession(OmAdSessionManager omAdSessionManager, android.view.View view)
-
-