Search in sources :

Example 6 with Request

use of cl.smartcities.isci.transportinspector.serverConnection.requests.Request in project androidApp by InspectorIncognito.

the class EvaluationQuestionDialog method sendResponse.

private void sendResponse(int answerID, String token) {
    EvaluationQuestionRequest request = new EvaluationQuestionRequest(new Request.RequestListener<Pair<Integer, String>>() {

        @Override
        public void onRequestError() {
        }

        @Override
        public void onRequestResult(@NonNull Pair<Integer, String> response) {
            if (response.first != 200) {
                Log.d("EvaluationQuestion", "Server couldnt validate the request data");
            } else {
                Toast.makeText(TranSappApplication.getAppContext(), response.second, Toast.LENGTH_SHORT).show();
            }
        }
    }, token, answerID);
    ServerController.sendRequest(request, null);
}
Also used : EvaluationQuestionRequest(cl.smartcities.isci.transportinspector.serverConnection.requests.pushRequests.EvaluationQuestionRequest) EvaluationQuestionRequest(cl.smartcities.isci.transportinspector.serverConnection.requests.pushRequests.EvaluationQuestionRequest) Request(cl.smartcities.isci.transportinspector.serverConnection.requests.Request) Pair(android.support.v4.util.Pair)

Aggregations

Request (cl.smartcities.isci.transportinspector.serverConnection.requests.Request)6 NonNull (android.support.annotation.NonNull)2 Pair (android.support.v4.util.Pair)2 ServerStatusCode (cl.smartcities.isci.transportinspector.serverConnection.ServerStatusCode)2 GetUUIDRequest (cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.GetUUIDRequest)2 LoginRequest (cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.LoginRequest)2 LogoutRequest (cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.LogoutRequest)2 ArrayList (java.util.ArrayList)2 JSONException (org.json.JSONException)2 ServiceHelper (cl.smartcities.isci.transportinspector.database.ServiceHelper)1 TranSappAccount (cl.smartcities.isci.transportinspector.gamification.transappUser.TranSappAccount)1 TranSappUser (cl.smartcities.isci.transportinspector.gamification.transappUser.TranSappUser)1 ServerSentBus (cl.smartcities.isci.transportinspector.model.gson.ServerSentBus)1 RankingRequest (cl.smartcities.isci.transportinspector.serverConnection.requests.pullRequests.RankingRequest)1 EvaluationQuestionRequest (cl.smartcities.isci.transportinspector.serverConnection.requests.pushRequests.EvaluationQuestionRequest)1 JSONObject (org.json.JSONObject)1