Search in sources :

Example 81 with RecyclerView

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

the class LegacySuggestionContextualCardRendererTest method viewClick_shouldInvokeControllerPrimaryClick.

@Test
public void viewClick_shouldInvokeControllerPrimaryClick() {
    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();
    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 82 with RecyclerView

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

the class LegacySuggestionContextualCardRendererTest method viewClick_closeButton_shouldInvokeControllerDismissClick.

@Test
public void viewClick_closeButton_shouldInvokeControllerDismissClick() {
    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();
    closeButton.performClick();
    verify(mController).onDismissed(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 83 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView in project BaseRecyclerViewAdapterHelper by CymChad.

the class MultiItemProviderUseActivity method initRv.

private void initRv() {
    RecyclerView mRecyclerView = findViewById(R.id.rv_list);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setAdapter(adapter);
}
Also used : RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 84 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView in project BaseRecyclerViewAdapterHelper by CymChad.

the class MultiItemDelegateUseActivity method initRv.

private void initRv() {
    RecyclerView mRecyclerView = findViewById(R.id.rv_list);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setAdapter(adapter);
}
Also used : RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager)

Example 85 with RecyclerView

use of androidx.recyclerview.widget.RecyclerView in project BaseRecyclerViewAdapterHelper by CymChad.

the class MultiItemQuickUseActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_multiple_item_use);
    setTitle("BaseMultiItemQuickAdapter");
    setBackBtn();
    RecyclerView mRecyclerView = findViewById(R.id.rv_list);
    final List<QuickMultipleEntity> data = DataServer.getMultipleItemData();
    final MultipleItemQuickAdapter multipleItemAdapter = new MultipleItemQuickAdapter(data);
    final GridLayoutManager manager = new GridLayoutManager(this, 4);
    mRecyclerView.setLayoutManager(manager);
    multipleItemAdapter.setGridSpanSizeLookup(new GridSpanSizeLookup() {

        @Override
        public int getSpanSize(GridLayoutManager gridLayoutManager, int viewType, int position) {
            return data.get(position).getSpanSize();
        }
    });
    mRecyclerView.setAdapter(multipleItemAdapter);
}
Also used : QuickMultipleEntity(com.chad.baserecyclerviewadapterhelper.entity.QuickMultipleEntity) GridSpanSizeLookup(com.chad.library.adapter.base.listener.GridSpanSizeLookup) GridLayoutManager(androidx.recyclerview.widget.GridLayoutManager) RecyclerView(androidx.recyclerview.widget.RecyclerView) MultipleItemQuickAdapter(com.chad.baserecyclerviewadapterhelper.adapter.multi.MultipleItemQuickAdapter)

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