Search in sources :

Example 1 with MasteryPathOptionsRecyclerAdapter

use of com.instructure.candroid.adapter.MasteryPathOptionsRecyclerAdapter in project instructure-android by instructure.

the class MasteryPathOptionsFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    mRootView = getLayoutInflater().inflate(R.layout.fragment_mastery_paths_options, container, false);
    mRecyclerAdapter = new MasteryPathOptionsRecyclerAdapter(getContext(), getCanvasContext(), mAssignments, new AdapterToFragmentCallback<Assignment>() {

        @Override
        public void onRowClicked(Assignment assignment, int position, boolean isOpenDetail) {
            Navigation navigation = getNavigation();
            if (navigation != null) {
                Bundle bundle = AssignmentBasicFragment.createBundle(getCanvasContext(), assignment);
                navigation.addFragment(FragUtils.getFrag(AssignmentBasicFragment.class, bundle));
            }
        }

        @Override
        public void onRefreshFinished() {
        }
    });
    configureRecyclerView(mRootView, getContext(), mRecyclerAdapter, R.id.swipeRefreshLayout, R.id.emptyPandaView, R.id.listView);
    // disable the swiperefreshlayout because we don't want to pull to refresh. It doesn't make an API call, so it wouldn't refresh anything
    mRootView.findViewById(R.id.swipeRefreshLayout).setEnabled(false);
    mSelect = (Button) mRootView.findViewById(R.id.select_option);
    mSelect.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            ModuleManager.selectMasteryPath(getCanvasContext(), mModuleObjectId, mModuleItemId, mAssignmentSet.getId(), mSelectOptionCallback);
        }
    });
    setupCallbacks();
    return mRootView;
}
Also used : MasteryPathAssignment(com.instructure.canvasapi2.models.MasteryPathAssignment) Assignment(com.instructure.canvasapi2.models.Assignment) Navigation(com.instructure.interactions.Navigation) MasteryPathOptionsRecyclerAdapter(com.instructure.candroid.adapter.MasteryPathOptionsRecyclerAdapter) Bundle(android.os.Bundle) AdapterToFragmentCallback(com.instructure.candroid.interfaces.AdapterToFragmentCallback) View(android.view.View)

Aggregations

Bundle (android.os.Bundle)1 View (android.view.View)1 MasteryPathOptionsRecyclerAdapter (com.instructure.candroid.adapter.MasteryPathOptionsRecyclerAdapter)1 AdapterToFragmentCallback (com.instructure.candroid.interfaces.AdapterToFragmentCallback)1 Assignment (com.instructure.canvasapi2.models.Assignment)1 MasteryPathAssignment (com.instructure.canvasapi2.models.MasteryPathAssignment)1 Navigation (com.instructure.interactions.Navigation)1