X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/cec7baba5b77f7acb39fefbe6c6e6bd259130472..d2883905c637467f46964abaf7dd199f47f6fba9:/src/com/owncloud/android/files/services/FileDownloader.java diff --git a/src/com/owncloud/android/files/services/FileDownloader.java b/src/com/owncloud/android/files/services/FileDownloader.java index 12ec4654..ab9e3327 100644 --- a/src/com/owncloud/android/files/services/FileDownloader.java +++ b/src/com/owncloud/android/files/services/FileDownloader.java @@ -95,7 +95,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis private NotificationManager mNotificationManager; private NotificationCompat.Builder mNotificationBuilder; private int mLastPercent; - + public static String getDownloadAddedMessage() { return FileDownloader.class.getName().toString() + DOWNLOAD_ADDED_MESSAGE; @@ -147,13 +147,17 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis Log_OC.e(TAG, "Not enough information provided in intent"); return START_NOT_STICKY; } else { - Account account = intent.getParcelableExtra(EXTRA_ACCOUNT); - OCFile file = intent.getParcelableExtra(EXTRA_FILE); + final Account account = intent.getParcelableExtra(EXTRA_ACCOUNT); + final OCFile file = intent.getParcelableExtra(EXTRA_FILE); if (ACTION_CANCEL_FILE_DOWNLOAD.equals(intent.getAction())) { - // Cancel the download - cancel(account,file); + new Thread(new Runnable() { + public void run() { + // Cancel the download + cancel(account, file); + } + }).start(); } else { @@ -249,6 +253,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis * @param account Owncloud account where the remote file is stored. * @param file A file that could be in the queue of downloads. */ + /* public boolean isDownloading(Account account, OCFile file) { if (account == null || file == null) return false; String targetKey = buildRemoteName(account, file); @@ -266,6 +271,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis } } } + */ /** @@ -573,12 +579,6 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis * @param file File OCFile */ public void cancel(Account account, OCFile file){ - if(Looper.myLooper() == Looper.getMainLooper()) { - Log_OC.d(TAG, "Current Thread is Main Thread."); - } else { - Log_OC.d(TAG, "Current Thread is NOT Main Thread."); - } - DownloadFileOperation download = null; String targetKey = buildRemoteName(account, file); ArrayList keyItems = new ArrayList(); @@ -595,6 +595,7 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis } } } else { + // this is not really expected... Log_OC.d(TAG, "Canceling file download"); keyItems.add(buildRemoteName(account, file)); }