airbnb / epoxy

Epoxy is an Android library for building complex screens in a RecyclerView
https://goo.gl/eIK82p
Apache License 2.0
8.5k stars 733 forks source link

ViewPager like carousel view position #719

Closed salexwm closed 5 years ago

salexwm commented 5 years ago

CarouselModel works wonderfully and hosts models which almost full width of the screen. Is there a way to know which model is currently fully displayed ? I tried visibility callbacks but it seems they are not getting called.

ApplicationFrameHost_2019-04-01_20-43-21

both are carousels and scrolling horizontally, and host rv scrolling also scrolling vertically question is how to know which model is "selected" in top carousel

elihart commented 5 years ago

The normal layout manager methods to check displayed items should be able to tell you this I believe

salexwm commented 5 years ago

@elihart yes vertical getPosition(View) works fine, but how to get carousel layout manager which is inside another rv ?

elihart commented 5 years ago

you just need access to the nested recyclerview object - which is easy in some cases but not others, it depends where you need to query this from.

regardless the visibility callbacks should be the better option, and nested carousels should be supported as of https://github.com/airbnb/epoxy/commit/c6945f6862ae96745b137929c97d69ba4a356803

are you on the latest version? can you make sure you have that set up correctly and try that approach again? if it still doesn't work can you debug it to figure out why not?

salexwm commented 5 years ago

i'm using 2.19, project still didn't migrate to androidx, the issue here actions (button) are not inside the top carousel and the second carousel is actions, and its the same for all top models, only positions is different

will update to 3.3.0