Change theme
Help
Press space for more information.
Show links for this issue (Shortcut: i, l)
Copy issue ID
Previous Issue (Shortcut: k)
Next Issue (Shortcut: j)
Sign in to use full features.
Vote: I am impacted
Notification menu
Refresh (Shortcut: Shift+r)
Go home (Shortcut: u)
Pending code changes (auto-populated)
View issue level access limits(Press Alt + Right arrow for more information)
Unintended behavior
View staffing
Description
Version used: 1.3.2
Devices/Android versions reproduced on: N/A
Currently, the only way to know when an Adapter is changed is to inherit RecyclerView and override swapAdapter(Adapter, boolean) and setAdapter(Adapter) which both call setAdapterInternal(Adapter, boolean, boolean). It would be very useful to add a new API to observe it externally, similarly to what is done with OnChildAttachStateChangeListener:
public interface OnAdapterChangeListener {
void onAdapterChanged(@Nullable Adapter oldAdapter, @Nullable Adapter newAdapter);
}
public void addOnAdapterChangeListener(@NonNull OnAdapterChangeListener listener) { ... }
public void removeOnAdapterChangeListener(@NonNull OnAdapterChangeListener listener) { ... }
public void clearOnAdapterChangeListeners() { ... }