Search in sources :

Example 76 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ConditionFooterContextualCardRendererTest method bindView_clickView_shouldSetTrueToIsConditionExpanded.

@Test
public void bindView_clickView_shouldSetTrueToIsConditionExpanded() {
    final RecyclerView recyclerView = new RecyclerView(mContext);
    recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
    final ContextualCard card = generateConditionFooterContextualCard();
    final View view = LayoutInflater.from(mContext).inflate(card.getViewType(), recyclerView, false);
    final RecyclerView.ViewHolder viewHolder = mRenderer.createViewHolder(view, card.getViewType());
    when(mControllerRendererPool.getController(mContext, ContextualCard.CardType.CONDITIONAL_FOOTER)).thenReturn(mController);
    mRenderer.bindView(viewHolder, card);
    assertThat(viewHolder.itemView).isNotNull();
    viewHolder.itemView.performClick();
    verify(mController).setIsExpanded(false);
    verify(mController).onConditionsChanged();
}
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 77 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ConditionHeaderContextualCardRendererTest method bindView_clickView_shouldSetTrueToIsConditionExpanded.

@Test
public void bindView_clickView_shouldSetTrueToIsConditionExpanded() {
    final RecyclerView recyclerView = new RecyclerView(mActivity);
    recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
    final ContextualCard card = generateConditionHeaderContextualCard();
    final View view = LayoutInflater.from(mActivity).inflate(card.getViewType(), recyclerView, false);
    final RecyclerView.ViewHolder viewHolder = mRenderer.createViewHolder(view, card.getViewType());
    when(mControllerRendererPool.getController(mActivity, ContextualCard.CardType.CONDITIONAL_HEADER)).thenReturn(mController);
    mRenderer.bindView(viewHolder, generateConditionHeaderContextualCard());
    assertThat(viewHolder.itemView).isNotNull();
    viewHolder.itemView.performClick();
    verify(mController).setIsExpanded(true);
    verify(mController).onConditionsChanged();
}
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 78 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SwipeDismissalDelegateTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    final ActivityController<Activity> activityController = Robolectric.buildActivity(Activity.class);
    mActivity = activityController.get();
    mActivity.setTheme(R.style.Theme_Settings_Home);
    activityController.create();
    mRecyclerView = new RecyclerView(mActivity);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
    mDismissalDelegate = new SwipeDismissalDelegate(mDismissalDelegateListener);
}
Also used : Activity(android.app.Activity) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) Before(org.junit.Before)

Example 79 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView 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();
}
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 80 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView 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();
}
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)

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