From: David A. Velasco Date: Tue, 2 Dec 2014 08:21:35 +0000 (+0100) Subject: Refactoring: moved MediaScan trigger from DownloadFileOperation to FileDownloader... X-Git-Tag: oc-android-1.7.0_signed~90^2~6 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/87f911c1edec647147738e28dd1f087be9b3d718?ds=inline;hp=--cc Refactoring: moved MediaScan trigger from DownloadFileOperation to FileDownloader service via FileDataStorageManager --- 87f911c1edec647147738e28dd1f087be9b3d718 diff --git a/src/com/owncloud/android/files/services/FileDownloader.java b/src/com/owncloud/android/files/services/FileDownloader.java index fdc35f8d..c9ad9611 100644 --- a/src/com/owncloud/android/files/services/FileDownloader.java +++ b/src/com/owncloud/android/files/services/FileDownloader.java @@ -400,6 +400,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis file.setFileLength((new File(mCurrentDownload.getSavePath()).length())); file.setRemoteId(mCurrentDownload.getFile().getRemoteId()); mStorageManager.saveFile(file); + mStorageManager.triggerMediaScan(file.getStoragePath()); } diff --git a/src/com/owncloud/android/operations/DownloadFileOperation.java b/src/com/owncloud/android/operations/DownloadFileOperation.java index d0d249e0..0a5ff94c 100644 --- a/src/com/owncloud/android/operations/DownloadFileOperation.java +++ b/src/com/owncloud/android/operations/DownloadFileOperation.java @@ -23,7 +23,6 @@ import java.util.Iterator; 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; @@ -35,7 +34,6 @@ import com.owncloud.android.lib.resources.files.DownloadRemoteFileOperation; import com.owncloud.android.utils.FileStorageUtils; import android.accounts.Account; -import android.media.MediaScannerConnection; import android.webkit.MimeTypeMap; /** @@ -152,11 +150,6 @@ public class DownloadFileOperation extends RemoteOperation { newFile = new File(getSavePath()); newFile.getParentFile().mkdirs(); moved = tmpFile.renameTo(newFile); - - MediaScannerConnection.scanFile(MainApp.getAppContext(), - new String[]{newFile.getAbsolutePath()}, null, null); - - if (!moved) result = new RemoteOperationResult(RemoteOperationResult.ResultCode.LOCAL_STORAGE_NOT_MOVED); }