#1379·epoxy

Trigger visibility track in onResume for CarouselModel_

Author: vibindas-mCreated May 2, 2024Updated May 2, 2024

I want to re-trigger the onVisibilityStateChanged using CarouselModel_ in EpoxyRecyclerView when the fragment resumes.

ClearVisibilityStates and requestVisibilityCheck are helping to re triggering the onVisibilityStateChanged event for all components except the items inside CarouselModel_

val customModels = ArrayList<EpoxyModel<*>>() customModels.add( CustomEproxyModel_() .id(viewId) .onVisibilityStateChanged { _, _, visibilityState -> if(visibilityState == VisibilityState.VISIBLE) { Log.d("Eproxy", "CustomEproxyModel_ visible") } } ) CarouselModel_() .id(viewId) .spanSizeOverride { totalSpanCount, _, _ -> totalSpanCount }.models(customModels)

detach and attach visibilityTracker is not working for me.

`override fun onPause() { // Detach the visibility tracker from the RecyclerView visibilityTracker.detach(epoxyRecyclerView) super.onPause() }

override fun onResume() { // Attach the visibility tracker to the RecyclerView visibilityTracker.attach(epoxyRecyclerView) super.onResume() } `