Bug 2290800 - Use a collator to sort the app labels.

SHAME ON ME for using String.compareTo().
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java
index 9b521b9..fe8ded1 100644
--- a/src/com/android/launcher2/AllAppsView.java
+++ b/src/com/android/launcher2/AllAppsView.java
@@ -676,7 +676,8 @@
 
         for (int i=0; i<N; i++) {
             final ApplicationInfo item = list.get(i);
-            int index = Collections.binarySearch(mAllAppsList, item, mAppNameComp);
+            int index = Collections.binarySearch(mAllAppsList, item,
+                    LauncherModel.APP_NAME_COMPARATOR);
             if (index < 0) {
                 index = -(index+1);
             }
@@ -725,16 +726,6 @@
         addApps(list);
     }
 
-    private Comparator<ApplicationInfo> mAppNameComp = new Comparator<ApplicationInfo>() {
-        public int compare(ApplicationInfo a, ApplicationInfo b) {
-            int result = a.title.toString().compareTo(b.toString());
-            if (result != 0) {
-                return result;
-            }
-            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();
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index d9017da..97fa554 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -963,8 +963,8 @@
                             // This builds the icon bitmaps.
                             mAllAppsList.add(AppInfoCache.cache(apps.get(i), context, bubble));
                         }
-                        Collections.sort(mAllAppsList.data, sComparator);
-                        Collections.sort(mAllAppsList.added, sComparator);
+                        Collections.sort(mAllAppsList.data, APP_NAME_COMPARATOR);
+                        Collections.sort(mAllAppsList.added, APP_NAME_COMPARATOR);
                         if (DEBUG_LOADERS) {
                             Log.d(TAG, "cached app icons in "
                                     + (SystemClock.uptimeMillis()-t) + "ms");
@@ -1220,7 +1220,7 @@
     }
 
     private static final Collator sCollator = Collator.getInstance();
-    private static final Comparator<ApplicationInfo> sComparator
+    public static final Comparator<ApplicationInfo> APP_NAME_COMPARATOR
             = new Comparator<ApplicationInfo>() {
         public final int compare(ApplicationInfo a, ApplicationInfo b) {
             return sCollator.compare(a.title.toString(), b.title.toString());