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

This commit is contained in:
Andy Wickham
2022-07-27 22:27:25 +00:00
committed by Android (Google) Code Review
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);