projects
/
pub
/
Android
/
ownCloud.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
10b980c
)
- moved MediaScan to DownloadFileOperation.
author
tobiasKaminsky
<tobias@kaminsky.me>
Wed, 22 Oct 2014 09:20:08 +0000
(11:20 +0200)
committer
tobiasKaminsky
<tobias@kaminsky.me>
Wed, 22 Oct 2014 09:20:08 +0000
(11:20 +0200)
src/com/owncloud/android/operations/DownloadFileOperation.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/operations/SynchronizeFileOperation.java
patch
|
blob
|
blame
|
history
src/com/owncloud/android/services/observer/FileObserverService.java
patch
|
blob
|
blame
|
history
diff --git
a/src/com/owncloud/android/operations/DownloadFileOperation.java
b/src/com/owncloud/android/operations/DownloadFileOperation.java
index
9f2bed7
..
f3eace9
100644
(file)
--- a/
src/com/owncloud/android/operations/DownloadFileOperation.java
+++ b/
src/com/owncloud/android/operations/DownloadFileOperation.java
@@
-23,6
+23,7
@@
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
+import com.owncloud.android.MainApp;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.network.OnDatatransferProgressListener;
import com.owncloud.android.lib.common.OwnCloudClient;
@@
-34,6
+35,7
@@
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;
/**
import android.webkit.MimeTypeMap;
/**
@@
-150,6
+152,11
@@
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);
+
+ Log_OC.d("mediaScan", "mediaScan : " + newFile.getAbsolutePath());
+ MediaScannerConnection.scanFile(MainApp.getAppContext(),
+ new String[]{newFile.getAbsolutePath()}, null, null);
+
if (!moved)
result = new RemoteOperationResult(RemoteOperationResult.ResultCode.LOCAL_STORAGE_NOT_MOVED);
if (!moved)
result = new RemoteOperationResult(RemoteOperationResult.ResultCode.LOCAL_STORAGE_NOT_MOVED);
diff --git
a/src/com/owncloud/android/operations/SynchronizeFileOperation.java
b/src/com/owncloud/android/operations/SynchronizeFileOperation.java
index
6bc3321
..
433acf7
100644
(file)
--- a/
src/com/owncloud/android/operations/SynchronizeFileOperation.java
+++ b/
src/com/owncloud/android/operations/SynchronizeFileOperation.java
@@
-195,13
+195,6
@@
public class SynchronizeFileOperation extends SyncOperation {
}
}
}
}
-
- // trigger MediaScan
- MediaScannerConnection.scanFile(
- null,
- new String[]{mLocalFile.getStoragePath()},
- null,null);
-
Log_OC.i(TAG, "Synchronizing " + mAccount.name + ", file " + mLocalFile.getRemotePath() + ": " + result.getLogMessage());
return result;
Log_OC.i(TAG, "Synchronizing " + mAccount.name + ", file " + mLocalFile.getRemotePath() + ": " + result.getLogMessage());
return result;
diff --git
a/src/com/owncloud/android/services/observer/FileObserverService.java
b/src/com/owncloud/android/services/observer/FileObserverService.java
index
fb9df7c
..
d81f35b
100644
(file)
--- a/
src/com/owncloud/android/services/observer/FileObserverService.java
+++ b/
src/com/owncloud/android/services/observer/FileObserverService.java
@@
-353,7
+353,7
@@
public class FileObserverService extends Service {
Log_OC.d(TAG, "Received broadcast intent " + intent);
File downloadedFile = new File(intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH));
Log_OC.d(TAG, "Received broadcast intent " + intent);
File downloadedFile = new File(intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH));
- String parentPath = downloadedFile.getParent();
+ String parentPath = downloadedFile.getParent();
FolderObserver observer = mFolderObserversMap.get(parentPath);
if (observer != null) {
if (intent.getAction().equals(FileDownloader.getDownloadFinishMessage())
FolderObserver observer = mFolderObserversMap.get(parentPath);
if (observer != null) {
if (intent.getAction().equals(FileDownloader.getDownloadFinishMessage())
@@
-369,13
+369,6
@@
public class FileObserverService extends Service {
}
} else {
}
} else {
-
- if (downloadedFile.exists()){
- Log_OC.d("mediaScan", "mediaScan : " + downloadedFile.getAbsolutePath());
- MediaScannerConnection.scanFile(getApplicationContext(),
- new String[]{downloadedFile.getAbsolutePath()}, null, null);
- }
-
Log_OC.d(TAG, "No observer for path " + downloadedFile.getAbsolutePath());
}
}
Log_OC.d(TAG, "No observer for path " + downloadedFile.getAbsolutePath());
}
}