Make contract about nullable currentApp explicit.

This identified a couple of places where it needed to be guarded
against.
This commit is contained in:
Peter Serwylo 2017-05-26 15:59:38 +10:00
parent 7d1fac2729
commit b69587ca65

View File

@ -47,7 +47,6 @@ import org.fdroid.fdroid.net.DownloaderService;
import java.io.File; import java.io.File;
// TODO: Support cancelling of downloads by tapping the install button a second time. // 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 { public class AppListItemController extends RecyclerView.ViewHolder {
private static final String TAG = "AppListItemController"; private static final String TAG = "AppListItemController";
@ -79,13 +78,15 @@ public class AppListItemController extends RecyclerView.ViewHolder {
private final ImageButton cancelButton; 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 @Nullable
private final Button actionButton; private final Button actionButton;
private final DisplayImageOptions displayImageOptions; private final DisplayImageOptions displayImageOptions;
@Nullable
private App currentApp; private App currentApp;
private String currentAppDownloadUrl; private String currentAppDownloadUrl;
@ -416,7 +417,9 @@ public class AppListItemController extends RecyclerView.ViewHolder {
cancelButton.setVisibility(View.GONE); cancelButton.setVisibility(View.GONE);
} }
configureActionButton(currentApp); if (currentApp != null) {
configureActionButton(currentApp);
}
} }
@SuppressWarnings("FieldCanBeLocal") @SuppressWarnings("FieldCanBeLocal")