Search in sources :

Example 36 with Conversation

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

the class InboxManager_Test method deleteConversation.

public static void deleteConversation(long conversationId, StatusCallback<Conversation> callback) {
    // TODO:
    Response rawResponse = new Response.Builder().code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
    Conversation conversation = new Conversation();
    retrofit2.Response<Conversation> response = retrofit2.Response.success(conversation, rawResponse);
    callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) Conversation(com.instructure.canvasapi2.models.Conversation)

Example 37 with Conversation

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

the class InboxManager_Test method addMessage.

public static void addMessage(RestBuilder adapter, StatusCallback<Conversation> callback, RestParams params, long conversationId, List<String> recipientIds, String message, long[] includedMessageIds, long[] attachmentIds) {
    // TODO:
    Response rawResponse = new Response.Builder().code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
    Conversation conversation = new Conversation();
    retrofit2.Response<Conversation> response = retrofit2.Response.success(conversation, rawResponse);
    callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) Conversation(com.instructure.canvasapi2.models.Conversation)

Example 38 with Conversation

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

the class InboxManager_Test method createConversation.

public static void createConversation(RestBuilder adapter, RestParams params, List<String> userIDs, String message, String subject, String contextId, boolean isBulk, StatusCallback<List<Conversation>> callback) {
    Response rawResponse = new Response.Builder().code(200).message("todo").protocol(Protocol.HTTP_1_0).body(ResponseBody.create(MediaType.parse("application/json"), "todo".getBytes())).addHeader("content-type", "application/json").build();
    List<Conversation> conversation = new ArrayList<>();
    retrofit2.Response<List<Conversation>> response = retrofit2.Response.success(conversation, rawResponse);
    callback.onResponse(response, new LinkHeaders(), ApiType.CACHE);
}
Also used : Response(okhttp3.Response) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) ArrayList(java.util.ArrayList) Conversation(com.instructure.canvasapi2.models.Conversation) ArrayList(java.util.ArrayList) List(java.util.List)

Example 39 with Conversation

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

the class MessageThreadFragment method setupConversationDetails.

@Override
public void setupConversationDetails() {
    Conversation conversation = getConversation();
    if (mRecyclerView.getAdapter() == null) {
        // If we didn't setup the adapter initially (we didn't start off with the conversation), then do it now
        mRecyclerView.setAdapter(getAdapter());
    }
    setupRecyclerView();
    if (conversation.getSubject() == null || conversation.getSubject().trim().isEmpty()) {
        mSubject.setText(R.string.no_subject);
    } else {
        mSubject.setText(conversation.getSubject());
    }
    mStarred.setImageResource(conversation.isStarred() ? R.drawable.vd_star_filled : R.drawable.vd_star);
    ColorUtils.colorIt(ThemePrefs.getBrandColor(), mStarred.getDrawable());
    Menu menu = mToolbar.getMenu();
    // we don't want the archive option when it is in the sent folder, we've already toggled the visibility of those in initToolbar
    boolean isArchived = conversation.getWorkflowState() == Conversation.WorkflowState.ARCHIVED;
    if (conversationScope == null || !conversationScope.equals("sent")) {
        menu.findItem(R.id.archive).setVisible(!isArchived);
        menu.findItem(R.id.unarchive).setVisible(isArchived);
    }
    // Set theme after menu changes, otherwise menu icons may retain original tint
    final int textColor = ThemePrefs.getPrimaryTextColor();
    ToolbarColorizeHelper.colorizeToolbar(mToolbar, textColor, getActivity());
}
Also used : Conversation(com.instructure.canvasapi2.models.Conversation) Menu(android.view.Menu)

Aggregations

Conversation (com.instructure.canvasapi2.models.Conversation)28 RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)20 Test (org.junit.Test)14 RestParams (com.instructure.canvasapi2.builders.RestParams)12 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)9 Response (okhttp3.Response)8 ArrayList (java.util.ArrayList)7 IOException (java.io.IOException)3 List (java.util.List)3 Nullable (android.support.annotation.Nullable)2 Date (java.util.Date)2 Bundle (android.os.Bundle)1 Rfc822Tokenizer (android.text.util.Rfc822Tokenizer)1 Menu (android.view.Menu)1 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ImageView (android.widget.ImageView)1 ScrollView (android.widget.ScrollView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1