use of com.android.settings.homepage.contextualcards.ContextualCardFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceFullCardRendererHelper method bindView.
void bindView(RecyclerView.ViewHolder holder, ContextualCard card, Slice slice) {
final SliceViewHolder cardHolder = (SliceViewHolder) holder;
cardHolder.sliceView.setScrollable(false);
cardHolder.sliceView.setTag(card.getSliceUri());
// TODO(b/114009676): We will soon have a field to decide what slice mode we should set.
cardHolder.sliceView.setMode(SliceView.MODE_LARGE);
cardHolder.sliceView.setSlice(slice);
// Set this listener so we can log the interaction users make on the slice
cardHolder.sliceView.setOnSliceActionListener((eventInfo, sliceItem) -> {
final String log = ContextualCardLogUtils.buildCardClickLog(card, eventInfo.rowIndex, eventInfo.actionType, cardHolder.getAdapterPosition());
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_CARD_CLICK, log);
final ContextualCardFeatureProvider contextualCardFeatureProvider = FeatureFactory.getFactory(mContext).getContextualCardFeatureProvider(mContext);
contextualCardFeatureProvider.logNotificationPackage(slice);
});
// Customize slice view for Settings
cardHolder.sliceView.setShowTitleItems(true);
if (card.isLargeCard()) {
cardHolder.sliceView.setShowHeaderDivider(true);
cardHolder.sliceView.setShowActionDividers(true);
}
}
use of com.android.settings.homepage.contextualcards.ContextualCardFeatureProvider in project android_packages_apps_Settings by omnirom.
the class SliceContextualCardController method onDismissed.
@Override
public void onDismissed(ContextualCard card) {
ThreadUtils.postOnBackgroundThread(() -> {
final ContextualCardFeatureProvider cardFeatureProvider = FeatureFactory.getFactory(mContext).getContextualCardFeatureProvider(mContext);
cardFeatureProvider.markCardAsDismissed(mContext, card.getName());
});
showFeedbackDialog(card);
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_CARD_DISMISS, ContextualCardLogUtils.buildCardDismissLog(card));
}
use of com.android.settings.homepage.contextualcards.ContextualCardFeatureProvider in project android_packages_apps_Settings by omnirom.
the class SliceContextualCardControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mProvider = Robolectric.setupContentProvider(CardContentProvider.class);
ShadowContentResolver.registerProviderInternal(CardContentProvider.CARD_AUTHORITY, mProvider);
mResolver = mContext.getContentResolver();
mController = spy(new SliceContextualCardController(mContext));
mFeatureFactory = FakeFeatureFactory.setupForTest();
final ContextualCardFeatureProvider cardFeatureProvider = new ContextualCardFeatureProviderImpl(mContext);
mFeatureFactory.mContextualCardFeatureProvider = cardFeatureProvider;
}
Aggregations