Search in sources :

Example 86 with LinearLayoutManager

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

the class WifiCallingDisclaimerFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.wfc_disclaimer_fragment, container, false);
    mAgreeButton = view.findViewById(R.id.agree_button);
    mAgreeButton.setOnClickListener(this);
    mDisagreeButton = view.findViewById(R.id.disagree_button);
    mDisagreeButton.setOnClickListener(this);
    final RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.disclaimer_item_list);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(new DisclaimerItemListAdapter(mDisclaimerItemList));
    RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL);
    recyclerView.addItemDecoration(itemDecoration);
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            if (!recyclerView.canScrollVertically(1)) {
                mScrollToBottom = true;
                updateButtonState();
                recyclerView.removeOnScrollListener(this);
            }
        }
    });
    return view;
}
Also used : OnScrollListener(androidx.recyclerview.widget.RecyclerView.OnScrollListener) RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) DividerItemDecoration(androidx.recyclerview.widget.DividerItemDecoration) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 87 with LinearLayoutManager

use of androidx.recyclerview.widget.LinearLayoutManager 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 88 with LinearLayoutManager

use of androidx.recyclerview.widget.LinearLayoutManager 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 89 with LinearLayoutManager

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

the class SliceContextualCardRendererTest method getSliceViewHolder.

private RecyclerView.ViewHolder getSliceViewHolder() {
    final RecyclerView recyclerView = new RecyclerView(mActivity);
    recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
    final View view = LayoutInflater.from(mActivity).inflate(VIEW_TYPE_FULL_WIDTH, recyclerView, false);
    return mRenderer.createViewHolder(view, VIEW_TYPE_FULL_WIDTH);
}
Also used : RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Example 90 with LinearLayoutManager

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

the class SliceContextualCardRendererTest method getDeferredSetupViewHolder.

private RecyclerView.ViewHolder getDeferredSetupViewHolder() {
    final RecyclerView recyclerView = new RecyclerView(mActivity);
    recyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
    final View view = LayoutInflater.from(mActivity).inflate(VIEW_TYPE_DEFERRED_SETUP, recyclerView, false);
    final RecyclerView.ViewHolder viewHolder = spy(new SliceDeferredSetupCardRendererHelper.DeferredSetupCardViewHolder(view));
    doReturn(VIEW_TYPE_DEFERRED_SETUP).when(viewHolder).getItemViewType();
    return viewHolder;
}
Also used : RecyclerView(androidx.recyclerview.widget.RecyclerView) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) View(android.view.View) RecyclerView(androidx.recyclerview.widget.RecyclerView)

Aggregations

LinearLayoutManager (androidx.recyclerview.widget.LinearLayoutManager)470 RecyclerView (androidx.recyclerview.widget.RecyclerView)281 View (android.view.View)183 TextView (android.widget.TextView)65 ArrayList (java.util.ArrayList)37 Nullable (androidx.annotation.Nullable)33 Bundle (android.os.Bundle)32 Toolbar (androidx.appcompat.widget.Toolbar)32 Intent (android.content.Intent)30 ImageView (android.widget.ImageView)27 List (java.util.List)24 Test (org.junit.Test)24 Context (android.content.Context)23 NonNull (androidx.annotation.NonNull)23 ViewGroup (android.view.ViewGroup)22 AlertDialog (androidx.appcompat.app.AlertDialog)21 ContextualCard (com.android.settings.homepage.contextualcards.ContextualCard)20 LayoutInflater (android.view.LayoutInflater)18 AppCompatActivity (androidx.appcompat.app.AppCompatActivity)16 SwipeRefreshLayout (androidx.swiperefreshlayout.widget.SwipeRefreshLayout)16