Search in sources :

Example 6 with StickyHeaderDecoration

use of org.thoughtcrime.securesms.util.StickyHeaderDecoration in project Signal-Android by signalapp.

the class ConversationListFragment method initializeListAdapters.

private void initializeListAdapters() {
    defaultAdapter = new ConversationListAdapter(GlideApp.with(this), this);
    searchAdapter = new ConversationListSearchAdapter(GlideApp.with(this), this, Locale.getDefault());
    searchAdapterDecoration = new StickyHeaderDecoration(searchAdapter, false, false, 0);
    setAdapter(defaultAdapter);
    defaultAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {

        @Override
        public void onItemRangeInserted(int positionStart, int itemCount) {
            startupStopwatch.split("data-set");
            SignalLocalMetrics.ColdStart.onConversationListDataLoaded();
            defaultAdapter.unregisterAdapterDataObserver(this);
            list.post(() -> {
                AppStartup.getInstance().onCriticalRenderEventEnd();
                startupStopwatch.split("first-render");
                startupStopwatch.stop(TAG);
            });
        }
    });
}
Also used : StickyHeaderDecoration(org.thoughtcrime.securesms.util.StickyHeaderDecoration) RecyclerView(androidx.recyclerview.widget.RecyclerView) SuppressLint(android.annotation.SuppressLint)

Aggregations

StickyHeaderDecoration (org.thoughtcrime.securesms.util.StickyHeaderDecoration)6 SuppressLint (android.annotation.SuppressLint)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2