diff options
author | Matt Garnes <matt@cyngn.com> | 2014-07-01 18:01:58 -0700 |
---|---|---|
committer | Matt Garnes <matt@cyngn.com> | 2014-07-02 09:48:59 -0700 |
commit | 3de1e805afc243c10721fb32c3eeac51e4d0bd33 (patch) | |
tree | 87768f8bc8bf9c11c084dd2f53ea15d79b06b23d /src/com/android/launcher3/Workspace.java | |
parent | ebf8f37515c23a167cef2bb8cff04854c52fd35b (diff) | |
download | android_packages_apps_Trebuchet-3de1e805afc243c10721fb32c3eeac51e4d0bd33.tar.gz android_packages_apps_Trebuchet-3de1e805afc243c10721fb32c3eeac51e4d0bd33.tar.bz2 android_packages_apps_Trebuchet-3de1e805afc243c10721fb32c3eeac51e4d0bd33.zip |
Fix Settings Panel bug causing frozen overview.
Previously, toggling search panel would freeze Overview mode
until the user exited back to the regular launcher. Also, the current
page would be lost. Fix this by computing the new scroll bounds
immediately when the setting is toggled.
Change-Id: Ib3587cfcea61e15b3d8b280113ce986cc57f2f9d
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 7e3584115..9617ace5b 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2261,6 +2261,38 @@ public class Workspace extends SmoothPagedView setImportantForAccessibility(accessible); } + public void updatePageScrollForCustomPage(boolean enabled) { + int diff; + // If multiple PageScrolls have been computed already, + // find the distance between the first and second scroll. + if(mPageScrolls.length > 1) { + diff = mPageScrolls[1] - mPageScrolls[0]; + } else { + // The scroll distance will just be the width of the viewport + diff = getViewportWidth(); + } + + // Create an ArrayList to hold PageScrolls while we work with them + ArrayList<Integer> list = new ArrayList<Integer>(); + for(int i : mPageScrolls) { + list.add(i); + } + + // If custom page is enabled, add another page scroll entry + if(enabled){ + list.add(list.get(list.size() - 1) + diff); + } else { + // disabling custom page, remove the last element + list.remove(list.size() - 1); + } + + // Replace mPageScrolls with the list content + mPageScrolls = new int[list.size()]; + for(int i = 0; i < list.size();i++) { + mPageScrolls[i] = list.get(i); + } + } + Animator getChangeStateAnimation(final State state, boolean animated, int delay, int snapPage) { if (mState == state) { return null; |