From 5f623e0c4a0bf0bd2ce4319aa6d43217333b98a7 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 23 May 2016 22:32:03 +0200 Subject: [PATCH] after downloading is complete, update notification to "Tap to install" f9a30d2e1c9d95302e8f4dd0e733d019f70bed66 broke the "Tap to install" aspect. --- .../installer/InstallManagerService.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/installer/InstallManagerService.java b/app/src/main/java/org/fdroid/fdroid/installer/InstallManagerService.java index 809825921..144eeef95 100644 --- a/app/src/main/java/org/fdroid/fdroid/installer/InstallManagerService.java +++ b/app/src/main/java/org/fdroid/fdroid/installer/InstallManagerService.java @@ -240,7 +240,7 @@ public class InstallManagerService extends Service { if (AppDetails.isAppVisible(apk.packageName)) { cancelNotification(urlString); } else { - notifyDownloadComplete(urlString, builder, apk); + notifyDownloadComplete(urlString, apk); } unregisterDownloaderReceivers(urlString); } @@ -312,9 +312,14 @@ public class InstallManagerService extends Service { /** * Post a notification about a completed download. {@code packageName} must be a valid - * and currently in the app index database. + * and currently in the app index database. This must create a new {@code Builder} + * instance otherwise the progress/cancel stuff does not go away. + * + * @see Issue 47809: + * Removing the progress bar from a notification should cause the notification's content + * text to return to normal size */ - private void notifyDownloadComplete(String urlString, NotificationCompat.Builder builder, Apk apk) { + private void notifyDownloadComplete(String urlString, Apk apk) { String title; try { PackageManager pm = getPackageManager(); @@ -325,12 +330,16 @@ public class InstallManagerService extends Service { } int downloadUrlId = urlString.hashCode(); - builder.setAutoCancel(true) + notificationManager.cancel(downloadUrlId); + Notification notification = new NotificationCompat.Builder(this) + .setAutoCancel(true) .setOngoing(false) .setContentTitle(title) + .setContentIntent(getAppDetailsIntent(downloadUrlId, apk)) .setSmallIcon(android.R.drawable.stat_sys_download_done) - .setContentText(getString(R.string.tap_to_install)); - notificationManager.notify(downloadUrlId, builder.build()); + .setContentText(getString(R.string.tap_to_install)) + .build(); + notificationManager.notify(downloadUrlId, notification); } /**