summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-05-07 20:32:31 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-07 20:32:32 +0000
commitea449fa37be0fbaed985c38d73e0e3de3e06b8a6 (patch)
treeb5bb4a382b55b58aeca0b7908474833dc7ec7ca3 /src
parent14706b1e641ef8e307ab9e8df27924c2a3f0cf24 (diff)
parentf50c12788c1ebbd28e9bc45575601540983c6562 (diff)
downloadandroid_packages_apps_Trebuchet-ea449fa37be0fbaed985c38d73e0e3de3e06b8a6.tar.gz
android_packages_apps_Trebuchet-ea449fa37be0fbaed985c38d73e0e3de3e06b8a6.tar.bz2
android_packages_apps_Trebuchet-ea449fa37be0fbaed985c38d73e0e3de3e06b8a6.zip
Merge "Fixing issue where apps were not re-sorted after updating." into ub-launcher3-burnaby
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/AlphabeticalAppsList.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/com/android/launcher3/AlphabeticalAppsList.java b/src/com/android/launcher3/AlphabeticalAppsList.java
index 477c00fe8..e9a52d5a5 100644
--- a/src/com/android/launcher3/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/AlphabeticalAppsList.java
@@ -226,7 +226,6 @@ public class AlphabeticalAppsList {
* Sets the current set of apps.
*/
public void setApps(List<AppInfo> apps) {
- Collections.sort(apps, mAppNameComparator.getComparator());
mApps.clear();
mApps.addAll(apps);
onAppsUpdated();
@@ -241,6 +240,8 @@ public class AlphabeticalAppsList {
for (AppInfo info : apps) {
addApp(info);
}
+ onAppsUpdated();
+ mAdapter.notifyDataSetChanged();
}
/**
@@ -251,12 +252,12 @@ public class AlphabeticalAppsList {
int index = mApps.indexOf(info);
if (index != -1) {
mApps.set(index, info);
- onAppsUpdated();
- mAdapter.notifyItemChanged(index);
} else {
addApp(info);
}
}
+ onAppsUpdated();
+ mAdapter.notifyDataSetChanged();
}
/**
@@ -267,10 +268,10 @@ public class AlphabeticalAppsList {
int removeIndex = findAppByComponent(mApps, info);
if (removeIndex != -1) {
mApps.remove(removeIndex);
- onAppsUpdated();
- mAdapter.notifyDataSetChanged();
}
}
+ onAppsUpdated();
+ mAdapter.notifyDataSetChanged();
}
/**
@@ -290,14 +291,12 @@ public class AlphabeticalAppsList {
}
/**
- * Implementation to actually add an app to the alphabetic list
+ * Implementation to actually add an app to the alphabetic list, but does not notify.
*/
private void addApp(AppInfo info) {
int index = Collections.binarySearch(mApps, info, mAppNameComparator.getComparator());
if (index < 0) {
mApps.add(-(index + 1), info);
- onAppsUpdated();
- mAdapter.notifyDataSetChanged();
}
}
@@ -305,6 +304,9 @@ public class AlphabeticalAppsList {
* Updates internals when the set of apps are updated.
*/
private void onAppsUpdated() {
+ // Sort the list of apps
+ Collections.sort(mApps, mAppNameComparator.getComparator());
+
// Recreate the filtered and sectioned apps (for convenience for the grid layout)
mFilteredApps.clear();
mSections.clear();