public class POBViewabilityTracker
extends java.lang.Object
implements android.view.ViewTreeObserver.OnGlobalLayoutListener, android.view.ViewTreeObserver.OnScrollChangedListener, android.view.ViewTreeObserver.OnWindowFocusChangeListener, android.view.View.OnAttachStateChangeListener
setViewabilityThresholdPercent(float) and notifies it through listener
method. see setOnExposureChangeWithThresholdListener(com.pubmatic.sdk.webrendering.ui.POBViewabilityTracker.OnViewabilityChangedListener)| Modifier and Type | Class and Description |
|---|---|
static interface |
POBViewabilityTracker.OnViewabilityChangedListener
Interface definition for a callback to be invoked when
layout change happens with respect to view and threshold.
|
| Constructor and Description |
|---|
POBViewabilityTracker(android.view.View view)
Constructs exposure tracker for view
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy() |
boolean |
isViewable()
To get view visibility with respect to viewability threshold percent.
|
void |
onGlobalLayout() |
void |
onScrollChanged() |
void |
onViewAttachedToWindow(android.view.View v) |
void |
onViewDetachedFromWindow(android.view.View v) |
void |
onWindowFocusChanged(boolean hasFocus) |
void |
setAllowViewTreeObserverRegistration(boolean allowViewTreeObserverRegistration)
To allow view tree updates, default values is false
|
void |
setOnExposureChangeWithThresholdListener(POBViewabilityTracker.OnViewabilityChangedListener listener)
Property to notify exposure change
|
void |
setViewabilityThresholdPercent(float viewabilityThresholdPercent)
Property on the basis of which tracker decides to notify exposure change
|
public POBViewabilityTracker(@NonNull
android.view.View view)
view - the view on which exposure change is calculated.public void setAllowViewTreeObserverRegistration(boolean allowViewTreeObserverRegistration)
allowViewTreeObserverRegistration - set to true if want register for view tree updates,
else set to falsepublic boolean isViewable()
public void setOnExposureChangeWithThresholdListener(@Nullable
POBViewabilityTracker.OnViewabilityChangedListener listener)
listener - reference of onViewabilityChangedListenerpublic void setViewabilityThresholdPercent(float viewabilityThresholdPercent)
viewabilityThresholdPercent - the view ability percent in floatpublic void onGlobalLayout()
onGlobalLayout in interface android.view.ViewTreeObserver.OnGlobalLayoutListenerpublic void onScrollChanged()
onScrollChanged in interface android.view.ViewTreeObserver.OnScrollChangedListenerpublic void destroy()
public void onWindowFocusChanged(boolean hasFocus)
onWindowFocusChanged in interface android.view.ViewTreeObserver.OnWindowFocusChangeListenerpublic void onViewAttachedToWindow(android.view.View v)
onViewAttachedToWindow in interface android.view.View.OnAttachStateChangeListenerpublic void onViewDetachedFromWindow(android.view.View v)
onViewDetachedFromWindow in interface android.view.View.OnAttachStateChangeListener