Merge "Make common base class to update container bounds and to handle scroll logic." into ub-launcher3-burnaby
diff --git a/src/com/android/launcher3/AlphabeticalAppsList.java b/src/com/android/launcher3/AlphabeticalAppsList.java
index 477c00f..e9a52d5 100644
--- a/src/com/android/launcher3/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/AlphabeticalAppsList.java
@@ -226,7 +226,6 @@
* 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 @@
for (AppInfo info : apps) {
addApp(info);
}
+ onAppsUpdated();
+ mAdapter.notifyDataSetChanged();
}
/**
@@ -251,12 +252,12 @@
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 @@
int removeIndex = findAppByComponent(mApps, info);
if (removeIndex != -1) {
mApps.remove(removeIndex);
- onAppsUpdated();
- mAdapter.notifyDataSetChanged();
}
}
+ onAppsUpdated();
+ mAdapter.notifyDataSetChanged();
}
/**
@@ -290,14 +291,12 @@
}
/**
- * 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 @@
* 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();
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 7efdf32..e81c8c2 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -2810,6 +2810,8 @@
} else {
mHandler.post(r);
}
+ loadAndBindWidgetsAndShortcuts(mApp.getContext(), tryGetCallbacks(oldCallbacks),
+ false /* refresh */);
}
private void loadAllApps() {
@@ -2871,8 +2873,6 @@
final Callbacks callbacks = tryGetCallbacks(oldCallbacks);
if (callbacks != null) {
callbacks.bindAllApplications(added);
- loadAndBindWidgetsAndShortcuts(mApp.getContext(), callbacks,
- true /* refresh */);
if (DEBUG_LOADERS) {
Log.d(TAG, "bound " + added.size() + " apps in "
+ (SystemClock.uptimeMillis() - bindTime) + "ms");
@@ -2885,6 +2885,8 @@
// Cleanup any data stored for a deleted user.
ManagedProfileHeuristic.processAllUsers(profiles, mContext);
+ loadAndBindWidgetsAndShortcuts(mApp.getContext(), tryGetCallbacks(oldCallbacks),
+ true /* refresh */);
if (DEBUG_LOADERS) {
Log.d(TAG, "Icons processed in "
+ (SystemClock.uptimeMillis() - loadTime) + "ms");