Fix improper dismiss of suggestion.
- when handling dismiss of suggestion card, need to check if the dismissed suggestion can actually be removed from the current suggestion list before trying to refresh the list. Change-Id: Ia07b4cb76ef6c61a7d27184c3cba9d99fcc90bb3 Fixes: 76094746 Test: RunSettingsRoboTests
This commit is contained in:
@@ -146,15 +146,14 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
||||
@Override
|
||||
public void onSuggestionClosed(Suggestion suggestion) {
|
||||
final List<Suggestion> list = mDashboardData.getSuggestions();
|
||||
if (list == null || list.size() == 0) {
|
||||
if (list == null || list.size() == 0 || !list.remove(suggestion)) {
|
||||
return;
|
||||
}
|
||||
if (list.size() == 1) {
|
||||
if (list.isEmpty()) {
|
||||
// The only suggestion is dismissed, and the the empty suggestion container will
|
||||
// remain as the dashboard item. Need to refresh the dashboard list.
|
||||
setSuggestions(null);
|
||||
} else {
|
||||
list.remove(suggestion);
|
||||
setSuggestions(list);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user