Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ThinDownloadManager/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ android {
buildToolsVersion "26.0.2"

defaultConfig {
minSdkVersion 9
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.thin.downloadmanager;

import android.content.Intent;
import android.os.Process;

import com.thin.downloadmanager.util.Log;
Expand Down Expand Up @@ -172,6 +173,9 @@ private void executeDownload(DownloadRequest request, String downloadUrl) {
Log.d(TAG, "Existing mDownloadedCacheSize: " + mDownloadedCacheSize);
Log.d(TAG, "File mContentLength: " + mContentLength);
if (mDownloadedCacheSize == mContentLength) { // Mark as success, If end of stream already reached
if (request.getMimeType() == null) {
request.setMimeType(Intent.normalizeMimeType(conn.getContentType()));
}
updateDownloadComplete(request);
Log.d(TAG, "Download Completed");
} else {
Expand Down Expand Up @@ -236,6 +240,9 @@ private void transferData(DownloadRequest request, HttpURLConnection conn) {
try {
try {
in = new BufferedInputStream(conn.getInputStream());
if (request.getMimeType() == null) {
request.setMimeType(Intent.normalizeMimeType(conn.getContentType()));
}
} catch (IOException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public enum Priority {

private DownloadStatusListenerV1 mDownloadStatusListenerV1;

private String mMimeType;

private Object mDownloadContext;

private HashMap<String, String> mCustomHeader;
Expand Down Expand Up @@ -260,7 +262,13 @@ public boolean isCancelled() {
return mCancelled;
}

public String getMimeType() {
return mMimeType;
}

public void setMimeType(String mMimeType) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mMimeType --> mimeType

this.mMimeType = mMimeType;
}

/**
* Marked the request as canceled is aborted.
Expand Down
2 changes: 1 addition & 1 deletion ThinDownloadManagerTestApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {

defaultConfig {
applicationId "com.mani.thindownloadmanager.app"
minSdkVersion 9
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
Expand Down