use of androidx.recyclerview.widget.RecyclerView 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.RecyclerView 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.RecyclerView in project BaseRecyclerViewAdapterHelper by CymChad.
the class MultiItemProviderUseActivity method initRv.
private void initRv() {
RecyclerView mRecyclerView = findViewById(R.id.rv_list);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setAdapter(adapter);
}
use of androidx.recyclerview.widget.RecyclerView in project BaseRecyclerViewAdapterHelper by CymChad.
the class MultiItemDelegateUseActivity method initRv.
private void initRv() {
RecyclerView mRecyclerView = findViewById(R.id.rv_list);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.setAdapter(adapter);
}
use of androidx.recyclerview.widget.RecyclerView in project BaseRecyclerViewAdapterHelper by CymChad.
the class MultiItemQuickUseActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_multiple_item_use);
setTitle("BaseMultiItemQuickAdapter");
setBackBtn();
RecyclerView mRecyclerView = findViewById(R.id.rv_list);
final List<QuickMultipleEntity> data = DataServer.getMultipleItemData();
final MultipleItemQuickAdapter multipleItemAdapter = new MultipleItemQuickAdapter(data);
final GridLayoutManager manager = new GridLayoutManager(this, 4);
mRecyclerView.setLayoutManager(manager);
multipleItemAdapter.setGridSpanSizeLookup(new GridSpanSizeLookup() {
@Override
public int getSpanSize(GridLayoutManager gridLayoutManager, int viewType, int position) {
return data.get(position).getSpanSize();
}
});
mRecyclerView.setAdapter(multipleItemAdapter);
}
Aggregations