use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class ToDoListFragment method onRowClick.
private void onRowClick(ToDo toDo) {
if (toDo == null) {
return;
}
Bundle bundle = new Bundle();
bundle.putParcelable(Const.SELECTED_ITEM, toDo);
Navigation navigation = getNavigation();
if (navigation != null) {
if (toDo.getAssignment() != null) {
// Launch assignment details fragment.
navigation.addFragment(FragUtils.getFrag(AssignmentFragment.class, createBundle(toDo.getCanvasContext(), toDo.getAssignment())));
} else if (toDo.getScheduleItem() != null) {
// It's a Calendar event from the Upcoming API.
ScheduleItem scheduleItem = toDo.getScheduleItem();
String actionBarTitle = "";
if (scheduleItem.getContextType() == CanvasContext.Type.COURSE) {
actionBarTitle = toDo.getCanvasContext().getName();
} else if (scheduleItem.getContextType() == CanvasContext.Type.USER) {
actionBarTitle = getContext().getString(R.string.PersonalCalendar);
}
navigation.addFragment(FragUtils.getFrag(CalendarEventFragment.class, createBundle(toDo.getCanvasContext(), actionBarTitle, toDo.getScheduleItem())));
}
}
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class CalendarListRecyclerAdapterTest method testAreContentsTheSame_noAssignmentDifferentDate.
@Test
public void testAreContentsTheSame_noAssignmentDifferentDate() {
ScheduleItem scheduleItem1 = new ScheduleItem();
scheduleItem1.setTitle("ScheduleItem1a");
scheduleItem1.setStartAt(new Date(Calendar.getInstance().getTimeInMillis() - 1000));
ScheduleItem scheduleItem2 = new ScheduleItem();
scheduleItem2.setTitle("ScheduleItem1a");
scheduleItem2.setStartAt(new Date(Calendar.getInstance().getTimeInMillis() + 1000));
assertFalse(mAdapter.createItemCallback().areContentsTheSame(scheduleItem1, scheduleItem2));
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class CalendarListRecyclerAdapterTest method testAreContentsTheSame_differentAssignment.
@Test
public void testAreContentsTheSame_differentAssignment() {
ScheduleItem scheduleItem1 = new ScheduleItem();
scheduleItem1.setTitle("ScheduleItem1");
Date date = new Date();
scheduleItem1.setStartAt(date);
Assignment assignment1 = new Assignment();
assignment1.setDueAt(APIHelper.dateToString(new Date(Calendar.getInstance().getTimeInMillis() - 1000)));
scheduleItem1.setAssignment(assignment1);
ScheduleItem scheduleItem2 = new ScheduleItem();
scheduleItem2.setTitle("ScheduleItem1");
scheduleItem2.setStartAt(date);
Assignment assignment2 = new Assignment();
assignment2.setDueAt(APIHelper.dateToString(new Date(Calendar.getInstance().getTimeInMillis() + 1000)));
scheduleItem2.setAssignment(assignment2);
assertFalse(mAdapter.createItemCallback().areContentsTheSame(scheduleItem1, scheduleItem2));
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class CalendarListRecyclerAdapterTest method testAreContentsTheSame_nullAssignment.
@Test
public void testAreContentsTheSame_nullAssignment() {
ScheduleItem scheduleItem1 = new ScheduleItem();
scheduleItem1.setTitle("ScheduleItem1");
Date date = new Date();
scheduleItem1.setStartAt(date);
Assignment assignment1 = new Assignment();
assignment1.setDueAt(APIHelper.dateToString(date));
scheduleItem1.setAssignment(assignment1);
ScheduleItem scheduleItem2 = new ScheduleItem();
scheduleItem2.setTitle("ScheduleItem1");
scheduleItem2.setStartAt(date);
Assignment assignment2 = null;
scheduleItem2.setAssignment(assignment2);
assertFalse(mAdapter.createItemCallback().areContentsTheSame(scheduleItem1, scheduleItem2));
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class SyllabusRecyclerAdapterTest method areContentsTheSame_NotNullDifferentDate.
@Test
public void areContentsTheSame_NotNullDifferentDate() {
ScheduleItem item = new ScheduleItem();
item.setTitle("item");
item.setStartAt(new Date(Calendar.getInstance().getTimeInMillis() + 1000));
ScheduleItem item1 = new ScheduleItem();
item1.setTitle("item");
item1.setStartAt(new Date(Calendar.getInstance().getTimeInMillis() - 1000));
assertFalse(mAdapter.createItemCallback().areContentsTheSame(item, item1));
}
Aggregations