Search in sources :

Example 36 with CanvasContext

use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.

the class CanvasContextSpinnerAdapter method getDropDownView.

@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
    final CanvasContextViewHolder viewHolder;
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.canvas_context_spinner_adapter_item, parent, false);
        viewHolder = new CanvasContextViewHolder();
        viewHolder.title = (TextView) convertView.findViewById(R.id.title);
        viewHolder.indicator = (ImageView) convertView.findViewById(R.id.icon);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (CanvasContextViewHolder) convertView.getTag();
    }
    CanvasContext item = mData.get(position);
    if (item != null) {
        viewHolder.title.setText(item.getName());
        if (item.getId() == GROUP_SEPARATOR || item.getId() == COURSE_SEPARATOR) {
            viewHolder.title.setTypeface(null, Typeface.BOLD);
            viewHolder.indicator.setVisibility(View.GONE);
        } else {
            viewHolder.title.setTypeface(null, Typeface.NORMAL);
            viewHolder.indicator.setVisibility(View.VISIBLE);
            viewHolder.indicator.setBackground(BaseBinder.createIndicatorBackground(ColorKeeper.getOrGenerateColor(item)));
        }
    }
    return convertView;
}
Also used : CanvasContext(com.instructure.canvasapi2.models.CanvasContext)

Example 37 with CanvasContext

use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.

the class AssignmentManager method getFirstPageAssignments.

public static void getFirstPageAssignments(CanvasContext canvasContext, final boolean forceNetwork, StatusCallback<List<Assignment>> callback) {
    if (isTesting() || mTesting) {
    } else {
        final RestBuilder adapter = new RestBuilder(callback);
        AssignmentAPI.getFirstPageAssignments(canvasContext.getId(), forceNetwork, adapter, callback);
    }
}
Also used : RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 38 with CanvasContext

use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.

the class DiscussionManager method replyToDiscussionEntry.

public static void replyToDiscussionEntry(CanvasContext canvasContext, long topicId, long entryId, String message, File attachment, String mimeType, StatusCallback<DiscussionEntry> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().build();
        DiscussionAPI.replyToDiscussionEntryWithAttachment(adapter, canvasContext, topicId, entryId, message, attachment, mimeType, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 39 with CanvasContext

use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.

the class DiscussionManager method getFullDiscussionTopic.

public static void getFullDiscussionTopic(CanvasContext canvasContext, long topicId, boolean forceNetwork, StatusCallback<DiscussionTopic> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).build();
        DiscussionAPI.getFullDiscussionTopic(adapter, canvasContext, topicId, callback, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Example 40 with CanvasContext

use of com.instructure.canvasapi2.models.CanvasContext in project instructure-android by instructure.

the class DiscussionManager method getFilteredDiscussionTopic.

public static void getFilteredDiscussionTopic(final boolean forceNetwork, @NonNull CanvasContext canvasContext, @NonNull String searchTerm, StatusCallback<List<DiscussionTopicHeader>> callback) {
    if (isTesting() || mTesting) {
    // TODO:
    } else {
        RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        DiscussionAPI.getFilteredDiscussionTopic(canvasContext, searchTerm, callback, adapter, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)60 RestParams (com.instructure.canvasapi2.builders.RestParams)55 CanvasContext (com.instructure.canvasapi2.models.CanvasContext)19 StatusCallback (com.instructure.canvasapi2.StatusCallback)8 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)7 List (java.util.List)7 ApiType (com.instructure.canvasapi2.utils.ApiType)6 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)6 DiscussionTopicHeader (com.instructure.canvasapi2.models.DiscussionTopicHeader)5 FileFolder (com.instructure.canvasapi2.models.FileFolder)5 ArrayList (java.util.ArrayList)5 NotNull (org.jetbrains.annotations.NotNull)5 NonNull (android.support.annotation.NonNull)4 View (android.view.View)4 TextView (android.widget.TextView)4 UpdateFileFolder (com.instructure.canvasapi2.models.UpdateFileFolder)4 Bundle (android.os.Bundle)3 ImageView (android.widget.ImageView)3 BindView (butterknife.BindView)3 Course (com.instructure.canvasapi2.models.Course)3