Only bind fast scrollbar when attached if not already bound.

This was overriding the previously bound RecyclerView if multiple
were attached simultaneously. Instead, the appropriate container
(All Apps / Widgets) should bind the active RecyclerView whenever
it changes, with the onAttach serving as a fallback to ensure
the scrollbar has an initial RV to avoid NPEs.

Fix: 234591523
Bug: 235476489
Test: Manually checked All Apps from Launcher and Taskbar, as well
as Widget bottom sheet. Also ran relevant Tapl tests.

Change-Id: I06e27d2f66f9778087711a566817b6806ec7218b
This commit is contained in:
Andy Wickham committed 2022-07-27 21:02:34 +00:00
1 parent a2e9ce3b68
commit 87a9bf7c15
2 files changed
+8 -1

No files matched your search

@@ -174,6 +174,11 @@ public class RecyclerViewFastScroller extends View {
ta.recycle();
}
/** @return whether there is a RecyclerView bound to this scroller. */
public boolean hasRecyclerView() {
return mRv != null;
}
public void setRecyclerView(FastScrollRecyclerView rv, TextView popupView) {
if (mRv != null && mOnScrollListener != null) {
mRv.removeOnScrollListener(mOnScrollListener);