use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class CalendarListRecyclerAdapter method refreshListView.
/**
* This method will refresh the list view itself, and not effect the calendar view
*/
public void refreshListView() {
clear();
for (ScheduleItem s : mAllEvents) {
addItemForViewType(s);
}
// (will also be called by cache, so won't interfere with cached behavior)
if (mHasLoadedCalenderEvents && mHasLoadedAssignmentEvents) {
mAdapterToCalendarCallback.hidePandaLoading();
setAllPagesLoaded(true);
}
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class CalendarEventManager_Test method getCalendarEvents.
public static void getCalendarEvents(StatusCallback<List<ScheduleItem>> callback) {
Response response = new Response.Builder().code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
List<ScheduleItem> scheduleItems = new ArrayList<>();
retrofit2.Response<List<ScheduleItem>> response1 = retrofit2.Response.success(scheduleItems, response);
callback.onResponse(response1, new LinkHeaders(), ApiType.CACHE);
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class ScheduleItemTest method getContextIdTest_Group.
@Test
public void getContextIdTest_Group() throws Exception {
ScheduleItem scheduleItem = new ScheduleItem();
scheduleItem.setContextCode("group_12345");
assertEquals(12345, scheduleItem.getContextId());
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class ScheduleItemTest method getIdTest_Assignment.
@Test
public void getIdTest_Assignment() throws Exception {
// can't set a schedule item's id to be a string by any exposed method, so use JSON parsing
// to test it
String scheduleItemJSON = "{\n\"all_day\": true,\n\"all_day_date\": \"2012-10-17\",\n\"created_at\": \"2012-10-06T01:09:52Z\",\n\"end_at\": \"2012-10-17T06:00:00Z\",\n\"id\": \"assignment_673956\",\n\"location_address\": null,\n\"location_name\": null,\n\"start_at\": \"2012-10-17T06:00:00Z\",\n\"title\": \"No Class\",\n\"updated_at\": \"2012-10-06T01:09:52Z\",\n\"workflow_state\": \"active\",\n\"description\": null,\n\"context_code\": \"course_833052\",\n\"child_events_count\": 0,\n\"parent_event_id\": null,\n\"hidden\": false,\n\"child_events\": [],\n\"url\": \"https://mobiledev.instructure.com/api/v1/calendar_events/673956\",\n\"html_url\": \"https://mobiledev.instructure.com/calendar?event_id=673956&include_contexts=course_833052#7b2273686f77223a2267726f75705f636f757273655f383333303532227d\"\n}";
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
ScheduleItem scheduleItem = gson.fromJson(scheduleItemJSON, ScheduleItem.class);
assertEquals(673956, scheduleItem.getId());
}
use of com.instructure.canvasapi2.models.ScheduleItem in project instructure-android by instructure.
the class ScheduleItemTest method getIdTest_Number.
@Test
public void getIdTest_Number() throws Exception {
ScheduleItem scheduleItem = new ScheduleItem();
scheduleItem.setId(43243);
assertEquals(43243, scheduleItem.getId());
}
Aggregations