projects
/
pub
/
Android
/
ownCloud.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1048 from owncloud/shareWithYou_icon_in_fileList
[pub/Android/ownCloud.git]
/
src
/
com
/
owncloud
/
android
/
operations
/
DownloadFileOperation.java
diff --git
a/src/com/owncloud/android/operations/DownloadFileOperation.java
b/src/com/owncloud/android/operations/DownloadFileOperation.java
index
d0d249e
..
0cb303c
100644
(file)
--- a/
src/com/owncloud/android/operations/DownloadFileOperation.java
+++ b/
src/com/owncloud/android/operations/DownloadFileOperation.java
@@
-1,5
+1,9
@@
-/* ownCloud Android client application
- * Copyright (C) 2012-2013 ownCloud Inc.
+/**
+ * ownCloud Android client application
+ *
+ * @author David A. Velasco
+ * @author masensio
+ * Copyright (C) 2015 ownCloud Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
@@
-35,14
+39,10
@@
import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation;
import com.owncloud.android.utils.FileStorageUtils;
import android.accounts.Account;
import com.owncloud.android.utils.FileStorageUtils;
import android.accounts.Account;
-import android.media.MediaScannerConnection;
import android.webkit.MimeTypeMap;
/**
* Remote mDownloadOperation performing the download of a file to an ownCloud server
import android.webkit.MimeTypeMap;
/**
* Remote mDownloadOperation performing the download of a file to an ownCloud server
- *
- * @author David A. Velasco
- * @author masensio
*/
public class DownloadFileOperation extends RemoteOperation {
*/
public class DownloadFileOperation extends RemoteOperation {
@@
-59,9
+59,11
@@
public class DownloadFileOperation extends RemoteOperation {
public DownloadFileOperation(Account account, OCFile file) {
if (account == null)
public DownloadFileOperation(Account account, OCFile file) {
if (account == null)
- throw new IllegalArgumentException("Illegal null account in DownloadFileOperation creation");
+ throw new IllegalArgumentException("Illegal null account in DownloadFileOperation " +
+ "creation");
if (file == null)
if (file == null)
- throw new IllegalArgumentException("Illegal null file in DownloadFileOperation creation");
+ throw new IllegalArgumentException("Illegal null file in DownloadFileOperation " +
+ "creation");
mAccount = account;
mFile = file;
mAccount = account;
mFile = file;
@@
-78,7
+80,7
@@
public class DownloadFileOperation extends RemoteOperation {
}
public String getSavePath() {
}
public String getSavePath() {
- String path = mFile.getStoragePath();
// re-downloads should be done over the original file
+ String path = mFile.getStoragePath();
// re-downloads should be done over the original file
if (path != null && path.length() > 0) {
return path;
}
if (path != null && path.length() > 0) {
return path;
}
@@
-103,9
+105,11
@@
public class DownloadFileOperation extends RemoteOperation {
try {
mimeType = MimeTypeMap.getSingleton()
.getMimeTypeFromExtension(
try {
mimeType = MimeTypeMap.getSingleton()
.getMimeTypeFromExtension(
- mFile.getRemotePath().substring(mFile.getRemotePath().lastIndexOf('.') + 1));
+ mFile.getRemotePath().substring(
+ mFile.getRemotePath().lastIndexOf('.') + 1));
} catch (IndexOutOfBoundsException e) {
} catch (IndexOutOfBoundsException e) {
- Log_OC.e(TAG, "Trying to find out MIME type of a file without extension: " + mFile.getRemotePath());
+ Log_OC.e(TAG, "Trying to find out MIME type of a file without extension: " +
+ mFile.getRemotePath());
}
}
if (mimeType == null) {
}
}
if (mimeType == null) {
@@
-119,7
+123,8
@@
public class DownloadFileOperation extends RemoteOperation {
}
public long getModificationTimestamp() {
}
public long getModificationTimestamp() {
- return (mModificationTimestamp > 0) ? mModificationTimestamp : mFile.getModificationTimestamp();
+ return (mModificationTimestamp > 0) ? mModificationTimestamp :
+ mFile.getModificationTimestamp();
}
@Override
}
@Override
@@
-152,15
+157,12
@@
public class DownloadFileOperation extends RemoteOperation {
newFile = new File(getSavePath());
newFile.getParentFile().mkdirs();
moved = tmpFile.renameTo(newFile);
newFile = new File(getSavePath());
newFile.getParentFile().mkdirs();
moved = tmpFile.renameTo(newFile);
-
- MediaScannerConnection.scanFile(MainApp.getAppContext(),
- new String[]{newFile.getAbsolutePath()}, null, null);
-
-
if (!moved)
if (!moved)
- result = new RemoteOperationResult(RemoteOperationResult.ResultCode.LOCAL_STORAGE_NOT_MOVED);
+ result = new RemoteOperationResult(
+ RemoteOperationResult.ResultCode.LOCAL_STORAGE_NOT_MOVED);
}
}
- Log_OC.i(TAG, "Download of " + mFile.getRemotePath() + " to " + getSavePath() + ": " + result.getLogMessage());
+ Log_OC.i(TAG, "Download of " + mFile.getRemotePath() + " to " + getSavePath() + ": " +
+ result.getLogMessage());
return result;
}
return result;
}
@@
-184,5
+186,4
@@
public class DownloadFileOperation extends RemoteOperation {
mDataTransferListeners.remove(listener);
}
}
mDataTransferListeners.remove(listener);
}
}
-
}
}