use of com.instructure.canvasapi2.models.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionManager method updateDiscussionTopic.
public static void updateDiscussionTopic(CanvasContext canvasContext, long topicId, @NonNull String title, @NonNull String message, boolean threaded, boolean isPublished, StatusCallback<DiscussionTopicHeader> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withPerPageQueryParam(false).withShouldIgnoreToken(false).build();
DiscussionAPI.updateDiscussionTopic(adapter, canvasContext, topicId, title, message, threaded, isPublished, callback, params);
}
}
use of com.instructure.canvasapi2.models.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionManager method getDetailedDiscussionAirwolf.
public static void getDetailedDiscussionAirwolf(String airwolfDomain, String parentId, String studentId, String courseId, String discussionTopicId, StatusCallback<DiscussionTopicHeader> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(false).withDomain(airwolfDomain).withAPIVersion("").build();
DiscussionAPI.getDetailedDiscussionAirwolf(adapter, parentId, studentId, courseId, discussionTopicId, callback, params);
}
}
use of com.instructure.canvasapi2.models.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionManager method getDetailedDiscussion.
public static void getDetailedDiscussion(CanvasContext canvasContext, long topicId, StatusCallback<DiscussionTopicHeader> callback) {
if (isTesting() || mTesting) {
// TODO:
} else {
RestBuilder adapter = new RestBuilder(callback);
DiscussionAPI.getDetailedDiscussion(adapter, canvasContext, topicId, callback, new RestParams.Builder().build());
}
}
use of com.instructure.canvasapi2.models.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionListRecyclerAdapterTest method testCompare_oneNullDateLastReply.
@Test
public void testCompare_oneNullDateLastReply() {
DiscussionTopicHeader d1 = new DiscussionTopicHeader();
d1.setTitle("discussion1");
DateTime dateTime2 = new DateTime("2014-12-29");
Date date = new Date(dateTime2.getMilliseconds(TimeZone.getDefault()));
d1.setLastReplyAt(APIHelper.dateToString(date));
DiscussionTopicHeader d2 = new DiscussionTopicHeader();
d2.setTitle("discussion2");
assertEquals(-1, mAdapter.createItemCallback().compare("", d1, d2));
assertEquals(1, mAdapter.createItemCallback().compare("", d2, d1));
assertEquals(0, mAdapter.createItemCallback().compare("", d1, d1));
}
use of com.instructure.canvasapi2.models.DiscussionTopicHeader in project instructure-android by instructure.
the class DiscussionListRecyclerAdapterTest method testCompare_bothHaveDates.
@Test
public void testCompare_bothHaveDates() {
DiscussionTopicHeader d1 = new DiscussionTopicHeader();
d1.setTitle("discussion1");
DateTime dateTime1 = new DateTime("2014-12-27");
Date date1 = new Date(dateTime1.getMilliseconds(TimeZone.getDefault()));
d1.setLastReplyAt(APIHelper.dateToString(date1));
DiscussionTopicHeader d2 = new DiscussionTopicHeader();
DateTime dateTime2 = new DateTime("2014-12-29");
Date date2 = new Date(dateTime2.getMilliseconds(TimeZone.getDefault()));
d2.setLastReplyAt(APIHelper.dateToString(date2));
d2.setTitle("discussion2");
// callback sorts most recent date first
assertEquals(1, mAdapter.createItemCallback().compare("", d1, d2));
assertEquals(-1, mAdapter.createItemCallback().compare("", d2, d1));
assertEquals(0, mAdapter.createItemCallback().compare("", d1, d1));
}
Aggregations