Search in sources :

Example 1 with SyllabusRecyclerAdapter

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;
}
Also used : SyllabusRecyclerAdapter(com.instructure.candroid.adapter.SyllabusRecyclerAdapter) ScheduleItem(com.instructure.canvasapi2.models.ScheduleItem) Navigation(com.instructure.interactions.Navigation) Course(com.instructure.canvasapi2.models.Course)

Aggregations

SyllabusRecyclerAdapter (com.instructure.candroid.adapter.SyllabusRecyclerAdapter)1 Course (com.instructure.canvasapi2.models.Course)1 ScheduleItem (com.instructure.canvasapi2.models.ScheduleItem)1 Navigation (com.instructure.interactions.Navigation)1