loopj/android-async-http — pull request #302 by jensh (2013-08-30 12:31:16+00:00)
Title: Implement progress notifications for file uploads.

Overwrite AsyncHttpResponseHandler.onProgress to get progress
notifications. The implementation forwards a reference to
AsyncHttpResponseHandler to
SimpleMultipartEntity. SimpleMultipartEntity than fires the progress
messages every CHUNKSIZE=65536 bytes in writeTo().

Example usage:
```java
RequestParams params = new RequestParams();
params.put("id", "42");
params.put("remarks", "hello file");
params.put("image",
new FileInputStream("/path_to_image/123456.jpg"),
"ImageFilename.jpg",
"image/jpeg");

final Activity activity = this;
AsyncHttpResponseHandler responseHandler = new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String content) {
Toast.makeText(activity, "Success: " + content, Toast.LENGTH_LONG).show();
}

@Override
public void onFailure(Throwable error, String content) {
Toast.makeText(activity, "Failure: " + content, Toast.LENGTH_LONG).show();
}

@Override
public void onProgress(int position, int length) {
// e.g. Update a ProgressBar:
progressBarUpload.setMax(length);
progressBarUpload.setProgress(position);
}
};

AsyncHttpClient client = new AsyncHttpClient();
client.post("http://192.168.254.1/upload.php", params, responseHandler);
```