use of androidx.recyclerview.widget.RecyclerView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DataUsageSummaryPreferenceControllerTest method testMobileData_entityHeaderSet.
@Test
public void testMobileData_entityHeaderSet() {
final RecyclerView recyclerView = new RecyclerView(mActivity);
mController = new DataUsageSummaryPreferenceController(mDataUsageController, mDataInfoController, mNetworkTemplate, mPolicyEditor, R.string.cell_data_template, true, mSubscriptionManager, mActivity, mLifecycle, mHeaderController, mPreferenceFragment, mDefaultSubscriptionId);
when(mPreferenceFragment.getListView()).thenReturn(recyclerView);
mController.onStart();
verify(mHeaderController).setRecyclerView(any(RecyclerView.class), any(Lifecycle.class));
verify(mHeaderController).styleActionBar(any(Activity.class));
}
use of androidx.recyclerview.widget.RecyclerView 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.RecyclerView 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.RecyclerView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ManageApplicationsTest method updateFilterView_noFilterSet_shouldHideFilterAndNoPaddingTop.
@Test
public void updateFilterView_noFilterSet_shouldHideFilterAndNoPaddingTop() {
mFragment.mRecyclerView = new RecyclerView(mContext);
mFragment.mSpinnerHeader = new View(mContext);
mFragment.mFilterAdapter = new ManageApplications.FilterSpinnerAdapter(mFragment);
mFragment.mFilterAdapter.updateFilterView(false);
assertThat(mFragment.mSpinnerHeader.getVisibility()).isEqualTo(View.GONE);
assertThat(mFragment.mRecyclerView.getPaddingTop()).isEqualTo(0);
}
use of androidx.recyclerview.widget.RecyclerView in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ManageApplicationsTest method notifyItemChange_recyclerViewIdle_shouldNotify.
@Test
public void notifyItemChange_recyclerViewIdle_shouldNotify() {
final RecyclerView recyclerView = mock(RecyclerView.class);
final ManageApplications.ApplicationsAdapter adapter = spy(new ManageApplications.ApplicationsAdapter(mState, mFragment, AppFilterRegistry.getInstance().get(FILTER_APPS_ALL), new Bundle()));
adapter.onAttachedToRecyclerView(recyclerView);
adapter.mOnScrollListener.onScrollStateChanged(recyclerView, SCROLL_STATE_IDLE);
adapter.mOnScrollListener.postNotifyItemChange(0);
verify(adapter).notifyItemChanged(0);
}
Aggregations