因为在更新进度的时候,有点卡,所以想,减缓进度更新的间隔时间。使其不那么频繁。
直接看代码分析下。
HttpHandler.java 实现了RequestCallBackHandler的下载进度监听
private ResponseInfo<T> handleResponse(HttpResponse response) throws HttpException, IOException {
if (response == null) {
throw new HttpException("response is null");
}
if (isCancelled()) return null;
StatusLine status = response.getStatusLine();
int statusCode = status.getStatusCode();
if (statusCode < 300) {
Object result = null;
HttpEntity entity = response.getEntity();
if (entity != null) {
isUploading = false;
if (isDownloadingFile) {
autoResume = autoResume && OtherUtils.isSupportRange(response);
String responseFileName = autoRename ? OtherUtils.getFileNameFromHttpResponse(response) : null;
FileDownloadHandler downloadHandler = new FileDownloadHandler();
<span style="color:#ff0000;"> result = downloadHandler.handleEntity(entity, this, fileSavePath, autoResume, responseFileName); //在这里我找到了,进度接口实现的实体了,我们点进去看看。</span>
} else {
StringDownloadHandler downloadHandler