Merge "Only bind fast scrollbar when attached if not already bound." into tm-qpr-dev am: f61e7bb4a2

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/19225719

Change-Id: I8d65be04f468cef2fbab6756bcd3b21cd3f5a224
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Andy Wickham
2022-07-27 22:57:01 +00:00
committed by Automerger Merge Worker
2 changed files with 8 additions and 1 deletions
@@ -57,7 +57,9 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
bindFastScrollbar();
if (mScrollbar == null || !mScrollbar.hasRecyclerView()) {
bindFastScrollbar();
}
}
public void bindFastScrollbar() {
@@ -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);