use of app.insti.api.request.ImageUploadRequest in project IITB-App by wncc.
the class FileComplaintFragment method sendImage.
private void sendImage() {
progressDialog.setMessage("Uploading Image");
ImageUploadRequest imageUploadRequest = new ImageUploadRequest(base64Image);
RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
retrofitInterface.uploadImage("sessionid=" + getArguments().getString(Constants.SESSION_ID), imageUploadRequest).enqueue(new Callback<ImageUploadResponse>() {
@Override
public void onResponse(Call<ImageUploadResponse> call, Response<ImageUploadResponse> response) {
if (response.isSuccessful()) {
ImageUploadResponse imageUploadResponse = response.body();
uploadedImagesUrl.add(imageUploadResponse.getPictureURL());
showImage(uploadedImagesUrl);
Log.i(TAG, "ImageURL: " + uploadedImagesUrl.toString());
} else {
progressDialog.dismiss();
Toast.makeText(getContext(), getString(R.string.error_message), Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure(Call<ImageUploadResponse> call, Throwable t) {
Log.i(TAG, "failure in sendImage: " + t.toString());
progressDialog.dismiss();
Toast.makeText(getContext(), getString(R.string.error_message), Toast.LENGTH_LONG).show();
}
});
}
Aggregations