use of androidx.recyclerview.widget.LinearLayoutManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiCallingDisclaimerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.wfc_disclaimer_fragment, container, false);
mAgreeButton = view.findViewById(R.id.agree_button);
mAgreeButton.setOnClickListener(this);
mDisagreeButton = view.findViewById(R.id.disagree_button);
mDisagreeButton.setOnClickListener(this);
final RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.disclaimer_item_list);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
recyclerView.setAdapter(new DisclaimerItemListAdapter(mDisclaimerItemList));
RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL);
recyclerView.addItemDecoration(itemDecoration);
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (!recyclerView.canScrollVertically(1)) {
mScrollToBottom = true;
updateButtonState();
recyclerView.removeOnScrollListener(this);
}
}
});
return view;
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ContextualCardsAdapterTest method onBindViewHolder_conditionalCard_shouldSetTestTitle.
@Test
public void onBindViewHolder_conditionalCard_shouldSetTestTitle() {
mAdapter.mContextualCards.add(buildConditionContextualCard());
final RecyclerView recyclerView = new RecyclerView(mActivity);
recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
final View view = LayoutInflater.from(mActivity).inflate(ConditionContextualCardRenderer.VIEW_TYPE_FULL_WIDTH, recyclerView, false);
final ConditionalCardHolder holder = new ConditionalCardHolder(view);
mAdapter.onBindViewHolder(holder, 0);
assertThat(holder.title.getText()).isEqualTo("test_title");
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ConditionContextualCardRendererTest method viewClick_shouldInvokeControllerPrimaryClick.
@Test
public void viewClick_shouldInvokeControllerPrimaryClick() {
final RecyclerView recyclerView = new RecyclerView(mActivity);
recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
final ContextualCard card = buildConditionContextualCard();
final View view = LayoutInflater.from(mActivity).inflate(card.getViewType(), recyclerView, false);
final RecyclerView.ViewHolder viewHolder = mRenderer.createViewHolder(view, card.getViewType());
final View cardView = view.findViewById(R.id.content);
when(mControllerRendererPool.getController(mActivity, ContextualCard.CardType.CONDITIONAL)).thenReturn(mController);
mRenderer.bindView(viewHolder, card);
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 SliceContextualCardRendererTest method getSliceViewHolder.
private RecyclerView.ViewHolder getSliceViewHolder() {
final RecyclerView recyclerView = new RecyclerView(mActivity);
recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
final View view = LayoutInflater.from(mActivity).inflate(VIEW_TYPE_FULL_WIDTH, recyclerView, false);
return mRenderer.createViewHolder(view, VIEW_TYPE_FULL_WIDTH);
}
use of androidx.recyclerview.widget.LinearLayoutManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceContextualCardRendererTest method getDeferredSetupViewHolder.
private RecyclerView.ViewHolder getDeferredSetupViewHolder() {
final RecyclerView recyclerView = new RecyclerView(mActivity);
recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
final View view = LayoutInflater.from(mActivity).inflate(VIEW_TYPE_DEFERRED_SETUP, recyclerView, false);
final RecyclerView.ViewHolder viewHolder = spy(new SliceDeferredSetupCardRendererHelper.DeferredSetupCardViewHolder(view));
doReturn(VIEW_TYPE_DEFERRED_SETUP).when(viewHolder).getItemViewType();
return viewHolder;
}
Aggregations