From d68b45fd3088a48f7ae09da987592d08e08b653d Mon Sep 17 00:00:00 2001 From: Herbert Reiter <46045854+damoasda@users.noreply.github.com> Date: Sun, 15 Nov 2020 14:26:07 +0100 Subject: [PATCH] Refactoring: Remove callback functions with constant value --- .../config/DownloadServiceCallbacksImpl.java | 5 ----- .../config/PlaybackServiceCallbacksImpl.java | 6 ------ .../antennapod/core/DownloadServiceCallbacks.java | 10 ++-------- .../antennapod/core/PlaybackServiceCallbacks.java | 7 ------- .../core/service/download/DownloadService.java | 3 +-- .../core/service/playback/PlaybackService.java | 4 ---- 6 files changed, 3 insertions(+), 32 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java index 71442f50b..55bf05e43 100644 --- a/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java +++ b/app/src/main/java/de/danoeh/antennapod/config/DownloadServiceCallbacksImpl.java @@ -54,9 +54,4 @@ public class DownloadServiceCallbacksImpl implements DownloadServiceCallbacks { return PendingIntent.getActivity(context, R.id.pending_intent_download_service_autodownload_report, intent, PendingIntent.FLAG_UPDATE_CURRENT); } - - @Override - public boolean shouldCreateReport() { - return true; - } } diff --git a/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java b/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java index 44f18e9da..5172c4974 100644 --- a/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java +++ b/app/src/main/java/de/danoeh/antennapod/config/PlaybackServiceCallbacksImpl.java @@ -22,10 +22,4 @@ public class PlaybackServiceCallbacksImpl implements PlaybackServiceCallbacks { return i; } } - - @Override - public boolean useQueue() { - return true; - } - } diff --git a/core/src/main/java/de/danoeh/antennapod/core/DownloadServiceCallbacks.java b/core/src/main/java/de/danoeh/antennapod/core/DownloadServiceCallbacks.java index ad3fb8d42..ae9b47629 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/DownloadServiceCallbacks.java +++ b/core/src/main/java/de/danoeh/antennapod/core/DownloadServiceCallbacks.java @@ -37,7 +37,7 @@ public interface DownloadServiceCallbacks { *

* The PendingIntent takes users to an activity where they can look at all successful and failed downloads. * - * @return A non-null PendingIntent for the notification or null if shouldCreateReport()==false + * @return A non-null PendingIntent for the notification */ PendingIntent getReportNotificationContentIntent(Context context); @@ -47,14 +47,8 @@ public interface DownloadServiceCallbacks { *

* The PendingIntent takes users to an activity where they can look at their episode queue. * - * @return A non-null PendingIntent for the notification or null if shouldCreateReport()==false + * @return A non-null PendingIntent for the notification */ PendingIntent getAutoDownloadReportNotificationContentIntent(Context context); - - /** - * Returns true if the DownloadService should create a report that shows the number of failed - * downloads when the service shuts down. - */ - boolean shouldCreateReport(); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/PlaybackServiceCallbacks.java b/core/src/main/java/de/danoeh/antennapod/core/PlaybackServiceCallbacks.java index 194ee65ae..3dcaac4dc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/PlaybackServiceCallbacks.java +++ b/core/src/main/java/de/danoeh/antennapod/core/PlaybackServiceCallbacks.java @@ -19,11 +19,4 @@ public interface PlaybackServiceCallbacks { * @return A non-null activity intent. */ Intent getPlayerActivityIntent(Context context, MediaType mediaType, boolean remotePlayback); - - /** - * Returns true if the PlaybackService should load new episodes from the queue when playback ends - * and false if the PlaybackService should ignore the queue and load no more episodes when playback - * finishes. - */ - boolean useQueue(); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java index a0e1a7041..2fe0aa8a5 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadService.java @@ -205,8 +205,7 @@ public class DownloadService extends Service { isRunning = false; boolean showAutoDownloadReport = UserPreferences.showAutoDownloadReport(); - if (ClientConfig.downloadServiceCallbacks.shouldCreateReport() - && (UserPreferences.showDownloadReport() || showAutoDownloadReport)) { + if (UserPreferences.showDownloadReport() || showAutoDownloadReport) { notificationManager.updateReport(reportQueue, showAutoDownloadReport); reportQueue.clear(); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index 69b35bff5..92fd9cb55 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -973,10 +973,6 @@ public class PlaybackService extends MediaBrowserServiceCompat { Log.d(TAG, "getNextInQueue(), but playable not an instance of FeedMedia, so not proceeding"); return null; } - if (!ClientConfig.playbackServiceCallbacks.useQueue()) { - Log.d(TAG, "getNextInQueue(), but queue not in use by this app"); - return null; - } Log.d(TAG, "getNextInQueue()"); FeedMedia media = (FeedMedia) currentMedia; try {