import android.os.Message;\r
import android.os.Process;\r
import android.util.Log;\r
+import android.widget.ProgressBar;\r
import android.widget.RemoteViews;\r
\r
import com.owncloud.android.R;\r
}\r
}\r
}\r
+\r
+ \r
+ /**\r
+ * Adds a listener interested in the progress of the download for a concrete file.\r
+ * \r
+ * @param listener Object to notify about progress of transfer. \r
+ * @param account ownCloud account holding the file of interest.\r
+ * @param file {@link OCfile} of interest for listener. \r
+ */\r
+ public void addDatatransferProgressListener (OnDatatransferProgressListener listener, Account account, OCFile file) {\r
+ if (account == null || file == null) return;\r
+ String targetKey = buildRemoteName(account, file);\r
+ DownloadFileOperation target = null;\r
+ synchronized (mPendingDownloads) {\r
+ if (!file.isDirectory()) {\r
+ target = mPendingDownloads.get(targetKey);\r
+ } else {\r
+ // nothing to do for directories, right now\r
+ }\r
+ }\r
+ if (target != null) {\r
+ target.addDatatransferProgressListener(listener);\r
+ }\r
+ }\r
+ \r
+ \r
+ /**\r
+ * Removes a listener interested in the progress of the download for a concrete file.\r
+ * \r
+ * @param listener Object to notify about progress of transfer. \r
+ * @param account ownCloud account holding the file of interest.\r
+ * @param file {@link OCfile} of interest for listener. \r
+ */\r
+ public void removeDatatransferProgressListener (OnDatatransferProgressListener listener, Account account, OCFile file) {\r
+ if (account == null || file == null) return;\r
+ String targetKey = buildRemoteName(account, file);\r
+ DownloadFileOperation target = null;\r
+ synchronized (mPendingDownloads) {\r
+ if (!file.isDirectory()) {\r
+ target = mPendingDownloads.get(targetKey);\r
+ } else {\r
+ // nothing to do for directories, right now\r
+ }\r
+ }\r
+ if (target != null) {\r
+ target.removeDatatransferProgressListener(listener);\r
+ }\r
+ }\r
+ \r
}\r
\r
\r