class EpoxyVisibilityTracker
A simple way to track visibility events on com.airbnb.epoxy.EpoxyModel.
EpoxyVisibilityTracker works with any androidx.recyclerview.widget.RecyclerView backed by an Epoxy controller. Once attached the events will be forwarded to the Epoxy model (or to the Epoxy view when using annotations).
Note that support for visibility events on an EpoxyModelGroup is somewhat limited. Only model additions will receive visibility events. Models that are removed from the group will not receive events (e.g. VisibilityState.INVISIBLE) because the model group does not keep a reference, nor does it get notified of model removals.
See Also
OnModelVisibilityChangedListener
OnModelVisibilityStateChangedListener
EpoxyVisibilityTracker()
A simple way to track visibility events on com.airbnb.epoxy.EpoxyModel. |
var onChangedEnabled: Boolean
Enable or disable visibility changed event. Default is |
|
var partialImpressionThresholdPercentage: Int?
Set the threshold of percentage visible area to identify the partial impression view state. |
fun attach(recyclerView: RecyclerView): Unit
Attach the tracker. |
|
fun clearVisibilityStates(): Unit
The tracker is storing visibility states internally and is using if to send events, only the difference is sent. Use this method to clear the states and thus regenerate the visibility events. This may be useful when you change the adapter on the RecyclerView. |
|
fun detach(recyclerView: RecyclerView): Unit
Detach the tracker |
|
fun requestVisibilityCheck(): Unit
Calling this method will make the visibility tracking check and trigger events if necessary. It is particularly useful when the visibility of an Epoxy model is changed outside of an Epoxy RecyclerView. |
const val DEBUG_LOG: Boolean |