Simplifying some scrollbar binding logic in all-apps

Bug: 256684299
Test: Manual
Change-Id: I1cee6cb783f0f805d9a0f0a4b2b668a709cacf1a
This commit is contained in:
Sunny Goyal committed 2023-02-17 12:28:46 -08:00
1 parent 192e7afc3c
commit 4d18ad4825
5 files changed
+24 -41

No files matched your search

@@ -171,12 +171,14 @@ public class RecyclerViewFastScroller extends View {
ta.recycle();
}
/** @return whether there is a RecyclerView bound to this scroller. */
public boolean hasRecyclerView() {
return mRv != null;
/** Sets the popup view to show while the scroller is being dragged */
public void setPopupView(TextView popupView) {
mPopupView = popupView;
mPopupView.setBackground(
new FastScrollThumbDrawable(mThumbPaint, Utilities.isRtl(getResources())));
}
public void setRecyclerView(FastScrollRecyclerView rv, TextView popupView) {
public void setRecyclerView(FastScrollRecyclerView rv) {
if (mRv != null && mOnScrollListener != null) {
mRv.removeOnScrollListener(mOnScrollListener);
}
@@ -194,10 +196,6 @@ public class RecyclerViewFastScroller extends View {
mRv.onUpdateScrollbar(dy);
}
});
mPopupView = popupView;
mPopupView.setBackground(
new FastScrollThumbDrawable(mThumbPaint, Utilities.isRtl(getResources())));
}
public void reattachThumbToScroll() {
@@ -331,7 +329,7 @@ public class RecyclerViewFastScroller extends View {
}
public void onDraw(Canvas canvas) {
if (mThumbOffsetY < 0) {
if (mThumbOffsetY < 0 || mRv == null) {
return;
}
int saveCount = canvas.save();