use of android.service.settings.suggestions.Suggestion in project android_packages_apps_Settings by omnirom.
the class LegacySuggestionContextualCardController method loadSuggestions.
private void loadSuggestions() {
ThreadUtils.postOnBackgroundThread(() -> {
if (mSuggestionController == null || mCardUpdateListener == null) {
return;
}
final List<Suggestion> suggestions = mSuggestionController.getSuggestions();
final String suggestionCount = suggestions == null ? "null" : String.valueOf(suggestions.size());
Log.d(TAG, "Loaded suggests: " + suggestionCount);
final List<ContextualCard> cards = new ArrayList<>();
if (suggestions != null) {
// Convert suggestion to ContextualCard
for (Suggestion suggestion : suggestions) {
final LegacySuggestionContextualCard.Builder cardBuilder = new LegacySuggestionContextualCard.Builder();
if (suggestion.getIcon() != null) {
cardBuilder.setIconDrawable(suggestion.getIcon().loadDrawable(mContext));
}
cardBuilder.setPendingIntent(suggestion.getPendingIntent()).setSuggestion(suggestion).setName(suggestion.getId()).setTitleText(suggestion.getTitle().toString()).setSummaryText(suggestion.getSummary().toString()).setViewType(LegacySuggestionContextualCardRenderer.VIEW_TYPE);
cards.add(cardBuilder.build());
}
}
mSuggestions.clear();
mSuggestions.addAll(cards);
updateAdapter();
});
}
use of android.service.settings.suggestions.Suggestion in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LegacySuggestionContextualCardController method loadSuggestions.
private void loadSuggestions() {
ThreadUtils.postOnBackgroundThread(() -> {
if (mSuggestionController == null || mCardUpdateListener == null) {
return;
}
final List<Suggestion> suggestions = mSuggestionController.getSuggestions();
final String suggestionCount = suggestions == null ? "null" : String.valueOf(suggestions.size());
Log.d(TAG, "Loaded suggests: " + suggestionCount);
final List<ContextualCard> cards = new ArrayList<>();
if (suggestions != null) {
// Convert suggestion to ContextualCard
for (Suggestion suggestion : suggestions) {
final LegacySuggestionContextualCard.Builder cardBuilder = new LegacySuggestionContextualCard.Builder();
if (suggestion.getIcon() != null) {
cardBuilder.setIconDrawable(suggestion.getIcon().loadDrawable(mContext));
}
cardBuilder.setPendingIntent(suggestion.getPendingIntent()).setSuggestion(suggestion).setName(suggestion.getId()).setTitleText(suggestion.getTitle().toString()).setSummaryText(suggestion.getSummary().toString()).setViewType(LegacySuggestionContextualCardRenderer.VIEW_TYPE);
cards.add(cardBuilder.build());
}
}
mSuggestions.clear();
mSuggestions.addAll(cards);
updateAdapter();
});
}
Aggregations