Revision d0d287f6
| F-Droid/src/org/fdroid/fdroid/net/AsyncDownloaderFromAndroid.java | ||
|---|---|---|
| 40 | 40 |
* sense to have an async task without any way to notify the outside |
| 41 | 41 |
* world about completion. Therefore, we require the listener as a |
| 42 | 42 |
* parameter to the constructor. |
| 43 |
* |
|
| 44 |
* @param listener |
|
| 45 | 43 |
*/ |
| 46 | 44 |
public AsyncDownloaderFromAndroid(Context context, Listener listener, String appName, String appId, String remoteAddress, File localFile) {
|
| 47 | 45 |
super(null, listener); |
| ... | ... | |
| 97 | 95 |
|
| 98 | 96 |
/** |
| 99 | 97 |
* Copy input file to output file |
| 100 |
* @param inputFile |
|
| 101 |
* @param outputFile |
|
| 102 | 98 |
* @throws IOException |
| 103 | 99 |
*/ |
| 104 | 100 |
private void copyFile(FileDescriptor inputFile, File outputFile) throws IOException {
|
| ... | ... | |
| 174 | 170 |
|
| 175 | 171 |
/** |
| 176 | 172 |
* Extract the appId from a given download id. |
| 177 |
* @param context |
|
| 178 |
* @param downloadId |
|
| 179 | 173 |
* @return - appId or null if not found |
| 180 | 174 |
*/ |
| 181 | 175 |
public static String getAppId(Context context, long downloadId) {
|
| ... | ... | |
| 199 | 193 |
|
| 200 | 194 |
/** |
| 201 | 195 |
* Extract the download title from a given download id. |
| 202 |
* @param context |
|
| 203 |
* @param downloadId |
|
| 204 | 196 |
* @return - title or null if not found |
| 205 | 197 |
*/ |
| 206 | 198 |
public static String getDownloadTitle(Context context, long downloadId) {
|
| ... | ... | |
| 224 | 216 |
|
| 225 | 217 |
/** |
| 226 | 218 |
* Get the downloadId from an Intent sent by the DownloadManagerReceiver |
| 227 |
* @param intent |
|
| 228 |
* @return |
|
| 229 | 219 |
*/ |
| 230 | 220 |
public static long getDownloadId(Intent intent) {
|
| 231 | 221 |
if (intent != null) {
|
| ... | ... | |
| 248 | 238 |
|
| 249 | 239 |
/** |
| 250 | 240 |
* Check if a download is running for the app |
| 251 |
* @param context |
|
| 252 |
* @param appId |
|
| 253 | 241 |
* @return -1 if not downloading, else the downloadId |
| 254 | 242 |
*/ |
| 255 | 243 |
public static long isDownloading(Context context, String appId) {
|
| ... | ... | |
| 274 | 262 |
|
| 275 | 263 |
/** |
| 276 | 264 |
* Check if a download for an app is complete. |
| 277 |
* @param context |
|
| 278 |
* @param appId |
|
| 279 | 265 |
* @return -1 if download is not complete, otherwise the download id |
| 280 | 266 |
*/ |
| 281 | 267 |
public static long isDownloadComplete(Context context, String appId) {
|
Also available in: Unified diff