use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceHalfCardRendererHelper method bindView.
void bindView(RecyclerView.ViewHolder holder, ContextualCard card, Slice slice) {
final HalfCardViewHolder view = (HalfCardViewHolder) holder;
final SliceMetadata sliceMetadata = SliceMetadata.from(mContext, slice);
final SliceAction primaryAction = sliceMetadata.getPrimaryAction();
view.icon.setImageDrawable(primaryAction.getIcon().loadDrawable(mContext));
view.title.setText(primaryAction.getTitle());
view.content.setOnClickListener(v -> {
try {
primaryAction.getAction().send();
} catch (PendingIntent.CanceledException e) {
Log.w(TAG, "Failed to start intent " + primaryAction.getTitle());
}
final String log = ContextualCardLogUtils.buildCardClickLog(card, 0, /* row */
EventInfo.ACTION_TYPE_CONTENT, view.getAdapterPosition());
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_CARD_CLICK, log);
});
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider 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.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConditionContextualCardRenderer method bindView.
@Override
public void bindView(RecyclerView.ViewHolder holder, ContextualCard contextualCard) {
final ConditionalCardHolder view = (ConditionalCardHolder) holder;
final ConditionalContextualCard card = (ConditionalContextualCard) contextualCard;
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
metricsFeatureProvider.visible(mContext, SettingsEnums.SETTINGS_HOMEPAGE, card.getMetricsConstant());
initializePrimaryClick(view, card, metricsFeatureProvider);
initializeView(view, card);
initializeActionButton(view, card, metricsFeatureProvider);
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConditionFooterContextualCardRenderer method bindView.
@Override
public void bindView(RecyclerView.ViewHolder holder, ContextualCard card) {
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
holder.itemView.setOnClickListener(v -> {
metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN, SettingsEnums.ACTION_SETTINGS_CONDITION_EXPAND, SettingsEnums.SETTINGS_HOMEPAGE, null, /* key */
0);
final ConditionContextualCardController controller = mControllerRendererPool.getController(mContext, ContextualCard.CardType.CONDITIONAL_FOOTER);
controller.setIsExpanded(false);
controller.onConditionsChanged();
});
}
use of com.android.settingslib.core.instrumentation.MetricsFeatureProvider in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConditionHeaderContextualCardRenderer method bindView.
@Override
public void bindView(RecyclerView.ViewHolder holder, ContextualCard contextualCard) {
final ConditionHeaderContextualCard headerCard = (ConditionHeaderContextualCard) contextualCard;
final ConditionHeaderCardHolder view = (ConditionHeaderCardHolder) holder;
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
view.icons.removeAllViews();
headerCard.getConditionalCards().stream().forEach(card -> {
final ImageView icon = (ImageView) LayoutInflater.from(mContext).inflate(R.layout.conditional_card_header_icon, view.icons, false);
icon.setImageDrawable(card.getIconDrawable());
view.icons.addView(icon);
});
view.itemView.setOnClickListener(v -> {
metricsFeatureProvider.action(SettingsEnums.PAGE_UNKNOWN, SettingsEnums.ACTION_SETTINGS_CONDITION_EXPAND, SettingsEnums.SETTINGS_HOMEPAGE, null, /* key */
1);
final ConditionContextualCardController controller = mControllerRendererPool.getController(mContext, ContextualCard.CardType.CONDITIONAL_HEADER);
controller.setIsExpanded(true);
controller.onConditionsChanged();
});
}
Aggregations