Search in sources :

Example 1 with ConditionalCardHolder

use of com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer.ConditionalCardHolder 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 2 with ConditionalCardHolder

use of com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer.ConditionalCardHolder in project android_packages_apps_Settings by omnirom.

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 3 with ConditionalCardHolder

use of com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer.ConditionalCardHolder in project android_packages_apps_Settings by omnirom.

the class SwipeDismissalDelegateTest method getConditionalViewHolder.

private RecyclerView.ViewHolder getConditionalViewHolder() {
    final View view = LayoutInflater.from(mActivity).inflate(ConditionContextualCardRenderer.VIEW_TYPE_FULL_WIDTH, mRecyclerView, false);
    final RecyclerView.ViewHolder viewHolder = spy(new ConditionalCardHolder(view));
    doReturn(ConditionContextualCardRenderer.VIEW_TYPE_FULL_WIDTH).when(viewHolder).getItemViewType();
    return viewHolder;
}
Also used : ConditionalCardHolder(com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer.ConditionalCardHolder) RecyclerView(androidx.recyclerview.widget.RecyclerView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 4 with ConditionalCardHolder

use of com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer.ConditionalCardHolder in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SwipeDismissalDelegateTest method getConditionalViewHolder.

private RecyclerView.ViewHolder getConditionalViewHolder() {
    final View view = LayoutInflater.from(mActivity).inflate(ConditionContextualCardRenderer.VIEW_TYPE_FULL_WIDTH, mRecyclerView, false);
    final RecyclerView.ViewHolder viewHolder = spy(new ConditionalCardHolder(view));
    doReturn(ConditionContextualCardRenderer.VIEW_TYPE_FULL_WIDTH).when(viewHolder).getItemViewType();
    return viewHolder;
}
Also used : ConditionalCardHolder(com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer.ConditionalCardHolder) RecyclerView(androidx.recyclerview.widget.RecyclerView) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Aggregations

View (android.view.View)4 RecyclerView (androidx.recyclerview.widget.RecyclerView)4 ConditionalCardHolder (com.android.settings.homepage.contextualcards.conditional.ConditionContextualCardRenderer.ConditionalCardHolder)4 LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)2 Test (org.junit.Test)2