use of com.android.settings.homepage.contextualcards.ContextualCard in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConditionFooterContextualCardRendererTest method bindView_clickView_shouldSetTrueToIsConditionExpanded.
@Test
public void bindView_clickView_shouldSetTrueToIsConditionExpanded() {
final RecyclerView recyclerView = new RecyclerView(mContext);
recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
final ContextualCard card = generateConditionFooterContextualCard();
final View view = LayoutInflater.from(mContext).inflate(card.getViewType(), recyclerView, false);
final RecyclerView.ViewHolder viewHolder = mRenderer.createViewHolder(view, card.getViewType());
when(mControllerRendererPool.getController(mContext, ContextualCard.CardType.CONDITIONAL_FOOTER)).thenReturn(mController);
mRenderer.bindView(viewHolder, card);
assertThat(viewHolder.itemView).isNotNull();
viewHolder.itemView.performClick();
verify(mController).setIsExpanded(false);
verify(mController).onConditionsChanged();
}
use of com.android.settings.homepage.contextualcards.ContextualCard in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConditionHeaderContextualCardRendererTest method bindView_clickView_shouldSetTrueToIsConditionExpanded.
@Test
public void bindView_clickView_shouldSetTrueToIsConditionExpanded() {
final RecyclerView recyclerView = new RecyclerView(mActivity);
recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
final ContextualCard card = generateConditionHeaderContextualCard();
final View view = LayoutInflater.from(mActivity).inflate(card.getViewType(), recyclerView, false);
final RecyclerView.ViewHolder viewHolder = mRenderer.createViewHolder(view, card.getViewType());
when(mControllerRendererPool.getController(mActivity, ContextualCard.CardType.CONDITIONAL_HEADER)).thenReturn(mController);
mRenderer.bindView(viewHolder, generateConditionHeaderContextualCard());
assertThat(viewHolder.itemView).isNotNull();
viewHolder.itemView.performClick();
verify(mController).setIsExpanded(true);
verify(mController).onConditionsChanged();
}
use of com.android.settings.homepage.contextualcards.ContextualCard in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceFullCardRendererHelperTest method bindView_shouldSetTagToSliceUri.
@Test
public void bindView_shouldSetTagToSliceUri() {
final RecyclerView.ViewHolder viewHolder = getSliceViewHolder();
final ContextualCard card = buildContextualCard();
mHelper.bindView(viewHolder, card, buildSlice());
assertThat(((SliceViewHolder) viewHolder).sliceView.getTag()).isEqualTo(card.getSliceUri());
}
use of com.android.settings.homepage.contextualcards.ContextualCard in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LegacySuggestionContextualCardRendererTest method bindView_shouldSetListener.
@Test
public void bindView_shouldSetListener() {
final RecyclerView recyclerView = new RecyclerView(mActivity);
recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
final ContextualCard card = buildContextualCard();
final View cardView = LayoutInflater.from(mActivity).inflate(card.getViewType(), recyclerView, false);
final RecyclerView.ViewHolder viewHolder = mRenderer.createViewHolder(cardView, card.getViewType());
when(mControllerRendererPool.getController(mActivity, ContextualCard.CardType.LEGACY_SUGGESTION)).thenReturn(mController);
mRenderer.bindView(viewHolder, buildContextualCard());
assertThat(cardView).isNotNull();
assertThat(cardView.hasOnClickListeners()).isTrue();
}
use of com.android.settings.homepage.contextualcards.ContextualCard in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LegacySuggestionContextualCardRendererTest method bindView_closeButton_shouldSetListener.
@Test
public void bindView_closeButton_shouldSetListener() {
final RecyclerView recyclerView = new RecyclerView(mActivity);
recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
final ContextualCard card = buildContextualCard();
final View cardView = LayoutInflater.from(mActivity).inflate(card.getViewType(), recyclerView, false);
final RecyclerView.ViewHolder viewHolder = mRenderer.createViewHolder(cardView, card.getViewType());
final View closeButton = viewHolder.itemView.findViewById(R.id.close_button);
when(mControllerRendererPool.getController(mActivity, ContextualCard.CardType.LEGACY_SUGGESTION)).thenReturn(mController);
mRenderer.bindView(viewHolder, buildContextualCard());
assertThat(closeButton).isNotNull();
assertThat(closeButton.hasOnClickListeners()).isTrue();
}
Aggregations