diff options
author | Tony <twickham@google.com> | 2018-12-21 11:58:04 -0800 |
---|---|---|
committer | Tony <twickham@google.com> | 2018-12-21 12:21:53 -0800 |
commit | f80e893163bc0c786b06282a12ed41b75e34f8d4 (patch) | |
tree | 7d82631ee2698aac2214021b069feefceb00c0fa /src/com/android/launcher3/LauncherModel.java | |
parent | a7a9583bb8ffbee7a760c7e6ab8c99f63dddd145 (diff) | |
download | packages_apps_Trebuchet-f80e893163bc0c786b06282a12ed41b75e34f8d4.tar.gz packages_apps_Trebuchet-f80e893163bc0c786b06282a12ed41b75e34f8d4.tar.bz2 packages_apps_Trebuchet-f80e893163bc0c786b06282a12ed41b75e34f8d4.zip |
When undoing a removal, always return to the page it came from
We were already returning to the current page, but this wasn't
always right, e.g. when removing the last item on the last page.
So now we mark the page the item was removed from, and bind that
page first when undo is clicked.
This also addresses an issue where we incorrectly returned to the
first page if currentPage = INVALID_RESTORE_PAGE, which happens if
there are no items on the first page.
Bug: 118846684
Change-Id: I4ec1f64b24ba1cc308ce08bfb3111b5981fae99b
Diffstat (limited to 'src/com/android/launcher3/LauncherModel.java')
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 9b4c5fd09..ebca2eaf4 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -142,7 +142,7 @@ public class LauncherModel extends BroadcastReceiver public void bindItems(List<ItemInfo> shortcuts, boolean forceAnimateIcons); public void bindScreens(IntArray orderedScreenIds); public void finishFirstPageBind(ViewOnDrawExecutor executor); - public void finishBindingItems(int currentScreen); + public void finishBindingItems(int pageBoundFirst); public void bindAllApplications(ArrayList<AppInfo> apps); public void bindAppsAddedOrUpdated(ArrayList<AppInfo> apps); public void preAddApps(); @@ -372,11 +372,16 @@ public class LauncherModel extends BroadcastReceiver } } + public void forceReload() { + forceReload(-1); + } + /** * Reloads the workspace items from the DB and re-binds the workspace. This should generally * not be called as DB updates are automatically followed by UI update + * @param synchronousBindPage The page to bind first. Can pass -1 to use the current page. */ - public void forceReload() { + public void forceReload(int synchronousBindPage) { synchronized (mLock) { // Stop any existing loaders first, so they don't set mModelLoaded to true later stopLoader(); @@ -387,7 +392,10 @@ public class LauncherModel extends BroadcastReceiver // the next time launcher starts Callbacks callbacks = getCallback(); if (callbacks != null) { - startLoader(callbacks.getCurrentWorkspaceScreen()); + if (synchronousBindPage < 0) { + synchronousBindPage = callbacks.getCurrentWorkspaceScreen(); + } + startLoader(synchronousBindPage); } } |