From b69587ca65260286e95eea9e5df4a3c0f9e4b6df Mon Sep 17 00:00:00 2001 From: Peter Serwylo Date: Fri, 26 May 2017 15:59:38 +1000 Subject: [PATCH] Make contract about nullable currentApp explicit. This identified a couple of places where it needed to be guarded against. --- .../fdroid/fdroid/views/apps/AppListItemController.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 c9e387e23..5a3ce3af0 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 @@ -47,7 +47,6 @@ import org.fdroid.fdroid.net.DownloaderService; import java.io.File; // TODO: Support cancelling of downloads by tapping the install button a second time. -// TODO: Support installing of an app once downloaded by tapping the install button a second time. public class AppListItemController extends RecyclerView.ViewHolder { private static final String TAG = "AppListItemController"; @@ -79,13 +78,15 @@ public class AppListItemController extends RecyclerView.ViewHolder { private final ImageButton cancelButton; /** - * Will operate as the "Download is complete, click to (install|update)" button. + * Will operate as the "Download is complete, click to (install|update)" button, as well as the + * "Installed successfully, click to run" button. */ @Nullable private final Button actionButton; private final DisplayImageOptions displayImageOptions; + @Nullable private App currentApp; private String currentAppDownloadUrl; @@ -416,7 +417,9 @@ public class AppListItemController extends RecyclerView.ViewHolder { cancelButton.setVisibility(View.GONE); } - configureActionButton(currentApp); + if (currentApp != null) { + configureActionButton(currentApp); + } } @SuppressWarnings("FieldCanBeLocal")