luizgrp / SectionedRecyclerViewAdapter

An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.
MIT License
1.68k stars 372 forks source link

Support onViewAttachedToWindow on Section #149

Closed yccheok closed 3 years ago

yccheok commented 5 years ago

When a position scrolled from not visible to a visible position, onBindViewHolder will not be called all the time, if the associated view is not recycled yet.

Yet, sometimes, we still need to perform some action when a view just become visible. For instance, requestFocus, to restore back previous EditText focus.

It can also be used to handle situation like this - https://stackoverflow.com/questions/54833004/long-pressed-broken-for-edittext-or-android-support-v7-widget-appcompatedittext/54840825#54840825

Having onViewAttachedToWindow is great. (This can be used as a reasonable signal that the view is about to be seen by the user...)

luizgrp commented 5 years ago

Hi @yccheok, could you please give more details how it would be implemented?