Merge "Remove check to limit suggestions to 2"
This commit is contained in:
committed by
Android (Google) Code Review
commit
c08dcbd700
@@ -41,7 +41,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class DashboardData {
|
public class DashboardData {
|
||||||
public static final int POSITION_NOT_FOUND = -1;
|
public static final int POSITION_NOT_FOUND = -1;
|
||||||
public static final int MAX_SUGGESTION_COUNT = 2;
|
|
||||||
|
|
||||||
// stable id for different type of items.
|
// stable id for different type of items.
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -185,7 +184,7 @@ public class DashboardData {
|
|||||||
final List<ConditionalCard> conditions = mConditions;
|
final List<ConditionalCard> conditions = mConditions;
|
||||||
final boolean hasConditions = sizeOf(conditions) > 0;
|
final boolean hasConditions = sizeOf(conditions) > 0;
|
||||||
|
|
||||||
final List<Suggestion> suggestions = getSuggestionsToShow(mSuggestions);
|
final List<Suggestion> suggestions = mSuggestions;
|
||||||
final boolean hasSuggestions = sizeOf(suggestions) > 0;
|
final boolean hasSuggestions = sizeOf(suggestions) > 0;
|
||||||
|
|
||||||
/* Suggestion container. This is the card view that contains the list of suggestions.
|
/* Suggestion container. This is the card view that contains the list of suggestions.
|
||||||
@@ -225,20 +224,6 @@ public class DashboardData {
|
|||||||
return list == null ? 0 : list.size();
|
return list == null ? 0 : list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Suggestion> getSuggestionsToShow(List<Suggestion> suggestions) {
|
|
||||||
if (suggestions == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (suggestions.size() <= MAX_SUGGESTION_COUNT) {
|
|
||||||
return suggestions;
|
|
||||||
}
|
|
||||||
final List<Suggestion> suggestionsToShow = new ArrayList<>(MAX_SUGGESTION_COUNT);
|
|
||||||
for (int i = 0; i < MAX_SUGGESTION_COUNT; i++) {
|
|
||||||
suggestionsToShow.add(suggestions.get(i));
|
|
||||||
}
|
|
||||||
return suggestionsToShow;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder used to build the ItemsData
|
* Builder used to build the ItemsData
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user