From 9588f30778e37687c604802f7beb63077160a11e Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 25 Feb 2014 15:00:55 -0500 Subject: [PATCH] normalize null checks for ProgressListeners This removes the RepoUpdater.isInteractive() method to normalize the code used to check whether a ProgressListener is null throughout the project. --- src/org/fdroid/fdroid/updater/RepoUpdater.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/org/fdroid/fdroid/updater/RepoUpdater.java b/src/org/fdroid/fdroid/updater/RepoUpdater.java index 3382368cb..357b75dfa 100644 --- a/src/org/fdroid/fdroid/updater/RepoUpdater.java +++ b/src/org/fdroid/fdroid/updater/RepoUpdater.java @@ -66,10 +66,6 @@ abstract public class RepoUpdater { return apks; } - public boolean isInteractive() { - return progressListener != null; - } - /** * For example, you may want to unzip a jar file to get the index inside, * or if the file is not compressed, you can just return a reference to @@ -88,7 +84,7 @@ abstract public class RepoUpdater { downloader = new HttpDownloader(getIndexAddress(), context); downloader.setETag(repo.lastetag); - if (isInteractive()) { + if (progressListener != null) { // interactive session, show progress downloader.setProgressListener(progressListener, new ProgressListener.Event(PROGRESS_TYPE_DOWNLOAD, repo.address)); } @@ -171,7 +167,7 @@ abstract public class RepoUpdater { XMLReader reader = parser.getXMLReader(); RepoXMLHandler handler = new RepoXMLHandler(repo, progressListener); - if (isInteractive()) { + if (progressListener != null) { // Only bother spending the time to count the expected apps // if we can show that to the user... handler.setTotalAppCount(estimateAppCount(indexFile));