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);
}
Aggregations