X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/68ce2e7a381a19df737664755ff7ca4c026155fd..b246cf7075c829a7662047e89a927c0b6cc18ac5:/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 2e0c6863..4969c908 100644 --- a/src/com/owncloud/android/files/services/FileDownloader.java +++ b/src/com/owncloud/android/files/services/FileDownloader.java @@ -52,36 +52,15 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis private WebdavClient mDownloadClient = null; private Account mLastAccount = null; - //private AbstractList mAccounts = new Vector(); private ConcurrentMap mPendingDownloads = new ConcurrentHashMap(); private DownloadFileOperation mCurrentDownload = null; - /* - private Account mAccount; - private String mFilePath; - private String mRemotePath; - private long mTotalDownloadSize; - private long mCurrentDownloadSize; - */ - private NotificationManager mNotificationMngr; private Notification mNotification; private int mLastPercent; /** - * Static map with the files being download and the path to the temporal file were are download - */ - //private static Set mDownloadsInProgress = Collections.synchronizedSet(new HashSet()); - - /** - * Returns True when the file referred by 'remotePath' in the ownCloud account 'account' is downloading - */ - /*public static boolean isDownloading(Account account, String remotePath) { - return (mDownloadsInProgress.contains(buildRemoteName(account.name, remotePath))); - }*/ - - /** * Builds a key for mDownloadsInProgress from the accountName and remotePath */ private static String buildRemoteName(String accountName, String remotePath) { @@ -186,11 +165,12 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis * @param remotePath URL to the remote file in the queue of downloads. */ public void cancel(Account account, String remotePath) { + DownloadFileOperation download = null; synchronized (mPendingDownloads) { - DownloadFileOperation download = mPendingDownloads.remove(buildRemoteName(account.name, remotePath)); - if (download != null) { - download.cancel(); - } + download = mPendingDownloads.remove(buildRemoteName(account.name, remotePath)); + } + if (download != null) { + download.cancel(); } }