use of com.instructure.canvasapi2.models.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionListRecyclerAdapterTest method testAreContentsTheSame_DifferentTitle.
@Test
public void testAreContentsTheSame_DifferentTitle() {
DiscussionTopicHeader discussionTopicHeader1 = new DiscussionTopicHeader();
discussionTopicHeader1.setTitle("discussion1");
DiscussionTopicHeader discussionTopicHeader2 = new DiscussionTopicHeader();
discussionTopicHeader2.setTitle("discussion2");
assertFalse(mAdapter.createItemCallback().areContentsTheSame(discussionTopicHeader1, discussionTopicHeader2));
}
use of com.instructure.canvasapi2.models.DiscussionTopicHeader 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);
}
}
use of com.instructure.canvasapi2.models.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionManager method getAllPinnedDiscussions.
public static void getAllPinnedDiscussions(@NonNull CanvasContext canvasContext, final boolean forceNetwork, StatusCallback<List<DiscussionTopicHeader>> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
final RestBuilder adapter = new RestBuilder(callback);
final RestParams params = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(false).build();
StatusCallback<List<DiscussionTopicHeader>> depaginatedCallback = new ExhaustiveListCallback<DiscussionTopicHeader>(callback) {
@Override
public void getNextPage(@NotNull StatusCallback<List<DiscussionTopicHeader>> callback, @NotNull String nextUrl, boolean isCached) {
DiscussionAPI.getNextPage(nextUrl, adapter, callback, params);
}
};
adapter.setStatusCallback(depaginatedCallback);
DiscussionAPI.getFirstPagePinnedDiscussions(canvasContext, adapter, depaginatedCallback, params);
}
}
use of com.instructure.canvasapi2.models.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionManager method unpinDiscussionTopicHeader.
public static void unpinDiscussionTopicHeader(@NonNull CanvasContext canvasContext, long topicId, StatusCallback<DiscussionTopicHeader> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
DiscussionAPI.unpinDiscussion(adapter, canvasContext, topicId, callback, params);
}
}
use of com.instructure.canvasapi2.models.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionManager method pinDiscussionTopicHeader.
public static void pinDiscussionTopicHeader(@NonNull CanvasContext canvasContext, long topicId, StatusCallback<DiscussionTopicHeader> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
DiscussionAPI.pinDiscussion(adapter, canvasContext, topicId, callback, params);
}
}
Aggregations