X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/2946d8dd69cf8d30a3fc2447ac931675989e8eff..d252a09f53999a90036048d4db33c8b4f2f04c4f:/src/com/owncloud/android/files/services/FileObserverService.java diff --git a/src/com/owncloud/android/files/services/FileObserverService.java b/src/com/owncloud/android/files/services/FileObserverService.java index fd1412c1..7aa3fa9a 100644 --- a/src/com/owncloud/android/files/services/FileObserverService.java +++ b/src/com/owncloud/android/files/services/FileObserverService.java @@ -30,6 +30,7 @@ import com.owncloud.android.files.OwnCloudFileObserver; import com.owncloud.android.operations.SynchronizeFileOperation; import com.owncloud.android.utils.FileStorageUtils; + import android.accounts.Account; import android.accounts.AccountManager; import android.app.Service; @@ -56,7 +57,7 @@ public class FileObserverService extends Service { private static Map mObserversMap; private static DownloadCompletedReceiverBis mDownloadReceiver; private IBinder mBinder = new LocalBinder(); - + public class LocalBinder extends Binder { FileObserverService getService() { return FileObserverService.this; @@ -67,9 +68,10 @@ public class FileObserverService extends Service { public void onCreate() { super.onCreate(); mDownloadReceiver = new DownloadCompletedReceiverBis(); + IntentFilter filter = new IntentFilter(); - filter.addAction(FileDownloader.DOWNLOAD_ADDED_MESSAGE); - filter.addAction(FileDownloader.DOWNLOAD_FINISH_MESSAGE); + filter.addAction(FileDownloader.getDownloadAddedMessage()); + filter.addAction(FileDownloader.getDownloadFinishMessage()); registerReceiver(mDownloadReceiver, filter); mObserversMap = new HashMap(); @@ -259,12 +261,12 @@ public class FileObserverService extends Service { String downloadPath = intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH); OwnCloudFileObserver observer = mObserversMap.get(downloadPath); if (observer != null) { - if (intent.getAction().equals(FileDownloader.DOWNLOAD_FINISH_MESSAGE) && + if (intent.getAction().equals(FileDownloader.getDownloadFinishMessage()) && new File(downloadPath).exists()) { // the download could be successful. not; in both cases, the file could be down, due to a former download or upload observer.startWatching(); Log_OC.d(TAG, "Watching again " + downloadPath); - } else if (intent.getAction().equals(FileDownloader.DOWNLOAD_ADDED_MESSAGE)) { + } else if (intent.getAction().equals(FileDownloader.getDownloadAddedMessage())) { observer.stopWatching(); Log_OC.d(TAG, "Disabling observance of " + downloadPath); }