Package com.pubmatic.sdk.webrendering.ui
Class POBViewabilityTracker
-
- All Implemented Interfaces:
-
android.view.View.OnAttachStateChangeListener,android.view.ViewTreeObserver.OnGlobalLayoutListener,android.view.ViewTreeObserver.OnScrollChangedListener,android.view.ViewTreeObserver.OnWindowFocusChangeListener
public class POBViewabilityTracker implements ViewTreeObserver.OnGlobalLayoutListener, ViewTreeObserver.OnScrollChangedListener, ViewTreeObserver.OnWindowFocusChangeListener, View.OnAttachStateChangeListener
Viewability tracker to track view view ability. Responsible to track view ability update of the view on the basis of threshold and notifies it through listener method. see setOnExposureChangeWithThresholdListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfacePOBViewabilityTracker.OnViewabilityChangedListenerInterface definition for a callback to be invoked when layout change happens with respect to view and threshold.
-
Field Summary
Fields Modifier and Type Field Description public booleanisViewable
-
Constructor Summary
Constructors Constructor Description POBViewabilityTracker(View view)Constructs exposure tracker for view POBViewabilityTracker(View view, float viewabilityThresholdPercent)Constructs exposure tracker for view with given threshold percentage POBViewabilityTracker(View view, int viewabilityThresholdPixelCount)Constructs exposure tracker for view with given threshold pixel count
-
Method Summary
Modifier and Type Method Description booleanisViewable()To get view visibility with respect to viewability threshold percent. voidsetOnExposureChangeWithThresholdListener(@Nullable() POBViewabilityTracker.OnViewabilityChangedListener listener)Property to notify exposure change voidonGlobalLayout()voidonScrollChanged()voiddestroy()voidonWindowFocusChanged(boolean hasFocus)voidonViewAttachedToWindow(View v)voidonViewDetachedFromWindow(View v)voidsetAllowViewTreeObserverRegistration(boolean allowViewTreeObserverRegistration)To allow view tree updates, default values is false -
-
Constructor Detail
-
POBViewabilityTracker
POBViewabilityTracker(View view)
Constructs exposure tracker for view- Parameters:
view- the view on which exposure change is calculated.
-
POBViewabilityTracker
POBViewabilityTracker(View view, float viewabilityThresholdPercent)
Constructs exposure tracker for view with given threshold percentage- Parameters:
view- the view on which exposure change is calculated.viewabilityThresholdPercent- the view ability percent
-
POBViewabilityTracker
POBViewabilityTracker(View view, int viewabilityThresholdPixelCount)
Constructs exposure tracker for view with given threshold pixel count- Parameters:
view- the view on which exposure change is calculated.viewabilityThresholdPixelCount- the view ability pixel count
-
-
Method Detail
-
isViewable
boolean isViewable()
To get view visibility with respect to viewability threshold percent.
- Returns:
True if the view is visible w.r.t. view ability threshold percent, else return false
-
setOnExposureChangeWithThresholdListener
void setOnExposureChangeWithThresholdListener(@Nullable() POBViewabilityTracker.OnViewabilityChangedListener listener)
Property to notify exposure change
- Parameters:
listener- reference of onViewabilityChangedListener
-
onGlobalLayout
void onGlobalLayout()
-
onScrollChanged
void onScrollChanged()
-
destroy
void destroy()
-
onWindowFocusChanged
void onWindowFocusChanged(boolean hasFocus)
-
onViewAttachedToWindow
void onViewAttachedToWindow(View v)
-
onViewDetachedFromWindow
void onViewDetachedFromWindow(View v)
-
setAllowViewTreeObserverRegistration
void setAllowViewTreeObserverRegistration(boolean allowViewTreeObserverRegistration)
To allow view tree updates, default values is false
- Parameters:
allowViewTreeObserverRegistration- set to true if want register for view tree updates, else set to false
-
-
-
-