Search in sources :

Example 1 with AdapterToFragmentCallback

use of com.instructure.teacher.interfaces.AdapterToFragmentCallback in project instructure-android by instructure.

the class PeopleListFragment method getAdapter.

@Override
protected PeopleListRecyclerAdapter getAdapter() {
    if (mAdapter == null) {
        mAdapter = new PeopleListRecyclerAdapter(getContext(), getPresenter(), new AdapterToFragmentCallback<User>() {

            @Override
            public void onRowClicked(User user, int position) {
                CanvasContext canvasContext = getArguments().getParcelable(Const.CANVAS_CONTEXT);
                if (CanvasContextExtensions.isDesigner(canvasContext)) {
                    Toast.makeText(getContext(), R.string.errorIsDesigner, Toast.LENGTH_SHORT).show();
                    return;
                }
                Bundle bundle = StudentContextFragment.makeBundle(user.getId(), canvasContext.getId(), true);
                RouteMatcher.route(getContext(), new Route(null, StudentContextFragment.class, canvasContext, bundle));
            }
        });
    }
    return mAdapter;
}
Also used : User(com.instructure.canvasapi2.models.User) Bundle(android.os.Bundle) AdapterToFragmentCallback(com.instructure.teacher.interfaces.AdapterToFragmentCallback) CanvasContext(com.instructure.canvasapi2.models.CanvasContext) StudentContextFragment(com.instructure.teacher.adapters.StudentContextFragment) PeopleListRecyclerAdapter(com.instructure.teacher.adapters.PeopleListRecyclerAdapter) Route(com.instructure.interactions.router.Route)

Aggregations

Bundle (android.os.Bundle)1 CanvasContext (com.instructure.canvasapi2.models.CanvasContext)1 User (com.instructure.canvasapi2.models.User)1 Route (com.instructure.interactions.router.Route)1 PeopleListRecyclerAdapter (com.instructure.teacher.adapters.PeopleListRecyclerAdapter)1 StudentContextFragment (com.instructure.teacher.adapters.StudentContextFragment)1 AdapterToFragmentCallback (com.instructure.teacher.interfaces.AdapterToFragmentCallback)1