Swipe to dismiss suggestions

- Move dismiss suggestion logic into feature provider
- In DashboardData, use hashcode as suggestion's stable id. This is much
  more likely to provide a truely stable id for each suggestion card.
  Eventually I want to use hash for all tiles to provide stable id.
- Add a SuggestionDismissionController to handle swipe to dismiss
  callbacks

Change-Id: If3770f07a90c5469a0b86fc28f3eb5e4c17227cd
Fix: 35159816
Test: make RunSettingsRoboTests
This commit is contained in:
Fan Zhang
2017-02-22 16:41:38 -08:00
parent 5e2545c3e6
commit a5b620e738
11 changed files with 398 additions and 100 deletions

View File

@@ -18,6 +18,7 @@ package com.android.settings.dashboard.suggestions;
import android.content.Context;
import com.android.settingslib.SuggestionParser;
import com.android.settingslib.drawer.Tile;
import java.util.List;
@@ -38,8 +39,14 @@ public interface SuggestionFeatureProvider {
/**
* Ranks the list of suggestions in place.
* @param suggestions: List of suggestion Tiles
* @param suggestionIds: List of suggestion ids corresponding to the suggestion tiles.
*
* @param suggestions List of suggestion Tiles
* @param suggestionIds List of suggestion ids corresponding to the suggestion tiles.
*/
void rankSuggestions(final List<Tile> suggestions, List<String> suggestionIds);
/**
* Dismisses a suggestion.
*/
void dismissSuggestion(Context context, SuggestionParser parser, Tile suggestion);
}