To fix https://github.com/airbnb/epoxy/issues/1343, I believe a new callback that reports the latest visibility state(s) for that EpoxyVisibilityItem should be introduced. Without this aggregate information, client will need to somehow batch the VisibilityState by themselves for 1 vi.update cycle. To avoid object allocation, instead of using data class AggregateVisibilityState I just expose the properties from EpoxyVisibilityItem as read-only.
Alternatively to fix https://github.com/airbnb/epoxy/issues/1343, we could change the ordering of VisibilityState emission on onVisibilityStateChanged. Please let me know if that's preferred.
Test
I have included comparing the aggregate visibility state in EpoxyVisibilityStateTrackerTest.
To fix https://github.com/airbnb/epoxy/issues/1343, I believe a new callback that reports the latest visibility state(s) for that
EpoxyVisibilityItem
should be introduced. Without this aggregate information, client will need to somehow batch theVisibilityState
by themselves for 1vi.update
cycle. To avoid object allocation, instead of usingdata class AggregateVisibilityState
I just expose the properties fromEpoxyVisibilityItem
as read-only.Alternatively to fix https://github.com/airbnb/epoxy/issues/1343, we could change the ordering of
VisibilityState
emission ononVisibilityStateChanged
. Please let me know if that's preferred.Test
I have included comparing the aggregate visibility state in
EpoxyVisibilityStateTrackerTest
.