diff options
author | Winson Chung <winsonc@google.com> | 2015-06-12 14:18:55 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2015-06-16 00:55:02 +0000 |
commit | fbc5b18626ae2e158e39c59606455124cfa8127d (patch) | |
tree | aa4ccb95ad93e5cd9143bb4a84713b032d0a0dd5 /src/com/android/launcher3/allapps/AllAppsRecyclerView.java | |
parent | c332934e27527107c7f9c50ba6b7af93979b8126 (diff) | |
download | android_packages_apps_Trebuchet-fbc5b18626ae2e158e39c59606455124cfa8127d.tar.gz android_packages_apps_Trebuchet-fbc5b18626ae2e158e39c59606455124cfa8127d.tar.bz2 android_packages_apps_Trebuchet-fbc5b18626ae2e158e39c59606455124cfa8127d.zip |
Refactored section names to only draw when there is space.
- This CL removes all space for section names in both phones
and tablets. And when there are no section names, the layout
will automatically fully merge the sections.
Bug: 20222023
Change-Id: Ic7c751d86f095e5cbd690bfd4f94bb5b00ff8ae4
Diffstat (limited to 'src/com/android/launcher3/allapps/AllAppsRecyclerView.java')
-rw-r--r-- | src/com/android/launcher3/allapps/AllAppsRecyclerView.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index 25918ce31..ff327dae3 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -39,6 +39,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView private int mNumAppsPerRow; private int mNumPredictedAppsPerRow; private int mPredictionBarHeight; + private int mLastFastscrollPosition = -1; private Launcher mLauncher; @@ -131,6 +132,11 @@ public class AllAppsRecyclerView extends BaseRecyclerView } } + @Override + protected void onFastScrollingEnd() { + mLastFastscrollPosition = -1; + } + /** * Maps the touch (from 0..1) to the adapter position that should be visible. */ @@ -174,12 +180,14 @@ public class AllAppsRecyclerView extends BaseRecyclerView // Scroll to the view at the position, anchored at the top of the screen. We call the scroll // method on the LayoutManager directly since it is not exposed by RecyclerView. - layoutManager.scrollToPositionWithOffset(lastScrollSection.appItem.position, 0); + if (mLastFastscrollPosition != lastScrollSection.appItem.position) { + mLastFastscrollPosition = lastScrollSection.appItem.position; + layoutManager.scrollToPositionWithOffset(lastScrollSection.appItem.position, 0); + } return lastScrollSection.sectionName; } - /** * Returns the row index for a app index in the list. */ |