Search in sources :

Example 1 with RubricRecyclerAdapter

use of com.instructure.speedgrader.adapters.RubricRecyclerAdapter in project instructure-android by instructure.

the class RubricFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    if (savedInstanceState != null) {
        getBundleDataWithCache(savedInstanceState);
    }
    this.currentAttempt = this.mSubmission.getAttempt();
    mRecyclerAdapter = new RubricRecyclerAdapter(getContext(), getCanvasContext(), mAssignment, mSubmission, mSubmissionListener, new RubricAdapterToFragmentCallback() {

        @Override
        public void onFreeFormRowClicked(RubricCriterionRating rating, int position) {
        }

        @Override
        public void onRowClicked(RubricCriterionRating rubricCriterionRating) {
        }

        @Override
        public void onRowClicked(RubricCriterionRating rubricCriterionRating, int position) {
            if (mAssignment.isFreeFormCriterionComments()) {
                return;
            }
            mRecyclerAdapter.updateRubricAssessment(rubricCriterionRating);
        }

        @Override
        public void onCommentRowClicked(RubricCriterionRating rating, int position) {
            commentDialog = new RubricCommentDialog();
            commentDialog.setArguments(RubricCommentDialog.createBundle(mRecyclerAdapter.getGroup((long) rating.getCriterionId().hashCode()), rating, position, mAssignment.isFreeFormCriterionComments()));
            commentDialog.setTargetFragment(RubricFragment.this, 123);
            commentDialog.show(getChildFragmentManager(), EditAssignmentDialog.TAG);
        }

        @Override
        public void onRefreshFinished() {
            setRefreshing(false);
        }
    });
    configureRecyclerView(mRootView, getContext(), mRecyclerAdapter, R.id.swipeRefreshLayout, R.id.emptyPandaView, R.id.listView);
    PandaRecyclerView pandaRecyclerView = (PandaRecyclerView) mRootView.findViewById(R.id.listView);
    pandaRecyclerView.addItemDecoration(new RubricDecorator(getContext()));
    return mRootView;
}
Also used : RubricCommentDialog(com.instructure.speedgrader.dialogs.RubricCommentDialog) RubricCriterionRating(com.instructure.canvasapi.model.RubricCriterionRating) PandaRecyclerView(com.instructure.pandarecycler.PandaRecyclerView) RubricDecorator(com.instructure.speedgrader.decorations.RubricDecorator) RubricAdapterToFragmentCallback(com.instructure.speedgrader.interfaces.RubricAdapterToFragmentCallback) RubricRecyclerAdapter(com.instructure.speedgrader.adapters.RubricRecyclerAdapter)

Aggregations

RubricCriterionRating (com.instructure.canvasapi.model.RubricCriterionRating)1 PandaRecyclerView (com.instructure.pandarecycler.PandaRecyclerView)1 RubricRecyclerAdapter (com.instructure.speedgrader.adapters.RubricRecyclerAdapter)1 RubricDecorator (com.instructure.speedgrader.decorations.RubricDecorator)1 RubricCommentDialog (com.instructure.speedgrader.dialogs.RubricCommentDialog)1 RubricAdapterToFragmentCallback (com.instructure.speedgrader.interfaces.RubricAdapterToFragmentCallback)1