Make sure the dashboard is up to date
Bug: 25794089 Change-Id: I65eaa8e14b3c998ec122eaa9fc4dbbe3749c568c
This commit is contained in:
@@ -72,6 +72,10 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
|||||||
setHasStableIds(true);
|
setHasStableIds(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowingAll() {
|
||||||
|
return mIsShowingAll;
|
||||||
|
}
|
||||||
|
|
||||||
public void notifyChanged(DashboardTile tile) {
|
public void notifyChanged(DashboardTile tile) {
|
||||||
for (int i = 0; i < mItems.size(); i++) {
|
for (int i = 0; i < mItems.size(); i++) {
|
||||||
if (mItems.get(i) == tile) {
|
if (mItems.get(i) == tile) {
|
||||||
|
@@ -133,6 +133,13 @@ public class DashboardSummary extends InstrumentedFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
long start = System.currentTimeMillis();
|
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);
|
mDashboard.setAdapter(mAdapter);
|
||||||
|
|
||||||
long delta = System.currentTimeMillis() - start;
|
long delta = System.currentTimeMillis() - start;
|
||||||
|
@@ -33,12 +33,13 @@ public class SummaryLoader {
|
|||||||
private static final boolean DEBUG = DashboardSummary.DEBUG;
|
private static final boolean DEBUG = DashboardSummary.DEBUG;
|
||||||
private static final String TAG = "SummaryLoader";
|
private static final String TAG = "SummaryLoader";
|
||||||
|
|
||||||
|
public static final String SUMMARY_PROVIDER_FACTORY = "SUMMARY_PROVIDER_FACTORY";
|
||||||
|
|
||||||
private final Activity mActivity;
|
private final Activity mActivity;
|
||||||
private final DashboardAdapter mAdapter;
|
|
||||||
private final ArrayMap<SummaryProvider, DashboardTile> mSummaryMap = new ArrayMap<>();
|
private final ArrayMap<SummaryProvider, DashboardTile> mSummaryMap = new ArrayMap<>();
|
||||||
private final List<DashboardTile> mTiles = new ArrayList<>();
|
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,
|
public SummaryLoader(Activity activity, DashboardAdapter adapter,
|
||||||
List<DashboardCategory> categories) {
|
List<DashboardCategory> categories) {
|
||||||
@@ -56,6 +57,10 @@ public class SummaryLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAdapter(DashboardAdapter adapter) {
|
||||||
|
mAdapter = adapter;
|
||||||
|
}
|
||||||
|
|
||||||
public void setSummary(SummaryProvider provider, CharSequence summary) {
|
public void setSummary(SummaryProvider provider, CharSequence summary) {
|
||||||
DashboardTile tile = mSummaryMap.get(provider);
|
DashboardTile tile = mSummaryMap.get(provider);
|
||||||
tile.summary = summary;
|
tile.summary = summary;
|
||||||
|
Reference in New Issue
Block a user