Merge "Make sure the dashboard is up to date"
diff --git a/src/com/android/settings/dashboard/DashboardAdapter.java b/src/com/android/settings/dashboard/DashboardAdapter.java
index e2024f7..6228bbc 100644
--- a/src/com/android/settings/dashboard/DashboardAdapter.java
+++ b/src/com/android/settings/dashboard/DashboardAdapter.java
@@ -72,6 +72,10 @@
setHasStableIds(true);
}
+ public boolean isShowingAll() {
+ return mIsShowingAll;
+ }
+
public void notifyChanged(DashboardTile tile) {
for (int i = 0; i < mItems.size(); i++) {
if (mItems.get(i) == tile) {
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index 8446475..54a5ff4 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -133,6 +133,13 @@
}
long start = System.currentTimeMillis();
+ // TODO: Cache summaries from old categories somehow.
+ List<DashboardCategory> categories =
+ ((SettingsActivity) getActivity()).getDashboardCategories(true);
+ boolean showingAll = mAdapter != null && mAdapter.isShowingAll();
+ mAdapter = new DashboardAdapter(getContext(), categories);
+ mSummaryLoader.setAdapter(mAdapter);
+ mAdapter.setShowingAll(showingAll);
mDashboard.setAdapter(mAdapter);
long delta = System.currentTimeMillis() - start;
diff --git a/src/com/android/settings/dashboard/SummaryLoader.java b/src/com/android/settings/dashboard/SummaryLoader.java
index 4bbee8c..a5481ac 100644
--- a/src/com/android/settings/dashboard/SummaryLoader.java
+++ b/src/com/android/settings/dashboard/SummaryLoader.java
@@ -33,12 +33,13 @@
private static final boolean DEBUG = DashboardSummary.DEBUG;
private static final String TAG = "SummaryLoader";
+ public static final String SUMMARY_PROVIDER_FACTORY = "SUMMARY_PROVIDER_FACTORY";
+
private final Activity mActivity;
- private final DashboardAdapter mAdapter;
private final ArrayMap<SummaryProvider, DashboardTile> mSummaryMap = new ArrayMap<>();
private final List<DashboardTile> mTiles = new ArrayList<>();
- public static final String SUMMARY_PROVIDER_FACTORY = "SUMMARY_PROVIDER_FACTORY";
+ private DashboardAdapter mAdapter;
public SummaryLoader(Activity activity, DashboardAdapter adapter,
List<DashboardCategory> categories) {
@@ -56,6 +57,10 @@
}
}
+ public void setAdapter(DashboardAdapter adapter) {
+ mAdapter = adapter;
+ }
+
public void setSummary(SummaryProvider provider, CharSequence summary) {
DashboardTile tile = mSummaryMap.get(provider);
tile.summary = summary;