diff options
author | Winson Chung <winsonc@google.com> | 2013-10-11 15:55:37 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2013-10-11 15:55:37 -0700 |
commit | 964df6b93e8171a0d3a6f212fed095065f1a65dd (patch) | |
tree | 1546d4057502818392104a30b643c4b50e30030f /src/com/android/launcher3/Workspace.java | |
parent | f7d458543e64307b01de803d2ddfee2f21b0bd28 (diff) | |
download | android_packages_apps_Trebuchet-964df6b93e8171a0d3a6f212fed095065f1a65dd.tar.gz android_packages_apps_Trebuchet-964df6b93e8171a0d3a6f212fed095065f1a65dd.tar.bz2 android_packages_apps_Trebuchet-964df6b93e8171a0d3a6f212fed095065f1a65dd.zip |
Fixing issue where the PagedView scroll is out of sync with the current page. (Bug 11050528)
Change-Id: I9c445d862763b2a77847cc3bff994f6ba9af8cc4
Diffstat (limited to 'src/com/android/launcher3/Workspace.java')
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 66d441056..ca684dff6 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -441,6 +441,13 @@ public class Workspace extends SmoothPagedView setLayoutTransition(mLayoutTransition); } + void enableLayoutTransitions() { + setLayoutTransition(mLayoutTransition); + } + void disableLayoutTransitions() { + setLayoutTransition(null); + } + @Override protected int getScrollMode() { return SmoothPagedView.X_LARGE_MODE; @@ -488,10 +495,24 @@ public class Workspace extends SmoothPagedView } public void removeAllWorkspaceScreens() { + // Disable all layout transitions before removing all pages to ensure that we don't get the + // transition animations competing with us changing the scroll when we add pages or the + // custom content screen + disableLayoutTransitions(); + + // Since we increment the current page when we call addCustomContentPage via bindScreens + // (and other places), we need to adjust the current page back when we clear the pages + if (hasCustomContent()) { + removeCustomContentPage(); + } + // Remove the pages and clear the screen models removeAllViews(); mScreenOrder.clear(); mWorkspaceScreens.clear(); + + // Re-enable the layout transitions + enableLayoutTransitions(); } public long insertNewWorkspaceScreenBeforeEmptyScreen(long screenId) { @@ -1821,7 +1842,7 @@ public class Workspace extends SmoothPagedView super.onStartReordering(); showOutlines(); // Reordering handles its own animations, disable the automatic ones. - setLayoutTransition(null); + disableLayoutTransitions(); } protected void onEndReordering() { @@ -1838,7 +1859,7 @@ public class Workspace extends SmoothPagedView mLauncher.getModel().updateWorkspaceScreenOrder(mLauncher, mScreenOrder); // Re-enable auto layout transitions for page deletion. - setLayoutTransition(mLayoutTransition); + enableLayoutTransitions(); } public boolean isInOverviewMode() { |