From e827be1b5b389da7259fd5abff470cc0ac990a39 Mon Sep 17 00:00:00 2001 From: Toby Kurien Date: Fri, 4 Sep 2015 13:57:48 +0200 Subject: [PATCH] when user clicks on notification, the app details screen now comes up. If there are multiple downloads, the first one is shown. --- F-Droid/src/org/fdroid/fdroid/AppDetails.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/F-Droid/src/org/fdroid/fdroid/AppDetails.java b/F-Droid/src/org/fdroid/fdroid/AppDetails.java index a5149501c..90d400a66 100644 --- a/F-Droid/src/org/fdroid/fdroid/AppDetails.java +++ b/F-Droid/src/org/fdroid/fdroid/AppDetails.java @@ -371,6 +371,14 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A return AsyncDownloader.getAppId(this, downloadId); } + if (i.hasExtra(DownloadManager.EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS)) { + // we have been passed a DownloadManager download id, so get the app id for it + long[] downloadIds = i.getLongArrayExtra(DownloadManager.EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS); + if (downloadIds != null && downloadIds.length > 0) { + return AsyncDownloader.getAppId(this, downloadIds[0]); + } + } + Log.e(TAG, "No application ID found in the intent!"); return null; } @@ -442,8 +450,9 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A // Check if a download is running for this app if (AsyncDownloader.isDownloading(this, app.id) >= 0) { - // call install to re-setup the listeners and downloaders - // the AsyncDownloader will not restart the download since the download is running + // call install() to re-setup the listeners and downloaders + // the AsyncDownloader will not restart the download since the download is running, + // and thus the version we pass to install() is not important refreshHeader(); refreshApkList(); final Apk apkToInstall = ApkProvider.Helper.find(this, app.id, app.suggestedVercode);