private WebdavClient mDownloadClient = null;\r
private Account mLastAccount = null;\r
\r
- //private AbstractList<Account> mAccounts = new Vector<Account>();\r
private ConcurrentMap<String, DownloadFileOperation> mPendingDownloads = new ConcurrentHashMap<String, DownloadFileOperation>();\r
private DownloadFileOperation mCurrentDownload = null;\r
\r
- /*\r
- private Account mAccount;\r
- private String mFilePath;\r
- private String mRemotePath;\r
- private long mTotalDownloadSize;\r
- private long mCurrentDownloadSize;\r
- */\r
- \r
private NotificationManager mNotificationMngr;\r
private Notification mNotification;\r
private int mLastPercent;\r
\r
\r
/**\r
- * Static map with the files being download and the path to the temporal file were are download\r
- */\r
- //private static Set<String> mDownloadsInProgress = Collections.synchronizedSet(new HashSet<String>());\r
- \r
- /**\r
- * Returns True when the file referred by 'remotePath' in the ownCloud account 'account' is downloading\r
- */\r
- /*public static boolean isDownloading(Account account, String remotePath) {\r
- return (mDownloadsInProgress.contains(buildRemoteName(account.name, remotePath)));\r
- }*/\r
- \r
- /**\r
* Builds a key for mDownloadsInProgress from the accountName and remotePath\r
*/\r
private static String buildRemoteName(String accountName, String remotePath) {\r
* @param remotePath URL to the remote file in the queue of downloads.\r
*/\r
public void cancel(Account account, String remotePath) {\r
+ DownloadFileOperation download = null;\r
synchronized (mPendingDownloads) {\r
- DownloadFileOperation download = mPendingDownloads.remove(buildRemoteName(account.name, remotePath));\r
- if (download != null) {\r
- download.cancel();\r
- }\r
+ download = mPendingDownloads.remove(buildRemoteName(account.name, remotePath));\r
+ }\r
+ if (download != null) {\r
+ download.cancel();\r
}\r
}\r
\r