diff options
author | Joe Onorato <joeo@android.com> | 2009-10-31 16:32:02 -0400 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-10-31 16:33:17 -0400 |
commit | cb9f79889485e3e1cbea8ba8fda8b7cb6472bb8a (patch) | |
tree | f39192dbf5d4adb64a66fc637bb9b1d313b7cafc /src/com/android/launcher2/AllAppsView.java | |
parent | a1b02556d0073119a24040704c0096160be69f4d (diff) | |
download | android_packages_apps_Trebuchet-cb9f79889485e3e1cbea8ba8fda8b7cb6472bb8a.tar.gz android_packages_apps_Trebuchet-cb9f79889485e3e1cbea8ba8fda8b7cb6472bb8a.tar.bz2 android_packages_apps_Trebuchet-cb9f79889485e3e1cbea8ba8fda8b7cb6472bb8a.zip |
Fix 2199124 - Sometimes app icons don't go away when deleting the app.
The app list isn't sorted by component name, it's sorted by title, so we can't
binary search on the component name. Duh.
Linear search is fine here.
Diffstat (limited to 'src/com/android/launcher2/AllAppsView.java')
-rw-r--r-- | src/com/android/launcher2/AllAppsView.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index a1ce8f607..aea8c80df 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -39,6 +39,7 @@ import android.renderscript.ProgramStore; import android.renderscript.Sampler; import android.renderscript.SimpleMesh; +import android.content.ComponentName; import android.content.Context; import android.content.res.Resources; import android.database.DataSetObserver; @@ -547,7 +548,7 @@ public class AllAppsView extends RSSurfaceView final int N = list.size(); for (int i=0; i<N; i++) { final ApplicationInfo item = list.get(i); - int index = Collections.binarySearch(mAllAppsList, item, mAppIntentComp); + int index = findAppByComponent(mAllAppsList, item); if (index >= 0) { mAllAppsList.remove(index); if (mRollo != null) { @@ -581,11 +582,17 @@ public class AllAppsView extends RSSurfaceView } }; - private Comparator<ApplicationInfo> mAppIntentComp = new Comparator<ApplicationInfo>() { - public int compare(ApplicationInfo a, ApplicationInfo b) { - return a.intent.getComponent().compareTo(b.intent.getComponent()); + private static int findAppByComponent(ArrayList<ApplicationInfo> list, ApplicationInfo item) { + ComponentName component = item.intent.getComponent(); + final int N = list.size(); + for (int i=0; i<N; i++) { + ApplicationInfo x = list.get(i); + if (x.intent.getComponent().equals(component)) { + return i; + } } - }; + return -1; + } private static int countPages(int iconCount) { int iconsPerPage = Defines.COLUMNS_PER_PAGE * Defines.ROWS_PER_PAGE; |