use of com.instructure.canvasapi.model.AssignmentDueDate in project instructure-android by instructure.
the class AssignmentUnitTest method testAssignmentDueDate.
@Test
public void testAssignmentDueDate() {
Gson gson = CanvasRestAdapter.getGSONParser();
Assignment assignment = gson.fromJson(assignmentDueDates, Assignment.class);
List<AssignmentDueDate> allDates = assignment.getDueDates();
assertEquals(allDates.size(), 2);
for (AssignmentDueDate dueDate : allDates) {
assertNotNull(dueDate.getDueDate());
}
}
use of com.instructure.canvasapi.model.AssignmentDueDate in project instructure-android by instructure.
the class AssignmentBinder method getDueDateString.
public static String getDueDateString(Context context, Assignment assignment) {
String dateString = "";
int index = 0;
if (assignment.getDueDates() != null) {
for (AssignmentDueDate dueDate : assignment.getDueDates()) {
if (dueDate.getDueDate() != null) {
if (index == 0) {
dateString += " " + DateHelpers.createPrefixedDateTimeString(context, context.getResources().getString(R.string.due), dueDate.getDueDate());
} else {
dateString += ", " + DateHelpers.getDateTimeString(context, dueDate.getDueDate());
}
}
index++;
}
} else if (assignment.getDueDates() == null && assignment.getDueDate() != null) {
dateString = DateHelpers.createPrefixedDateTimeString(context, context.getResources().getString(R.string.due), assignment.getDueDate());
}
if (dateString == "") {
dateString = context.getResources().getString(R.string.noDueDate);
}
return dateString;
}
Aggregations