use of com.instructure.canvasapi2.models.User in project instructure-android by instructure.
the class CourseModuleProgressionFragment method updateBottomNavBarButtons.
// the bottom navigation bar has prev and next arrows that sometimes show up and sometimes don't depending
// on where the user is (on the first module item there isn't a prev button). We also may need to update these
// dynamically when we use an async task to get the next group of module items
private void updateBottomNavBarButtons() {
// make them visible by default
prev.setVisibility(View.VISIBLE);
next.setVisibility(View.VISIBLE);
// don't want to see the previous button if we're on the first item
if (currentPos == 0) {
prev.setVisibility(View.INVISIBLE);
}
// don't show the next button if we're on the last item
if (currentPos + 1 >= NUM_ITEMS) {
next.setVisibility(View.INVISIBLE);
}
// get the fragment and update the title
Fragment fragment = adapter.getItem(currentPos);
ModuleItem.CompletionRequirement completionRequirement = getCurrentModuleItem(currentPos).getCompletionRequirement();
if (completionRequirement != null && ModuleItem.MUST_VIEW.equals(completionRequirement.getType())) {
// reload the module object to update the items. By viewing this item subsequent items may now be unlocked
adapter.notifyDataSetChanged();
addLockedIconIfNeeded(modules, items, groupPos, childPos);
}
ModuleItem moduleItem = getCurrentModuleItem(currentPos);
updateModuleMarkDoneView(moduleItem);
}
use of com.instructure.canvasapi2.models.User in project instructure-android by instructure.
the class UserTest method setup.
@Before
public void setup() {
user1 = new User();
user2 = new User();
}
use of com.instructure.canvasapi2.models.User in project instructure-android by instructure.
the class UserManager method updateUserEmail.
public static void updateUserEmail(String email, StatusCallback<User> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).build();
UserAPI.updateUserEmail(adapter, params, email, callback);
}
}
use of com.instructure.canvasapi2.models.User in project instructure-android by instructure.
the class UserManager method getAllEnrollmentsPeopleList.
public static void getAllEnrollmentsPeopleList(final CanvasContext canvasContext, StatusCallback<List<User>> callback, final boolean forceNetwork) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestParams params = new RestParams.Builder().withCanvasContext(canvasContext).withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
// We don't want the canvas context on the paginated params
final RestParams paginatedParams = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
final RestBuilder adapter = new RestBuilder(callback);
StatusCallback<List<User>> depaginatedCallback = new ExhaustiveListCallback<User>(callback) {
@Override
public void getNextPage(@NonNull StatusCallback<List<User>> callback, @NonNull String nextUrl, boolean isCached) {
UserAPI.getAllPeopleList(adapter, paginatedParams, canvasContext.getId(), callback);
}
};
adapter.setStatusCallback(depaginatedCallback);
UserAPI.getAllPeopleList(adapter, params, canvasContext.getId(), depaginatedCallback);
}
}
use of com.instructure.canvasapi2.models.User in project instructure-android by instructure.
the class UserManager method getNextPagePeopleList.
public static void getNextPagePeopleList(boolean forceNetwork, @NonNull String nextUrl, @NonNull StatusCallback<List<User>> callback) {
if (isTesting() || mTesting) {
// TODO
} else {
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).withShouldIgnoreToken(false).build();
final RestBuilder adapter = new RestBuilder(callback);
UserAPI.getNextPagePeopleList(adapter, params, nextUrl, callback);
}
}
Aggregations