use of com.cpjd.roblu.ui.forms.FormRecyclerAdapter in project Roblu by wdavies973.
the class MetricSortFragment method onCreateView.
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.metric_tab, container, false);
/*
* Receive parameters
*/
Bundle bundle = this.getArguments();
metrics = (ArrayList<RMetric>) bundle.getSerializable("metrics");
processMethod = bundle.getInt("processMethod");
eventID = bundle.getInt("eventID");
/*
* Attach metrics to the RecyclerView
*/
rv = view.findViewById(R.id.metric_recycler);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(view.getContext());
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
rv.setLayoutManager(linearLayoutManager);
((SimpleItemAnimator) rv.getItemAnimator()).setSupportsChangeAnimations(false);
FormRecyclerAdapter adapter = new FormRecyclerAdapter(view.getContext(), this);
rv.setAdapter(adapter);
// setup gesture listener
ItemTouchHelper.Callback callback = new FormRecyclerTouchHelper(adapter, true);
ItemTouchHelper helper = new ItemTouchHelper(callback);
helper.attachToRecyclerView(rv);
adapter.setMetrics(metrics);
return view;
}
Aggregations