diff options
author | Winson Chung <winsonc@google.com> | 2012-06-21 14:29:52 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-06-21 14:29:52 -0700 |
commit | acb5f99c64c24421cdaca1474f83871f9a2ba33c (patch) | |
tree | 3094f7b7856e4fa90c9b405f654e942a1462152e /src/com/android/launcher2/AppsCustomizePagedView.java | |
parent | b21f7cf20ef0d37a934df2622cc1596c13a4a723 (diff) | |
parent | cd81073eac537e9f85eeee14588d513ea8a56e17 (diff) | |
download | android_packages_apps_Trebuchet-acb5f99c64c24421cdaca1474f83871f9a2ba33c.tar.gz android_packages_apps_Trebuchet-acb5f99c64c24421cdaca1474f83871f9a2ba33c.tar.bz2 android_packages_apps_Trebuchet-acb5f99c64c24421cdaca1474f83871f9a2ba33c.zip |
Merge "Decoupling launcher/workspace package cleanup from the application list (Bug 6602756)"
Diffstat (limited to 'src/com/android/launcher2/AppsCustomizePagedView.java')
-rw-r--r-- | src/com/android/launcher2/AppsCustomizePagedView.java | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java index 547080ab0..d7bb4380c 100644 --- a/src/com/android/launcher2/AppsCustomizePagedView.java +++ b/src/com/android/launcher2/AppsCustomizePagedView.java @@ -230,7 +230,7 @@ class RectCache extends WeakReferenceThreadLocal<Rect> { * The Apps/Customize page that displays all the applications, widgets, and shortcuts. */ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implements - AllAppsView, View.OnClickListener, View.OnKeyListener, DragSource, + View.OnClickListener, View.OnKeyListener, DragSource, PagedViewIcon.PressedCallback, PagedViewWidget.ShortPressListener, LauncherTransitionable { static final String TAG = "AppsCustomizePagedView"; @@ -1667,23 +1667,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen /* * AllAppsView implementation */ - @Override public void setup(Launcher launcher, DragController dragController) { mLauncher = launcher; mDragController = dragController; } - @Override - public void zoom(float zoom, boolean animate) { - // TODO-APPS_CUSTOMIZE: Call back to mLauncher.zoomed() - } - @Override - public boolean isVisible() { - return (getVisibility() == VISIBLE); - } - @Override - public boolean isAnimating() { - return false; - } /** * We should call thise method whenever the core data changes (mApps, mWidgets) so that we can @@ -1702,7 +1689,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } } - @Override public void setApps(ArrayList<ApplicationInfo> list) { mApps = list; Collections.sort(mApps, LauncherModel.APP_NAME_COMPARATOR); @@ -1720,7 +1706,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } } } - @Override public void addApps(ArrayList<ApplicationInfo> list) { addAppsWithoutInvalidate(list); updatePageCounts(); @@ -1737,6 +1722,16 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } return -1; } + private int findAppByPackage(List<ApplicationInfo> list, String packageName) { + int length = list.size(); + for (int i = 0; i < length; ++i) { + ApplicationInfo info = list.get(i); + if (ItemInfo.getPackageName(info.intent).equals(packageName)) { + return i; + } + } + return -1; + } private void removeAppsWithoutInvalidate(ArrayList<ApplicationInfo> list) { // loop through all the apps and remove apps that have the same component int length = list.size(); @@ -1748,13 +1743,21 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } } } - @Override - public void removeApps(ArrayList<ApplicationInfo> list) { - removeAppsWithoutInvalidate(list); + private void removeAppsWithPackageNameWithoutInvalidate(ArrayList<String> packageNames) { + // loop through all the package names and remove apps that have the same package name + for (String pn : packageNames) { + int removeIndex = findAppByPackage(mApps, pn); + while (removeIndex > -1) { + mApps.remove(removeIndex); + removeIndex = findAppByPackage(mApps, pn); + } + } + } + public void removeApps(ArrayList<String> packageNames) { + removeAppsWithPackageNameWithoutInvalidate(packageNames); updatePageCounts(); invalidateOnDataChange(); } - @Override public void updateApps(ArrayList<ApplicationInfo> list) { // We remove and re-add the updated applications list because it's properties may have // changed (ie. the title), and this will ensure that the items will be in their proper @@ -1765,7 +1768,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen invalidateOnDataChange(); } - @Override public void reset() { // If we have reset, then we should not continue to restore the previous state mSaveInstanceStateItemIndex = -1; @@ -1787,7 +1789,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen return (AppsCustomizeTabHost) mLauncher.findViewById(R.id.apps_customize_pane); } - @Override public void dumpState() { // TODO: Dump information related to current list of Applications, Widgets, etc. ApplicationInfo.dumpApplicationInfoList(TAG, "mApps", mApps); @@ -1812,7 +1813,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen } } - @Override public void surrender() { // TODO: If we are in the middle of any process (ie. for holographic outlines, etc) we // should stop this now. |