use of com.khmelenko.lab.varis.adapter.JobsListAdapter in project Varis-Android by dkhmelenko.
the class JobsFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_jobs, container, false);
ButterKnife.bind(this, view);
mJobsRecyclerView.setNestedScrollingEnabled(false);
mJobsRecyclerView.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
mJobsRecyclerView.setLayoutManager(layoutManager);
mJobsListAdapter = new JobsListAdapter(getContext(), mJobs, new OnListItemListener() {
@Override
public void onItemSelected(int position) {
if (mJobs != null && !mJobs.isEmpty()) {
Job job = mJobs.get(position);
mListener.onJobSelected(job);
}
}
});
mJobsRecyclerView.setAdapter(mJobsListAdapter);
DisplayMetrics metrics = getResources().getDisplayMetrics();
int itemHeight = (int) ((mJobsListAdapter.getItemHeight() * metrics.density) + 0.5);
mJobsRecyclerView.getLayoutParams().height = itemHeight * mJobsListAdapter.getItemCount();
return view;
}
Aggregations