Search in sources :

Example 1 with ContactSelectionListAdapter

use of org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter in project Signal-Android by signalapp.

the class ContactSelectionListFragment method initializeCursor.

private void initializeCursor() {
    ContactSelectionListAdapter adapter = new ContactSelectionListAdapter(getActivity(), GlideApp.with(this), null, new ListClickListener(), isMulti());
    selectedContacts = adapter.getSelectedContacts();
    recyclerView.setAdapter(adapter);
    recyclerView.addItemDecoration(new StickyHeaderDecoration(adapter, true, true));
}
Also used : ContactSelectionListAdapter(org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter) StickyHeaderDecoration(org.thoughtcrime.securesms.util.StickyHeaderDecoration)

Example 2 with ContactSelectionListAdapter

use of org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter in project Signal-Android by WhisperSystems.

the class ContactSelectionListFragment method initializeCursor.

private void initializeCursor() {
    glideRequests = GlideApp.with(this);
    cursorRecyclerViewAdapter = new ContactSelectionListAdapter(requireContext(), glideRequests, null, new ListClickListener(), isMulti, currentSelection);
    RecyclerViewConcatenateAdapterStickyHeader concatenateAdapter = new RecyclerViewConcatenateAdapterStickyHeader();
    if (listCallback != null) {
        headerAdapter = new FixedViewsAdapter(createNewGroupItem(listCallback));
        headerAdapter.hide();
        concatenateAdapter.addAdapter(headerAdapter);
    }
    concatenateAdapter.addAdapter(cursorRecyclerViewAdapter);
    if (listCallback != null) {
        footerAdapter = new FixedViewsAdapter(createInviteActionView(listCallback));
        footerAdapter.hide();
        concatenateAdapter.addAdapter(footerAdapter);
    }
    recyclerView.addItemDecoration(new LetterHeaderDecoration(requireContext(), this::hideLetterHeaders));
    recyclerView.setAdapter(concatenateAdapter);
    recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
            if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
                if (scrollCallback != null) {
                    scrollCallback.onBeginScroll();
                }
            }
        }
    });
    if (onContactSelectedListener != null) {
        onContactSelectedListener.onSelectionChanged();
    }
}
Also used : FixedViewsAdapter(org.thoughtcrime.securesms.util.adapter.FixedViewsAdapter) LetterHeaderDecoration(org.thoughtcrime.securesms.contacts.LetterHeaderDecoration) ContactSelectionListAdapter(org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter) RecyclerView(androidx.recyclerview.widget.RecyclerView) RecyclerViewConcatenateAdapterStickyHeader(org.thoughtcrime.securesms.util.adapter.RecyclerViewConcatenateAdapterStickyHeader) SuppressLint(android.annotation.SuppressLint)

Aggregations

ContactSelectionListAdapter (org.thoughtcrime.securesms.contacts.ContactSelectionListAdapter)2 SuppressLint (android.annotation.SuppressLint)1 RecyclerView (androidx.recyclerview.widget.RecyclerView)1 LetterHeaderDecoration (org.thoughtcrime.securesms.contacts.LetterHeaderDecoration)1 StickyHeaderDecoration (org.thoughtcrime.securesms.util.StickyHeaderDecoration)1 FixedViewsAdapter (org.thoughtcrime.securesms.util.adapter.FixedViewsAdapter)1 RecyclerViewConcatenateAdapterStickyHeader (org.thoughtcrime.securesms.util.adapter.RecyclerViewConcatenateAdapterStickyHeader)1