Search in sources :

Example 6 with StickyRecyclerHeadersDecoration

use of com.timehop.stickyheadersrecyclerview.StickyRecyclerHeadersDecoration in project open-event-orga-app by fossasia.

the class TicketsFragment method setupRecyclerView.

private void setupRecyclerView() {
    if (!initialized) {
        ticketsAdapter = new TicketsAdapter(getPresenter());
        RecyclerView recyclerView = binding.ticketsRecyclerView;
        recyclerView.setLayoutManager(new LinearLayoutManager(context));
        recyclerView.setAdapter(ticketsAdapter);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        StickyRecyclerHeadersDecoration decoration = new StickyRecyclerHeadersDecoration(ticketsAdapter);
        recyclerView.addItemDecoration(decoration);
        recyclerView.addItemDecoration(new DividerItemDecoration(context, DividerItemDecoration.VERTICAL));
        adapterDataObserver = new RecyclerView.AdapterDataObserver() {

            @Override
            public void onChanged() {
                decoration.invalidateHeaders();
            }
        };
        ViewUtils.setRecyclerViewScrollAwareFabBehaviour(recyclerView, binding.createTicketFab);
    }
    ticketsAdapter.registerAdapterDataObserver(adapterDataObserver);
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) DividerItemDecoration(android.support.v7.widget.DividerItemDecoration) StickyRecyclerHeadersDecoration(com.timehop.stickyheadersrecyclerview.StickyRecyclerHeadersDecoration) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)6 RecyclerView (android.support.v7.widget.RecyclerView)6 StickyRecyclerHeadersDecoration (com.timehop.stickyheadersrecyclerview.StickyRecyclerHeadersDecoration)6 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)5 DividerItemDecoration (android.support.v7.widget.DividerItemDecoration)3 Toolbar (android.support.v7.widget.Toolbar)2 View (android.view.View)2 FastAdapter (com.mikepenz.fastadapter.FastAdapter)2 IItem (com.mikepenz.fastadapter.IItem)2 StickyHeaderAdapter (com.mikepenz.fastadapter.app.adapters.StickyHeaderAdapter)2 MaterializeBuilder (com.mikepenz.materialize.MaterializeBuilder)2 Handler (android.os.Handler)1 ActionMode (android.support.v7.view.ActionMode)1 Button (android.widget.Button)1 TextView (android.widget.TextView)1 ToggleButton (android.widget.ToggleButton)1 IAdapter (com.mikepenz.fastadapter.IAdapter)1 IExpandable (com.mikepenz.fastadapter.IExpandable)1 HeaderAdapter (com.mikepenz.fastadapter.adapters.HeaderAdapter)1 ItemAdapter (com.mikepenz.fastadapter.adapters.ItemAdapter)1