diff options
author | Winson <winsonc@google.com> | 2016-07-12 14:10:50 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2016-07-13 01:04:56 +0000 |
commit | e8eaa9c94c5bfb9f103b486b24213e7dd86e8429 (patch) | |
tree | 8945f666232551837b5570d0f0c5b6857f9eb198 /src/com/android/launcher3/BaseRecyclerView.java | |
parent | b029e9fd666263d3954387e3d96d67f377c23f8b (diff) | |
download | android_packages_apps_Trebuchet-e8eaa9c94c5bfb9f103b486b24213e7dd86e8429.tar.gz android_packages_apps_Trebuchet-e8eaa9c94c5bfb9f103b486b24213e7dd86e8429.tar.bz2 android_packages_apps_Trebuchet-e8eaa9c94c5bfb9f103b486b24213e7dd86e8429.zip |
Ensuring that fast scrolling to predictions scrolls list to the top
- Fixes a long standing issue with fast-scrolling to the predicted apps
not quite scrolling the list to the top of the screen.
- Fixes an issue where we don’t scroll exactly to the fast scroll
position due to rounding
- Also fixes a small issue where the thumb would not update when the
fast scroll popup was no longer showing, even while dragging.
Bug: 30023608
Change-Id: I6b5080c6aea521ff03dca24317f0405c02725061
Diffstat (limited to 'src/com/android/launcher3/BaseRecyclerView.java')
-rw-r--r-- | src/com/android/launcher3/BaseRecyclerView.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/launcher3/BaseRecyclerView.java b/src/com/android/launcher3/BaseRecyclerView.java index 8bd5eba00..401b699f1 100644 --- a/src/com/android/launcher3/BaseRecyclerView.java +++ b/src/com/android/launcher3/BaseRecyclerView.java @@ -246,13 +246,18 @@ public abstract class BaseRecyclerView extends RecyclerView (int) (((float) scrollY / availableScrollHeight) * availableScrollBarHeight); // Calculate the position and size of the scroll bar - int scrollBarX; + mScrollbar.setThumbOffset(getScrollBarX(), scrollBarY); + } + + /** + * @return the x position for the scrollbar thumb + */ + protected int getScrollBarX() { if (Utilities.isRtl(getResources())) { - scrollBarX = mBackgroundPadding.left; + return mBackgroundPadding.left; } else { - scrollBarX = getWidth() - mBackgroundPadding.right - mScrollbar.getThumbWidth(); + return getWidth() - mBackgroundPadding.right - mScrollbar.getThumbWidth(); } - mScrollbar.setThumbOffset(scrollBarX, scrollBarY); } /** |