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
diff --git a/src/com/android/launcher3/FastScrollRecyclerView.java b/src/com/android/launcher3/FastScrollRecyclerView.java
index 94903f2..747b755 100644
--- a/src/com/android/launcher3/FastScrollRecyclerView.java
+++ b/src/com/android/launcher3/FastScrollRecyclerView.java
@@ -57,7 +57,9 @@
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
- bindFastScrollbar();
+ if (mScrollbar == null || !mScrollbar.hasRecyclerView()) {
+ bindFastScrollbar();
+ }
}
public void bindFastScrollbar() {