Search in sources :

Example 66 with RecyclerView

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));
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) FragmentActivity(androidx.fragment.app.FragmentActivity) Activity(android.app.Activity) RecyclerView(androidx.recyclerview.widget.RecyclerView) Test(org.junit.Test)

Example 67 with RecyclerView

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");
}
Also used : ConditionalCardHolder(com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer.ConditionalCardHolder) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) Test(org.junit.Test)

Example 68 with RecyclerView

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));
}
Also used : ContextualCard(com.android.settings.homepage.contextualcards.ContextualCard) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) Test(org.junit.Test)

Example 69 with RecyclerView

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);
}
Also used : RecyclerView(androidx.recyclerview.widget.RecyclerView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView) SearchView(android.widget.SearchView) Test(org.junit.Test)

Example 70 with RecyclerView

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);
}
Also used : Bundle(android.os.Bundle) RecyclerView(androidx.recyclerview.widget.RecyclerView) Test(org.junit.Test)

Aggregations

RecyclerView (androidx.recyclerview.widget.RecyclerView)272 View (android.view.View)174 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)115 TextView (android.widget.TextView)32 Test (org.junit.Test)24 Nullable (androidx.annotation.Nullable)22 GridLayoutManager (androidx.recyclerview.widget.GridLayoutManager)22 ImageView (android.widget.ImageView)18 Toolbar (androidx.appcompat.widget.Toolbar)18 NonNull (androidx.annotation.NonNull)16 Bundle (android.os.Bundle)15 ViewGroup (android.view.ViewGroup)15 ArrayList (java.util.ArrayList)15 Intent (android.content.Intent)14 Rect (android.graphics.Rect)13 LayoutInflater (android.view.LayoutInflater)11 SuppressLint (android.annotation.SuppressLint)10 Context (android.content.Context)10 ContextualCard (com.android.settings.homepage.contextualcards.ContextualCard)10 List (java.util.List)9