use of org.odk.collect.android.utilities.RankingItemTouchHelperCallback in project collect by opendatakit.
the class RankingWidgetDialog method setUpRecyclerView.
private RecyclerView setUpRecyclerView() {
rankingListAdapter = new RankingListAdapter(viewModel.getItems(), viewModel.getFormIndex());
RecyclerView recyclerView = new RecyclerView(getContext());
recyclerView.setHasFixedSize(true);
recyclerView.setAdapter(rankingListAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
Callback callback = new RankingItemTouchHelperCallback(rankingListAdapter);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
itemTouchHelper.attachToRecyclerView(recyclerView);
return recyclerView;
}
Aggregations