question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improvement: Add method to IFlexible/AbstractFlexibleItem which is invoked by the adapter when RecyclerView.Adapter.onViewAttachedToWindow() is called

See original GitHub issue

When RecyclerView.Adapter.onViewAttachedToWindow() is invoked, it’s guaranteed that the view was actually attached to the Window and most likely shown to the user. And correspondingly when onViewDetachedFromWindow() we know for sure that the user can no longer see the View.

There are some cases where we want to take action for individual items when these events happen - (e.g) stop playing GIFs/videos so that they don’t continue playing unnecessarily while the View is offscreen (this happens when using Glide).

Could you please add some callbacks to IFlexible that are called when these adapter methods are called?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sandeep-voxercommented, Dec 7, 2017

Yes, audio/video/GIFs or any dynamic content whose state needs to be changed based on when they are actually become visible/invisible to the user.

On Dec 7, 2017 15:34, “Davide Steduto” notifications@github.com wrote:

If I understood well, you will use this callbacks only for audio/video, so they can be stopped if not visible, for images, they can stay in the view until unbound.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/davideas/FlexibleAdapter/issues/506#issuecomment-350127712, or mute the thread https://github.com/notifications/unsubscribe-auth/AcisBKVYy4NxvAabGp-Jh5u0K1uBdetnks5s-HYLgaJpZM4Q4ad3 .

0reactions
sandeep-voxercommented, Dec 8, 2017

Awesome, thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

RecyclerView.Adapter - Android Developers
This method internally calls onBindViewHolder to update the ViewHolder contents with the item at the given position and also sets up some ...
Read more >
Using the RecyclerView | CodePath Android Cliffnotes
The RecyclerView is a ViewGroup that renders any adapter-based view in a similar way. It is supposed to be the successor of ListView...
Read more >
RecyclerView.Adapter onViewDetachedFromWindow never ...
Only onViewAttachedToWindow is called when the activity is entered and i can see my items. My adapter looks like this: public class Adapter...
Read more >
Android Fundamentals: Working with the RecyclerView ...
onCreateViewHolder(ViewGroup, int). This method is called right when the adapter is created and is used to initialize your ViewHolder(s).
Read more >
Look Deep Into ViewPager2 - ProAndroidDev
In the Constructor method in VP2, there is a method called initialize(). ... Let's create an adapter, it has the same usage as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found