use of androidx.recyclerview.widget.LinearLayoutManager 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 androidx.recyclerview.widget.LinearLayoutManager 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();
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LegacySuggestionContextualCardRendererTest method viewClick_shouldInvokeControllerPrimaryClick.
@Test
public void viewClick_shouldInvokeControllerPrimaryClick() {
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();
cardView.performClick();
verify(mController).onPrimaryClick(any(ContextualCard.class));
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LegacySuggestionContextualCardRendererTest method viewClick_closeButton_shouldInvokeControllerDismissClick.
@Test
public void viewClick_closeButton_shouldInvokeControllerDismissClick() {
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();
closeButton.performClick();
verify(mController).onDismissed(any(ContextualCard.class));
}
use of androidx.recyclerview.widget.LinearLayoutManager in project BaseRecyclerViewAdapterHelper by CymChad.
the class HeaderAndFooterUseActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_universal_recycler);
setBackBtn();
setTitle("HeaderAndFooter Use");
mRecyclerView = findViewById(R.id.rv);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
initAdapter();
View headerView = getHeaderView(0, new View.OnClickListener() {
@Override
public void onClick(View v) {
adapter.addHeaderView(getHeaderView(1, getRemoveHeaderListener()), 0);
}
});
adapter.addHeaderView(headerView);
View footerView = getFooterView(0, new View.OnClickListener() {
@Override
public void onClick(View v) {
adapter.addFooterView(getFooterView(1, getRemoveFooterListener()), 0);
}
});
adapter.addFooterView(footerView, 0);
mRecyclerView.setAdapter(adapter);
}
Aggregations