Android Open Source - inbox-android Inbox App Task Callback






From Project

Back to project page inbox-android.

License

The source code is released under:

MIT License

If you think the Android project inbox-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.inboxapp.androidsdk.apis.taskmanagement;
/*w  w w .  j  a va 2 s.  c  om*/
import android.util.Log;

import com.inboxapp.androidsdk.apis.taskmanagement.InboxAppTasks.base.InboxAppTask;

import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;

/**
 * Created by sylvianguessan on 8/13/14.
 */
public class InboxAppTaskCallback implements Callback{
    InboxAppTask mTask;
    InboxAppTaskQueue mInboxAppTaskQueue;
    public  InboxAppTaskCallback(InboxAppTask task, InboxAppTaskQueue inboxAppTaskQueue)
    {
       mTask = task;
       mInboxAppTaskQueue = inboxAppTaskQueue;
    }
    public void success(Object o, Response response) {
        Log.w("InboxAppTask (executeWithClient)", mTask.mInboxTaskID+" successful"+"\nStatus: "+response.getStatus());
    }
    public void failure(RetrofitError retrofitError) {
        Log.w("InboxAppTask (executeWithClient)", mTask.mInboxTaskID+" failed with error:" + retrofitError.getMessage()+"\nStatus: "+retrofitError.getResponse().getStatus());
        updateQueueStatus(retrofitError.getResponse().getStatus());
    }
    public void updateQueueStatus(int statusCode)
    {
       if ((statusCode >= 400) && (statusCode < 500))
       {
           //task should NOT be stored....then proceed to next.
           Log.w("InboxAppTask (executeWithClient)", "Execute the next task");
           mInboxAppTaskQueue.executeNextTask();
       }
       else if (statusCode >= 500)
       {
           //task should stored at end of queue....then proceed to next.
           Log.w("InboxAppTask (executeWithClient)", "Task is appended to queue, the next task is scheduled");
           mInboxAppTaskQueue.add(mTask);
           mInboxAppTaskQueue.executeNextTask();
       }
       else if (statusCode == 0)
       {
           //Queue is paused.
          Log.w("InboxAppTask (executeWithClient)", "Queue auto-processing is paused.");
       }
    }
}




Java Source Code List

com.inboxapp.androidapplication.MainActivity.java
com.inboxapp.androidsdk.apis.InboxAppClient.java
com.inboxapp.androidsdk.apis.taskmanagement.InboxAppTaskCallback.java
com.inboxapp.androidsdk.apis.taskmanagement.InboxAppTaskQueue.java
com.inboxapp.androidsdk.apis.taskmanagement.InboxTaskID.java
com.inboxapp.androidsdk.apis.taskmanagement.InboxAppTasks.CreateCustomTagTask.java
com.inboxapp.androidsdk.apis.taskmanagement.InboxAppTasks.CreateDraftWithBodyTask.java
com.inboxapp.androidsdk.apis.taskmanagement.InboxAppTasks.SendDraftWithBodyTask.java
com.inboxapp.androidsdk.apis.taskmanagement.InboxAppTasks.SendDraftWithIDTask.java
com.inboxapp.androidsdk.apis.taskmanagement.InboxAppTasks.UpdateThreadTagsTask.java
com.inboxapp.androidsdk.apis.taskmanagement.InboxAppTasks.base.InboxAppTask.java
com.inboxapp.androidsdk.json_objects.collection_objects.ContactList.java
com.inboxapp.androidsdk.json_objects.collection_objects.DraftList.java
com.inboxapp.androidsdk.json_objects.collection_objects.FileList.java
com.inboxapp.androidsdk.json_objects.collection_objects.MessageList.java
com.inboxapp.androidsdk.json_objects.collection_objects.NameSpaceList.java
com.inboxapp.androidsdk.json_objects.collection_objects.ParticipantList.java
com.inboxapp.androidsdk.json_objects.collection_objects.TagList.java
com.inboxapp.androidsdk.json_objects.collection_objects.ThreadList.java
com.inboxapp.androidsdk.json_objects.single_objects.Contact.java
com.inboxapp.androidsdk.json_objects.single_objects.Draft.java
com.inboxapp.androidsdk.json_objects.single_objects.File.java
com.inboxapp.androidsdk.json_objects.single_objects.Message.java
com.inboxapp.androidsdk.json_objects.single_objects.Namespace.java
com.inboxapp.androidsdk.json_objects.single_objects.Participant.java
com.inboxapp.androidsdk.json_objects.single_objects.Tag.java
com.inboxapp.androidsdk.json_objects.single_objects.Thread.java
com.inboxapp.androidsdk.json_objects.single_objects.base.InboxAppSingleObject.java
com.inboxapp.androidsdk.json_objects.single_objects.body_objects.DraftID.java
com.inboxapp.androidsdk.json_objects.single_objects.body_objects.TagEdit.java
com.inboxapp.androidsdk.json_objects.single_objects.body_objects.TagName.java
com.inboxapp.androidsdk.sample_application.SampleArrayAdapter.java
com.inboxapp.androidsdk.sample_application.SampleDetailsActivity.java
com.inboxapp.androidsdk.sample_application.SampleMenuActivity.java
com.inboxapp.androidsdk.scratchpad.Scratchpad_MainActivity.java
com.inboxapp.androidsdk.scratchpad.scratchpad_apis.JacksonContributor.java
com.inboxapp.androidsdk.scratchpad.scratchpad_apis.TestApi.java
com.inboxapp.androidsdk.utils.InboxAppStringUtils.java