use of com.instructure.candroid.adapter.SyllabusRecyclerAdapter in project instructure-android by instructure.
the class ScheduleListFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mRootView = getLayoutInflater().inflate(R.layout.fragment_list_syllabus, container, false);
mToolbar = mRootView.findViewById(R.id.toolbar);
mAdapterToFragmentCallback = new AdapterToFragmentCallback<ScheduleItem>() {
@Override
public void onRowClicked(ScheduleItem scheduleItem, int position, boolean isOpenDetail) {
Navigation navigation = getNavigation();
if (navigation != null) {
ParentFragment fragment;
if (scheduleItem.getAssignment() != null) {
fragment = FragUtils.getFrag(AssignmentFragment.class, AssignmentFragment.Companion.createBundle((Course) getCanvasContext(), scheduleItem.getAssignment()));
} else if (scheduleItem.getItemType() == ScheduleItem.Type.TYPE_SYLLABUS) {
fragment = FragUtils.getFrag(SyllabusFragment.class, SyllabusFragment.Companion.createBundle((Course) getCanvasContext(), scheduleItem));
} else {
fragment = FragUtils.getFrag(CalendarEventFragment.class, CalendarEventFragment.createBundle(getCanvasContext(), scheduleItem));
}
navigation.addFragment(fragment);
}
}
@Override
public void onRefreshFinished() {
setRefreshing(false);
}
};
mRecyclerAdapter = new SyllabusRecyclerAdapter(getContext(), getCanvasContext(), mAdapterToFragmentCallback);
configureRecyclerView(mRootView, getContext(), mRecyclerAdapter, R.id.swipeRefreshLayout, R.id.emptyPandaView, R.id.listView);
return mRootView;
}
Aggregations