use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class ScheduleItemTest method getContextIdTest_Course.
@Test
public void getContextIdTest_Course() throws Exception {
ScheduleItem scheduleItem = new ScheduleItem();
scheduleItem.setContextCode("course_12345");
assertEquals(12345, scheduleItem.getContextId());
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class ScheduleItemTest method getUserIdTest.
@Test
public void getUserIdTest() throws Exception {
ScheduleItem scheduleItem = new ScheduleItem();
scheduleItem.setContextCode("user_12345");
assertEquals(12345, scheduleItem.getUserId());
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class ScheduleItemTest method getCourseIdTest.
@Test
public void getCourseIdTest() throws Exception {
ScheduleItem scheduleItem = new ScheduleItem();
scheduleItem.setContextCode("course_12345");
assertEquals(12345, scheduleItem.getCourseId());
}
use of com.instructure.canvasapi2.models.ScheduleItem 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;
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class ScheduleListFragment method handleIntentExtras.
@Override
public void handleIntentExtras(Bundle extras) {
super.handleIntentExtras(extras);
if (extras == null) {
return;
}
ViewUtils.showCroutonFromBundle(getActivity(), extras);
addSyllabus = Tab.SYLLABUS_ID.equals(extras.getString(Const.TAB_ID)) || extras.getBoolean(Const.ADD_SYLLABUS);
if (extras.containsKey(Const.SELECTED_ITEM)) {
ScheduleItem scheduleItem = extras.getParcelable(Const.SELECTED_ITEM);
if (scheduleItem != null) {
setDefaultSelectedId(scheduleItem.getId());
}
}
}
Aggregations