summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-10-08 17:43:48 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-10-10 14:17:16 -0700
commit5d9fb0e92f2ef2b25f3aa93c1f89838ccc68aa88 (patch)
tree46764e909a89e51c294ca23b0eed69a481fa9333 /src/com/android/launcher3/allapps/AllAppsRecyclerView.java
parent631ffbda64b92b843f18af6756b52b1ac4c22461 (diff)
downloadandroid_packages_apps_Trebuchet-5d9fb0e92f2ef2b25f3aa93c1f89838ccc68aa88.tar.gz
android_packages_apps_Trebuchet-5d9fb0e92f2ef2b25f3aa93c1f89838ccc68aa88.tar.bz2
android_packages_apps_Trebuchet-5d9fb0e92f2ef2b25f3aa93c1f89838ccc68aa88.zip
Simplifying fast scroller logic
> Using a separate view for drawing the popup. This allows us to use elevation property instead of drawing the shadow as bitmap. > During the thumb animation, invalidating the full track width, instead of invalidating the track and thumb separately. > The thumb path is calculated at 0,0 and drawn using canvas.translate(). This avoids recalculating the path on every scroll. Change-Id: I48741e5b4432df0d939016db284d7aaf52cc2aa6
Diffstat (limited to 'src/com/android/launcher3/allapps/AllAppsRecyclerView.java')
-rw-r--r--src/com/android/launcher3/allapps/AllAppsRecyclerView.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index 0173847e0..5a9ea6bb3 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -299,14 +299,14 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
// Skip early if there are no items or we haven't been measured
if (items.isEmpty() || mNumAppsPerRow == 0) {
- mScrollbar.setThumbOffset(-1, -1);
+ mScrollbar.setThumbOffsetY(-1);
return;
}
// Skip early if, there no child laid out in the container.
int scrollY = getCurrentScrollY();
if (scrollY < 0) {
- mScrollbar.setThumbOffset(-1, -1);
+ mScrollbar.setThumbOffsetY(-1);
return;
}
@@ -314,7 +314,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
int availableScrollBarHeight = getAvailableScrollBarHeight();
int availableScrollHeight = getAvailableScrollHeight();
if (availableScrollHeight <= 0) {
- mScrollbar.setThumbOffset(-1, -1);
+ mScrollbar.setThumbOffsetY(-1);
return;
}
@@ -323,11 +323,10 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
// Calculate the current scroll position, the scrollY of the recycler view accounts
// for the view padding, while the scrollBarY is drawn right up to the background
// padding (ignoring padding)
- int scrollBarX = getScrollBarX();
int scrollBarY = mBackgroundPadding.top +
(int) (((float) scrollY / availableScrollHeight) * availableScrollBarHeight);
- int thumbScrollY = mScrollbar.getThumbOffset().y;
+ int thumbScrollY = mScrollbar.getThumbOffsetY();
int diffScrollY = scrollBarY - thumbScrollY;
if (diffScrollY * dy > 0f) {
// User is scrolling in the same direction the thumb needs to catch up to the
@@ -344,7 +343,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
thumbScrollY += Math.min(offset, diffScrollY);
}
thumbScrollY = Math.max(0, Math.min(availableScrollBarHeight, thumbScrollY));
- mScrollbar.setThumbOffset(scrollBarX, thumbScrollY);
+ mScrollbar.setThumbOffsetY(thumbScrollY);
if (scrollBarY == thumbScrollY) {
mScrollbar.reattachThumbToScroll();
}
@@ -352,7 +351,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
// User is scrolling in an opposite direction to the direction that the thumb
// needs to catch up to the scroll position. Do nothing except for updating
// the scroll bar x to match the thumb width.
- mScrollbar.setThumbOffset(scrollBarX, thumbScrollY);
+ mScrollbar.setThumbOffsetY(thumbScrollY);
}
}
} else {