Plumb SuggestionControllerMixin to DismissController.

- The SuggestionControllerMixin is needed to dismiss a suggestion.
- When swipe a suggestion, SuggestionControllerMixin is called, which
  then calls API in SuggestionService to dismiss a suggestion.

Bug: 65065268
Test: robotests
Change-Id: I6a0c5823d60b995ab4a36b1c91777f5cd31a500d
This commit is contained in:
Fan Zhang
2017-09-25 16:44:28 -07:00
parent 9aae9d5d80
commit cd7b13bba5
10 changed files with 80 additions and 21 deletions

View File

@@ -91,6 +91,7 @@ public class DashboardSummary extends InstrumentedFragment
mSuggestionFeatureProvider = FeatureFactory.getFactory(context)
.getSuggestionFeatureProvider(context);
if (mSuggestionFeatureProvider.isSuggestionV2Enabled(context)) {
Log.d(TAG, "Suggestion v2 is enabled, creating SuggestionControllerMixin");
mSuggestionControllerMixin = new SuggestionControllerMixin(context, this /* host */,
getLifecycle());
}
@@ -207,7 +208,8 @@ public class DashboardSummary extends InstrumentedFragment
mDashboard.setHasFixedSize(true);
mDashboard.setListener(this);
mAdapter = new DashboardAdapter(getContext(), bundle, mConditionManager.getConditions(),
mSuggestionParser, this /* SuggestionDismissController.Callback */);
mSuggestionParser, mSuggestionControllerMixin,
this /* SuggestionDismissController.Callback */);
mDashboard.setAdapter(mAdapter);
mDashboard.setItemAnimator(new DashboardItemAnimator());
mSummaryLoader.setSummaryConsumer(mAdapter);
@@ -224,7 +226,7 @@ public class DashboardSummary extends InstrumentedFragment
@VisibleForTesting
void rebuildUI() {
if (!mSuggestionFeatureProvider.isSuggestionEnabled(getContext())) {
Log.d(TAG, "Suggestion feature is disabled, skipping suggestion entirely");
Log.d(TAG, "Suggestion v1 feature is disabled, skipping suggestion v1");
updateCategory();
} else {
new SuggestionLoader().execute();