use of com.instructure.canvasapi2.models.AccountNotification in project instructure-android by instructure.
the class DetailViewActivity method routeFromIntent.
private void routeFromIntent(Intent intent) {
DETAIL_FRAGMENT fragmentType = (DETAIL_FRAGMENT) intent.getExtras().getSerializable(Const.FRAGMENT_TYPE);
if (fragmentType != null) {
Student student = intent.getExtras().getParcelable(Const.STUDENT);
switch(fragmentType) {
case WEEK:
Student user = intent.getExtras().getParcelable(Const.USER);
Course course = (Course) intent.getExtras().getSerializable(Const.COURSE);
if (user != null && course != null) {
addFragment(CourseWeekFragment.newInstance(user, course));
}
break;
case ASSIGNMENT:
Assignment assignment = intent.getExtras().getParcelable(Const.ASSIGNMENT);
String courseName = intent.getExtras().getString(Const.NAME);
addFragment(AssignmentFragment.newInstance(assignment, courseName, student), false);
break;
case ANNOUNCEMENT:
DiscussionTopicHeader announcement = intent.getExtras().getParcelable(Const.ANNOUNCEMENT);
String announcementCourseName = intent.getExtras().getString(Const.NAME);
addFragment(AnnouncementFragment.newInstance(announcement, announcementCourseName, student), false);
break;
case EVENT:
ScheduleItem item = intent.getExtras().getParcelable(Const.SCHEDULE_ITEM);
addFragment(EventFragment.newInstance(item, student), false);
break;
case SYLLABUS:
Course syllabusCourse = (Course) intent.getExtras().getSerializable(Const.COURSE);
addFragment(CourseSyllabusFragment.newInstance(syllabusCourse, student), false);
break;
case ACCOUNT_NOTIFICATION:
AccountNotification accountNotification = intent.getExtras().getParcelable(Const.ACCOUNT_NOTIFICATION);
addFragment(AccountNotificationFragment.newInstance(accountNotification, student));
}
}
}
use of com.instructure.canvasapi2.models.AccountNotification in project instructure-android by instructure.
the class AccountNotificationManager method getAccountNotifications.
public static void getAccountNotifications(StatusCallback<List<AccountNotification>> callback, boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
AccountNotificationAPI.getAccountNotifications(adapter, params, callback);
}
}
use of com.instructure.canvasapi2.models.AccountNotification in project instructure-android by instructure.
the class AccountNotificationManager method getAllAccountNotifications.
public static void getAllAccountNotifications(StatusCallback<List<AccountNotification>> callback, boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
StatusCallback<List<AccountNotification>> depaginatedCallback = new ExhaustiveListCallback<AccountNotification>(callback) {
@Override
public void getNextPage(StatusCallback<List<AccountNotification>> callback, String nextUrl, boolean isCached) {
AccountNotificationAPI.getAccountNotifications(adapter, params, callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
AccountNotificationAPI.getAccountNotifications(adapter, params, depaginatedCallback);
}
}
use of com.instructure.canvasapi2.models.AccountNotification in project instructure-android by instructure.
the class AccountNotificationManager method deleteAccountNotification.
public static void deleteAccountNotification(long notificationId, StatusCallback<AccountNotification> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().build();
AccountNotificationAPI.deleteAccountNotification(notificationId, adapter, params, callback);
}
}
use of com.instructure.canvasapi2.models.AccountNotification in project instructure-android by instructure.
the class AccountNotificationManager method getAccountNotificationForStudentAirwolf.
public static void getAccountNotificationForStudentAirwolf(String airwolfDomain, String parentId, String studentId, String accountNotificationId, boolean forceNetwork, StatusCallback<AccountNotification> callback) {
if (isTesting() || mTesting) {
AccountNotificationManager_Test.getAccountNotificationForStudent(parentId, studentId, accountNotificationId, callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withDomain(airwolfDomain).withForceReadFromNetwork(forceNetwork).withAPIVersion("").build();
AccountNotificationAPI.getAccountNotificationForStudentById(adapter, params, parentId, studentId, accountNotificationId, callback);
}
}
Aggregations