Update summary correctly in Settings dashboard.

Bug: 30490325

SummaryLoader needs DashboardCategory to update summary and it currently
ask for it from DashboardAdapter. But DashboardCategory is not always
available in DashboardAdapter. When SummaryLoader wants to get category
from adapter before adapter is ready, it won't have it, causing summary
to appear blank sometimes.

The fix is to get category from data source directly.

Change-Id: I9d7f676954d1cece42d6e03748ab7aa35357f8b7
This commit is contained in:
Fan Zhang
2016-08-03 14:47:01 -07:00
parent 2b0bd66d5b
commit 011362d9f1
2 changed files with 41 additions and 19 deletions

View File

@@ -15,7 +15,6 @@
*/
package com.android.settings.dashboard;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
@@ -110,21 +109,6 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
return mSuggestions;
}
public Tile getTile(ComponentName component) {
if (mCategories == null) {
return null;
}
for (int i = 0; i < mCategories.size(); i++) {
for (int j = 0; j < mCategories.get(i).tiles.size(); j++) {
Tile tile = mCategories.get(i).tiles.get(j);
if (component.equals(tile.intent.getComponent())) {
return tile;
}
}
}
return null;
}
public void setCategoriesAndSuggestions(List<DashboardCategory> categories,
List<Tile> suggestions) {
mSuggestions = suggestions;