From 1f035a9696cb78bc207e96d1d48e7ee63e03842f Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Fri, 7 Apr 2017 14:46:47 +1000 Subject: [PATCH 1/5] Don't re-use existing pending intents. When dismissing an "X installed successfully" intent, it should also dismiss the relevant item from the "Updates" screen. This was not happening. Upon investigation, I noticed that when I dismissed a notification, it was passing through the Apk which I installed over a day ago. This is because it was reusing a previous pending intent rather than creating a new one. --- .../java/org/fdroid/fdroid/NotificationHelper.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java b/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java index 59313f8eb..ffd9303cb 100644 --- a/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java +++ b/app/src/main/java/org/fdroid/fdroid/NotificationHelper.java @@ -371,7 +371,7 @@ class NotificationHelper { Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_UPDATE_CLEARED); intentDeleted.putExtra(EXTRA_NOTIFICATION_KEY, entry.getUniqueKey()); - PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, 0); + PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT); builder.setDeleteIntent(piDeleted); return builder.build(); } @@ -429,7 +429,7 @@ class NotificationHelper { } Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_ALL_UPDATES_CLEARED); - PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, 0); + PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT); builder.setDeleteIntent(piDeleted); return builder.build(); } @@ -456,7 +456,7 @@ class NotificationHelper { Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_INSTALLED_CLEARED); intentDeleted.putExtra(EXTRA_NOTIFICATION_KEY, entry.getUniqueKey()); - PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, 0); + PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT); builder.setDeleteIntent(piDeleted); return builder.build(); } @@ -484,7 +484,7 @@ class NotificationHelper { // Intent to open main app list Intent intentObject = new Intent(context, MainActivity.class); - PendingIntent piAction = PendingIntent.getActivity(context, 0, intentObject, 0); + PendingIntent piAction = PendingIntent.getActivity(context, 0, intentObject, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder builder = new NotificationCompat.Builder(context) @@ -501,7 +501,7 @@ class NotificationHelper { .setGroupSummary(true); } Intent intentDeleted = new Intent(BROADCAST_NOTIFICATIONS_ALL_INSTALLED_CLEARED); - PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, 0); + PendingIntent piDeleted = PendingIntent.getBroadcast(context, 0, intentDeleted, PendingIntent.FLAG_UPDATE_CURRENT); builder.setDeleteIntent(piDeleted); return builder.build(); } From 34c741f8359c5852ea12f2f940a38293a6b3841c Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Fri, 7 Apr 2017 14:59:54 +1000 Subject: [PATCH 2/5] Clear up confusion around "Tick" icon when updating app. When navigating to Updates -> Show Apps and then downloading an item, it shows the download progress inline for that item. After this is complete, it then shows a tick icon next to the item. The long term goal should be to remove the list item from under "Show Apps" so that it is only shown at the top of the "Updates" view. However this will require more work. In the meantime, we can alleviate some confusion by replacing the "Tick" icon with a button that says "Update" (like the other buttons in the Update view). --- .../views/apps/AppListItemController.java | 6 ++-- .../res/drawable/ic_download_complete.xml | 33 ------------------- .../res/layout/updateable_app_list_item.xml | 16 ++++++++- 3 files changed, 17 insertions(+), 38 deletions(-) delete mode 100644 app/src/main/res/drawable/ic_download_complete.xml diff --git a/app/src/main/java/org/fdroid/fdroid/views/apps/AppListItemController.java b/app/src/main/java/org/fdroid/fdroid/views/apps/AppListItemController.java index 08e349509..92b01e730 100644 --- a/app/src/main/java/org/fdroid/fdroid/views/apps/AppListItemController.java +++ b/app/src/main/java/org/fdroid/fdroid/views/apps/AppListItemController.java @@ -329,9 +329,7 @@ public class AppListItemController extends RecyclerView.ViewHolder { } if (isReadyToInstall(app)) { - installButton.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.ic_download_complete)); - installButton.setVisibility(View.VISIBLE); - // TODO: If in the downloading phase, then need to reflect that instead of this "download complete" icon. + installButton.setVisibility(View.GONE); } else { boolean installable = app.canAndWantToUpdate(activity) || !app.isInstalled(); boolean shouldAllow = app.compatible && !app.isFiltered(); @@ -386,7 +384,7 @@ public class AppListItemController extends RecyclerView.ViewHolder { private void onDownloadComplete() { if (installButton != null) { - installButton.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.ic_download_complete)); + installButton.setVisibility(View.GONE); } if (progressBar != null) { diff --git a/app/src/main/res/drawable/ic_download_complete.xml b/app/src/main/res/drawable/ic_download_complete.xml deleted file mode 100644 index 5074a5848..000000000 --- a/app/src/main/res/drawable/ic_download_complete.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/app/src/main/res/layout/updateable_app_list_item.xml b/app/src/main/res/layout/updateable_app_list_item.xml index 161116c87..1ee83c0e4 100644 --- a/app/src/main/res/layout/updateable_app_list_item.xml +++ b/app/src/main/res/layout/updateable_app_list_item.xml @@ -55,8 +55,22 @@ android:layout_marginRight="16dp" android:layout_marginTop="8dp" android:layout_marginBottom="8dp" - app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintEnd_toStartOf="@+id/action_button" app:layout_constraintTop_toTopOf="@+id/icon" app:layout_constraintBottom_toBottomOf="@+id/icon" /> +