diff options
author | H. Lehmann <ByteHamster@users.noreply.github.com> | 2018-10-21 19:12:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-21 19:12:14 +0200 |
commit | 94a4b78449043583570d3b97b758985c78e9f4a6 (patch) | |
tree | 516adc07943008ba02982e44a01798eaff7d84d9 /core/src/main/java/de | |
parent | a05f386793a7790302502983579b528bb6b46eaa (diff) | |
parent | 59c2c5b1d6e007ea7fa8260d994d21743a092f73 (diff) | |
download | AntennaPod-94a4b78449043583570d3b97b758985c78e9f4a6.zip |
Merge branch 'develop' into glide-48
Diffstat (limited to 'core/src/main/java/de')
51 files changed, 108 insertions, 122 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/UpdateManager.java b/core/src/main/java/de/danoeh/antennapod/core/UpdateManager.java index ea07fc76e..8ad70c328 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/UpdateManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/UpdateManager.java @@ -10,20 +10,15 @@ import android.util.Log; import org.antennapod.audio.MediaPlayer; -import java.io.File; -import java.util.List; - -import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.preferences.UserPreferences; -import de.danoeh.antennapod.core.storage.DBReader; -import de.danoeh.antennapod.core.storage.DBWriter; /* * This class's job is do perform maintenance tasks whenever the app has been updated */ class UpdateManager { + private UpdateManager(){} + private static final String TAG = UpdateManager.class.getSimpleName(); private static final String PREF_NAME = "app_version"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/asynctask/FeedRemover.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FeedRemover.java index 74693cf21..4504b2e7f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/asynctask/FeedRemover.java +++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FeedRemover.java @@ -2,14 +2,12 @@ package de.danoeh.antennapod.core.asynctask; import android.app.ProgressDialog; import android.content.Context; -import android.content.Intent; import android.os.AsyncTask; import java.util.concurrent.ExecutionException; import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.feed.Feed; -import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.util.IntentUtils; diff --git a/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrClickWorker.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrClickWorker.java index f4c99011a..318e404c8 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrClickWorker.java +++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrClickWorker.java @@ -10,7 +10,6 @@ import android.support.v4.app.NotificationCompat; import android.util.Log; import android.widget.Toast; -import de.danoeh.antennapod.core.util.gui.NotificationUtils; import org.shredzone.flattr4j.exception.FlattrException; import java.util.LinkedList; @@ -27,6 +26,7 @@ import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.core.util.flattr.FlattrThing; import de.danoeh.antennapod.core.util.flattr.FlattrUtils; +import de.danoeh.antennapod.core.util.gui.NotificationUtils; /** * Performs a click action in a background thread. diff --git a/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrStatusFetcher.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrStatusFetcher.java index 420a60469..6d9ab2bd3 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrStatusFetcher.java +++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrStatusFetcher.java @@ -19,11 +19,9 @@ import de.danoeh.antennapod.core.util.flattr.FlattrUtils; public class FlattrStatusFetcher extends Thread { private static final String TAG = "FlattrStatusFetcher"; - private final Context context; public FlattrStatusFetcher(Context context) { super(); - this.context = context; } @Override diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedComponent.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedComponent.java index a3f91b1c9..2610d253f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedComponent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedComponent.java @@ -50,7 +50,7 @@ public abstract class FeedComponent { @Override public boolean equals(Object o) { if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (o == null || !(o instanceof FeedComponent)) return false; FeedComponent that = (FeedComponent) o; @@ -62,4 +62,4 @@ public abstract class FeedComponent { public int hashCode() { return (int) (id ^ (id >>> 32)); } -}
\ No newline at end of file +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java index b0a87c885..0f0343f25 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedItem.java @@ -2,9 +2,8 @@ package de.danoeh.antennapod.core.feed; import android.database.Cursor; import android.support.annotation.Nullable; - import android.text.TextUtils; -import de.danoeh.antennapod.core.asynctask.ImageResource; + import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -15,6 +14,7 @@ import java.util.Set; import java.util.concurrent.Callable; import java.util.concurrent.TimeUnit; +import de.danoeh.antennapod.core.asynctask.ImageResource; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.PodDBAdapter; import de.danoeh.antennapod.core.util.ShownotesProvider; @@ -194,7 +194,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr if (other.link != null) { link = other.link; } - if (other.pubDate != null && other.pubDate != pubDate) { + if (other.pubDate != null && other.pubDate.equals(pubDate)) { pubDate = other.pubDate; } if (other.media != null) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java index 73d2bb34d..39994ec16 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedMedia.java @@ -532,8 +532,8 @@ public class FeedMedia extends FeedFile implements Playable { UserPreferences.isAutoFlattr() && item.getPaymentLink() != null && item.getFlattrStatus().getUnflattred() && - (completed && autoFlattrThreshold <= 1.0f || - played_duration >= autoFlattrThreshold * duration)) { + ((completed && autoFlattrThreshold <= 1.0f) || + (played_duration >= autoFlattrThreshold * duration))) { DBTasks.flattrItemIfLoggedIn(context, item); } } @@ -626,6 +626,9 @@ public class FeedMedia extends FeedFile implements Playable { @Override public boolean equals(Object o) { + if (o == null) { + return false; + } if (FeedMediaFlavorHelper.instanceOfRemoteMedia(o)) { return o.equals(this); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/glide/ApGlideSettings.java b/core/src/main/java/de/danoeh/antennapod/core/glide/ApGlideSettings.java index fc1acd0e1..d0061af99 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/glide/ApGlideSettings.java +++ b/core/src/main/java/de/danoeh/antennapod/core/glide/ApGlideSettings.java @@ -6,6 +6,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; * The settings that AntennaPod will use for various Glide options */ public class ApGlideSettings { + private ApGlideSettings(){} public static final DiskCacheStrategy AP_DISK_CACHE_STRATEGY = DiskCacheStrategy.ALL; } diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java index b76988fd8..330cde525 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeAction.java @@ -169,7 +169,7 @@ public class GpodnetEpisodeAction { @Override public boolean equals(Object o) { if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (o == null || !(o instanceof GpodnetEpisodeAction)) return false; GpodnetEpisodeAction that = (GpodnetEpisodeAction) o; diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java index b51b8d996..5b17dd338 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/GpodnetPreferences.java @@ -24,6 +24,8 @@ import de.danoeh.antennapod.core.service.GpodnetSyncService; */ public class GpodnetPreferences { + private GpodnetPreferences(){} + private static final String TAG = "GpodnetPreferences"; private static final String PREF_NAME = "gpodder.net"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/SleepTimerPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/SleepTimerPreferences.java index b7ed890f5..0f3a9fcb3 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/SleepTimerPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/SleepTimerPreferences.java @@ -23,7 +23,6 @@ public class SleepTimerPreferences { private static final String DEFAULT_VALUE = "15"; private static final int DEFAULT_TIME_UNIT = 1; - private static Context context; private static SharedPreferences prefs; /** diff --git a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java index 6aaf65e18..e6b5f9e1b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/preferences/UserPreferences.java @@ -8,14 +8,7 @@ import android.support.annotation.NonNull; import android.support.v4.app.NotificationCompat; import android.text.TextUtils; import android.util.Log; -import de.danoeh.antennapod.core.R; -import de.danoeh.antennapod.core.service.download.ProxyConfig; -import de.danoeh.antennapod.core.storage.APCleanupAlgorithm; -import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm; -import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm; -import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithm; -import de.danoeh.antennapod.core.util.Converter; -import de.danoeh.antennapod.core.util.download.AutoUpdateManager; + import org.json.JSONArray; import org.json.JSONException; @@ -27,6 +20,15 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; +import de.danoeh.antennapod.core.R; +import de.danoeh.antennapod.core.service.download.ProxyConfig; +import de.danoeh.antennapod.core.storage.APCleanupAlgorithm; +import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm; +import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm; +import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithm; +import de.danoeh.antennapod.core.util.Converter; +import de.danoeh.antennapod.core.util.download.AutoUpdateManager; + /** * Provides access to preferences set by the user in the settings screen. A * private instance of this class must first be instantiated via @@ -34,6 +36,7 @@ import java.util.concurrent.TimeUnit; * when called. */ public class UserPreferences { + private UserPreferences(){} private static final String IMPORT_DIR = "import/"; @@ -44,7 +47,7 @@ public class UserPreferences { public static final String PREF_HIDDEN_DRAWER_ITEMS = "prefHiddenDrawerItems"; private static final String PREF_DRAWER_FEED_ORDER = "prefDrawerFeedOrder"; private static final String PREF_DRAWER_FEED_COUNTER = "prefDrawerFeedIndicator"; - private static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify"; + public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify"; private static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify"; public static final String PREF_COMPACT_NOTIFICATION_BUTTONS = "prefCompactNotificationButtons"; public static final String PREF_LOCKSCREEN_BACKGROUND = "prefLockscreenBackground"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/receiver/PlayerWidget.java b/core/src/main/java/de/danoeh/antennapod/core/receiver/PlayerWidget.java index edc2ea3e0..7663cdbe4 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/receiver/PlayerWidget.java +++ b/core/src/main/java/de/danoeh/antennapod/core/receiver/PlayerWidget.java @@ -6,10 +6,11 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.util.Log; -import de.danoeh.antennapod.core.service.PlayerWidgetJobService; import java.util.Arrays; +import de.danoeh.antennapod.core.service.PlayerWidgetJobService; + public class PlayerWidget extends AppWidgetProvider { private static final String TAG = "PlayerWidget"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateJobService.java b/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateJobService.java index 55a8d6b86..7d80d4e7c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateJobService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/FeedUpdateJobService.java @@ -5,6 +5,7 @@ import android.app.job.JobService; import android.os.Build; import android.support.annotation.RequiresApi; import android.util.Log; + import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.FeedUpdateUtils; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java b/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java index fe6e8c400..5584991ca 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/GpodnetSyncService.java @@ -6,8 +6,8 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; -import android.support.v4.app.JobIntentService; import android.support.v4.app.NotificationCompat; +import android.support.v4.app.SafeJobIntentService; import android.support.v4.util.ArrayMap; import android.util.Log; import android.util.Pair; @@ -44,7 +44,7 @@ import de.danoeh.antennapod.core.util.gui.NotificationUtils; * Synchronizes local subscriptions with gpodder.net service. The service should be started with ACTION_SYNC as an action argument. * This class also provides static methods for starting the GpodnetSyncService. */ -public class GpodnetSyncService extends JobIntentService { +public class GpodnetSyncService extends SafeJobIntentService { private static final String TAG = "GpodnetSyncService"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java b/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java index d2214cac8..6dab9a561 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/PlayerWidgetJobService.java @@ -9,23 +9,24 @@ import android.content.ServiceConnection; import android.os.Build; import android.os.IBinder; import android.support.annotation.NonNull; -import android.support.v4.app.JobIntentService; +import android.support.v4.app.SafeJobIntentService; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.RemoteViews; + import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.receiver.MediaButtonReceiver; +import de.danoeh.antennapod.core.receiver.PlayerWidget; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlayerStatus; import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.playback.Playable; -import de.danoeh.antennapod.core.receiver.PlayerWidget; /** * Updates the state of the player widget */ -public class PlayerWidgetJobService extends JobIntentService { +public class PlayerWidgetJobService extends SafeJobIntentService { private static final String TAG = "PlayerWidgetJobService"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java index 57d099dfc..97007a214 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/AntennapodHttpClient.java @@ -40,6 +40,9 @@ import okhttp3.internal.http.StatusLine; * Provides access to a HttpClient singleton. */ public class AntennapodHttpClient { + + private AntennapodHttpClient(){} + private static final String TAG = "AntennapodHttpClient"; private static final int CONNECTION_TIMEOUT = 30000; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java index 75c28564e..48234c387 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadRequest.java @@ -124,7 +124,7 @@ public class DownloadRequest implements Parcelable { @Override public boolean equals(Object o) { if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (o == null || !(o instanceof DownloadRequest)) return false; DownloadRequest that = (DownloadRequest) o; 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 4bd2d8f19..ffbe7e7d1 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 @@ -14,14 +14,13 @@ import android.os.Handler; import android.os.IBinder; import android.support.annotation.NonNull; import android.support.annotation.VisibleForTesting; +import android.support.annotation.Nullable; import android.support.v4.app.NotificationCompat; import android.text.TextUtils; import android.util.Log; import android.util.Pair; import android.webkit.URLUtil; -import de.danoeh.antennapod.core.storage.PodDBAdapter; -import de.danoeh.antennapod.core.util.gui.NotificationUtils; import org.apache.commons.io.FileUtils; import org.xml.sax.SAXException; @@ -31,10 +30,8 @@ import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.Collections; import java.util.Date; -import java.util.HashSet; import java.util.LinkedList; import java.util.List; -import java.util.Set; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; import java.util.concurrent.CompletionService; @@ -69,12 +66,14 @@ import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DownloadRequestException; import de.danoeh.antennapod.core.storage.DownloadRequester; +import de.danoeh.antennapod.core.storage.PodDBAdapter; import de.danoeh.antennapod.core.syndication.handler.FeedHandler; import de.danoeh.antennapod.core.syndication.handler.FeedHandlerResult; import de.danoeh.antennapod.core.syndication.handler.UnsupportedFeedtypeException; import de.danoeh.antennapod.core.util.ChapterUtils; import de.danoeh.antennapod.core.util.DownloadError; import de.danoeh.antennapod.core.util.InvalidFeedException; +import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.greenrobot.event.EventBus; /** @@ -117,11 +116,6 @@ public class DownloadService extends Service { private CompletionService<Downloader> downloadExecutor; private FeedSyncThread feedSyncThread; - /** - * Number of threads of downloadExecutor. - */ - private static final int NUM_PARALLEL_DOWNLOADS = 6; - private DownloadRequester requester; @@ -862,22 +856,6 @@ public class DownloadService extends Service { return true; } - /** - * Delete files that aren't needed anymore - */ - private void cleanup(Feed feed) { - if (feed.getFile_url() != null) { - if (new File(feed.getFile_url()).delete()) { - Log.d(TAG, "Successfully deleted cache file."); - } else { - Log.e(TAG, "Failed to delete cache file."); - } - feed.setFile_url(null); - } else { - Log.d(TAG, "Didn't delete cache file: File url is not set."); - } - } - public void shutdown() { isActive = false; if (isCollectingRequests) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java index 8cce02155..842ad0c60 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java @@ -304,7 +304,7 @@ public class HttpDownloader extends Downloader { String encoded = ByteString.of(bytes).base64(); return "Basic " + encoded; } catch (UnsupportedEncodingException e) { - throw new AssertionError(); + throw new AssertionError(e); } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java index cc9d2ce2d..e1d87e1d5 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/ExoPlayerWrapper.java @@ -3,6 +3,7 @@ package de.danoeh.antennapod.core.service.playback; import android.content.Context; import android.net.Uri; import android.view.SurfaceHolder; + import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.DefaultLoadControl; import com.google.android.exoplayer2.DefaultRenderersFactory; @@ -22,9 +23,11 @@ import com.google.android.exoplayer2.trackselection.TrackSelectionArray; import com.google.android.exoplayer2.upstream.DataSource; import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory; import com.google.android.exoplayer2.util.Util; -import de.danoeh.antennapod.core.util.playback.IPlayer; + import org.antennapod.audio.MediaPlayer; +import de.danoeh.antennapod.core.util.playback.IPlayer; + public class ExoPlayerWrapper implements IPlayer { private final Context mContext; 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 0b4caf0c8..f2be7fbb1 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 @@ -24,13 +24,13 @@ import android.os.Vibrator; import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.annotation.StringRes; +import android.support.v4.app.NotificationCompat; import android.support.v4.media.MediaBrowserCompat; import android.support.v4.media.MediaBrowserServiceCompat; import android.support.v4.media.MediaDescriptionCompat; import android.support.v4.media.MediaMetadataCompat; import android.support.v4.media.session.MediaSessionCompat; import android.support.v4.media.session.PlaybackStateCompat; -import android.support.v4.app.NotificationCompat; import android.text.TextUtils; import android.util.Log; import android.util.Pair; @@ -67,8 +67,8 @@ import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.FeedSearcher; import de.danoeh.antennapod.core.util.IntList; import de.danoeh.antennapod.core.util.IntentUtils; -import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.core.util.QueueAccess; +import de.danoeh.antennapod.core.util.gui.NotificationUtils; import de.danoeh.antennapod.core.util.playback.ExternalMedia; import de.danoeh.antennapod.core.util.playback.Playable; import de.greenrobot.event.EventBus; @@ -603,14 +603,6 @@ public class PlaybackService extends MediaBrowserServiceCompat { mediaPlayer.setVideoSurface(sh); } - /** - * Called when the surface holder of the mediaplayer has to be changed. - */ - private void resetVideoSurface() { - taskManager.cancelPositionSaver(); - mediaPlayer.resetVideoSurface(); - } - public void notifyVideoSurfaceAbandoned() { mediaPlayer.pause(true, false); mediaPlayer.resetVideoSurface(); @@ -1808,7 +1800,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { public boolean onMediaButtonEvent(final Intent mediaButton) { Log.d(TAG, "onMediaButtonEvent(" + mediaButton + ")"); if (mediaButton != null) { - KeyEvent keyEvent = (KeyEvent) mediaButton.getParcelableExtra(Intent.EXTRA_KEY_EVENT); + KeyEvent keyEvent = mediaButton.getParcelableExtra(Intent.EXTRA_KEY_EVENT); if (keyEvent != null && keyEvent.getAction() == KeyEvent.ACTION_DOWN && keyEvent.getRepeatCount() == 0) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlayerStatus.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlayerStatus.java index 8a222d7ec..4f2ae34f8 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlayerStatus.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlayerStatus.java @@ -12,7 +12,7 @@ public enum PlayerStatus { INITIALIZING(9), // playback service is loading the Playable's metadata INITIALIZED(10); // playback service was started, data source of media player was set. - private int statusValue; + private final int statusValue; private static final PlayerStatus[] fromOrdinalLookup; static { diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java index 456d05ded..718459db8 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java @@ -75,7 +75,7 @@ public final class DBReader { cursor = adapter.getAllFeedsCursor(); List<Feed> feeds = new ArrayList<>(cursor.getCount()); while (cursor.moveToNext()) { - Feed feed = extractFeedFromCursorRow(adapter, cursor); + Feed feed = extractFeedFromCursorRow(cursor); feeds.add(feed); } return feeds; @@ -243,7 +243,7 @@ public final class DBReader { return result; } - private static Feed extractFeedFromCursorRow(PodDBAdapter adapter, Cursor cursor) { + private static Feed extractFeedFromCursorRow(Cursor cursor) { Feed feed = Feed.fromCursor(cursor); FeedPreferences preferences = FeedPreferences.fromCursor(cursor); feed.setPreferences(preferences); @@ -580,7 +580,7 @@ public final class DBReader { try { cursor = adapter.getFeedCursor(feedId); if (cursor.moveToNext()) { - feed = extractFeedFromCursorRow(adapter, cursor); + feed = extractFeedFromCursorRow(cursor); feed.setItems(getFeedItemList(feed)); } else { Log.e(TAG, "getFeed could not find feed with id " + feedId); @@ -1007,7 +1007,7 @@ public final class DBReader { Cursor feedCursor = adapter.getFeedsInFlattrQueueCursor(); if (feedCursor.moveToFirst()) { do { - result.add(extractFeedFromCursorRow(adapter, feedCursor)); + result.add(extractFeedFromCursorRow(feedCursor)); } while (feedCursor.moveToNext()); } feedCursor.close(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java index 8eed10cd7..ba7d4b47b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java @@ -1,11 +1,9 @@ package de.danoeh.antennapod.core.storage; import android.content.Context; -import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; import android.support.annotation.Nullable; -import android.support.v4.content.ContextCompat; import android.util.Log; import java.util.ArrayList; @@ -777,10 +775,8 @@ public final class DBTasks { */ abstract static class QueryTask<T> implements Callable<T> { private T result; - private final Context context; public QueryTask(Context context) { - this.context = context; } @Override diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBUpgrader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBUpgrader.java index 29ed5f7f9..0beb765e7 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBUpgrader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBUpgrader.java @@ -5,6 +5,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.media.MediaMetadataRetriever; import android.util.Log; + import de.danoeh.antennapod.core.feed.FeedItem; class DBUpgrader { diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java index 8bb5bc31a..bbe6145ea 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java @@ -7,7 +7,6 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; -import de.danoeh.antennapod.core.util.IntentUtils; import org.shredzone.flattr4j.model.Flattr; import java.io.File; @@ -42,6 +41,7 @@ import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.DownloadStatus; import de.danoeh.antennapod.core.service.playback.PlaybackService; +import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.LongList; import de.danoeh.antennapod.core.util.Permutor; import de.danoeh.antennapod.core.util.flattr.FlattrStatus; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java index 827874f54..892a4675a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DownloadRequester.java @@ -9,8 +9,6 @@ import android.text.TextUtils; import android.util.Log; import android.webkit.URLUtil; -import de.danoeh.antennapod.core.service.playback.PlaybackService; -import de.danoeh.antennapod.core.util.IntentUtils; import org.apache.commons.io.FilenameUtils; import java.io.File; @@ -25,6 +23,7 @@ import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.service.download.DownloadRequest; import de.danoeh.antennapod.core.service.download.DownloadService; import de.danoeh.antennapod.core.util.FileNameGenerator; +import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.URLChecker; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java index aa5706ad0..f91e2ad08 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java @@ -19,6 +19,8 @@ import de.danoeh.antennapod.core.util.comparator.SearchResultValueComparator; * Performs search on Feeds and FeedItems */ public class FeedSearcher { + private FeedSearcher(){} + private static final String TAG = "FeedSearcher"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java index 51b41d3b3..8ebd8eeb5 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/PodDBAdapter.java @@ -12,8 +12,20 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; import android.media.MediaMetadataRetriever; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.text.TextUtils; import android.util.Log; + +import org.apache.commons.io.FileUtils; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Set; + import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.event.ProgressEvent; import de.danoeh.antennapod.core.feed.Chapter; @@ -26,14 +38,6 @@ import de.danoeh.antennapod.core.service.download.DownloadStatus; import de.danoeh.antennapod.core.util.LongIntMap; import de.danoeh.antennapod.core.util.flattr.FlattrStatus; import de.greenrobot.event.EventBus; -import org.apache.commons.io.FileUtils; - -import java.io.File; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Set; // TODO Remove media column from feeditem table diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java index a1100a976..e391af1b2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSRSS20.java @@ -5,7 +5,6 @@ import android.util.Log; import org.xml.sax.Attributes; -import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.syndication.handler.HandlerState; @@ -22,9 +21,6 @@ public class NSRSS20 extends Namespace { private static final String TAG = "NSRSS20"; - private static final String NSTAG = "rss"; - private static final String NSURI = ""; - public static final String CHANNEL = "channel"; public static final String ITEM = "item"; private static final String GUID = "guid"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/Namespace.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/Namespace.java index 1836bbec1..e5fbdb9bb 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/Namespace.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/Namespace.java @@ -15,7 +15,6 @@ public abstract class Namespace { public abstract SyndElement handleElementStart(String localName, HandlerState state, Attributes attributes); /** Called by a Feedhandler when in endElement and it detects a namespace element - * @return true if namespace handled the element, false if it ignored it * */ public abstract void handleElementEnd(String localName, HandlerState state); diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java index aab1b1a5b..83957456a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/NSAtom.java @@ -47,8 +47,6 @@ public class NSAtom extends Namespace { private static final String LINK_REL_ARCHIVES = "archives"; private static final String LINK_REL_ENCLOSURE = "enclosure"; private static final String LINK_REL_PAYMENT = "payment"; - private static final String LINK_REL_RELATED = "related"; - private static final String LINK_REL_SELF = "self"; private static final String LINK_REL_NEXT = "next"; // type-values private static final String LINK_TYPE_ATOM = "application/atom+xml"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java b/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java index b513fbe99..3cb226add 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/Converter.java @@ -28,7 +28,6 @@ public final class Converter { /** Determines the length of the number for best readability.*/ private static final int NUM_LENGTH = 1024; - private static final int DAYS_MIL = 86400000; private static final int HOURS_MIL = 3600000; private static final int MINUTES_MIL = 60000; private static final int SECONDS_MIL = 1000; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java index e17d8de3e..5141e3a78 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java @@ -17,7 +17,9 @@ import java.util.TimeZone; */ public class DateUtils { - private static final String TAG = "DateUtils"; + private DateUtils(){} + + private static final String TAG = "DateUtils"; private static final TimeZone defaultTimezone = TimeZone.getTimeZone("GMT"); @@ -135,7 +137,7 @@ public class DateUtils { if (parts.length >= 2) { result += Integer.parseInt(parts[idx]) * 60000L; idx++; - result += (Float.parseFloat(parts[idx])) * 1000L; + result += (long) (Float.parseFloat(parts[idx]) * 1000L); } return result; } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java index 76a6549ae..826c06822 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java @@ -5,6 +5,7 @@ import java.util.List; import de.danoeh.antennapod.core.feed.FeedItem; public class FeedItemUtil { + private FeedItemUtil(){} public static int indexOfItemWithDownloadUrl(List<FeedItem> items, String downloadUrl) { if(items == null) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java index aaaaf8f4d..e81ab47ed 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/IntentUtils.java @@ -8,6 +8,7 @@ import android.content.pm.ResolveInfo; import java.util.List; public class IntentUtils { + private IntentUtils(){} /* * Checks if there is at least one exported activity that can be performed for the intent diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/LangUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/LangUtils.java index 7ec7f84c4..90e0b0981 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/LangUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/LangUtils.java @@ -5,6 +5,9 @@ import android.support.v4.util.ArrayMap; import java.nio.charset.Charset; public class LangUtils { + + private LangUtils(){} + public static final Charset UTF_8 = Charset.forName("UTF-8"); private static final ArrayMap<String, String> languages; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java index cbda583fa..0120790ed 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/NetworkUtils.java @@ -22,11 +22,11 @@ import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import rx.Observable; -import rx.Subscriber; import rx.android.schedulers.AndroidSchedulers; import rx.schedulers.Schedulers; public class NetworkUtils { + private NetworkUtils(){} private static final String TAG = NetworkUtils.class.getSimpleName(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/RewindAfterPauseUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/RewindAfterPauseUtils.java index ee306a401..d1818aeef 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/RewindAfterPauseUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/RewindAfterPauseUtils.java @@ -9,6 +9,7 @@ import java.util.concurrent.TimeUnit; * Media file should be "rewinded" x seconds after user resumes the playback. */ public class RewindAfterPauseUtils { + private RewindAfterPauseUtils(){} public static final long ELAPSED_TIME_FOR_SHORT_REWIND = TimeUnit.MINUTES.toMillis(1); public static final long ELAPSED_TIME_FOR_MEDIUM_REWIND = TimeUnit.HOURS.toMillis(1); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java index 1ef81bf64..3a6bf5755 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java @@ -14,6 +14,8 @@ import de.danoeh.antennapod.core.preferences.UserPreferences; * Utility functions for handling storage errors */ public class StorageUtils { + private StorageUtils(){} + private static final String TAG = "StorageUtils"; public static boolean storageAvailable() { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java index 03d0f10ff..14f091249 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/ThemeUtils.java @@ -3,14 +3,15 @@ package de.danoeh.antennapod.core.util; import android.content.Context; import android.support.annotation.AttrRes; import android.support.annotation.ColorInt; -import android.support.annotation.ColorRes; import android.util.Log; - import android.util.TypedValue; + import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.preferences.UserPreferences; public class ThemeUtils { + private ThemeUtils(){} + private static final String TAG = "ThemeUtils"; public static int getSelectionBackgroundColor() { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java b/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java index ad723c685..3a2a4ac80 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/download/AutoUpdateManager.java @@ -11,12 +11,13 @@ import android.os.Build; import android.os.SystemClock; import android.support.annotation.RequiresApi; import android.util.Log; -import de.danoeh.antennapod.core.receiver.FeedUpdateReceiver; -import de.danoeh.antennapod.core.service.FeedUpdateJobService; import java.util.Calendar; import java.util.concurrent.TimeUnit; +import de.danoeh.antennapod.core.receiver.FeedUpdateReceiver; +import de.danoeh.antennapod.core.service.FeedUpdateJobService; + public class AutoUpdateManager { private static final int JOB_ID_FEED_UPDATE = 42; private static final String TAG = "AutoUpdateManager"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrServiceCreator.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrServiceCreator.java index 45cb56988..d4d5843d2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrServiceCreator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrServiceCreator.java @@ -11,7 +11,9 @@ import de.danoeh.antennapod.core.BuildConfig; /** Ensures that only one instance of the FlattrService class exists at a time */ class FlattrServiceCreator { - private static final String TAG = "FlattrServiceCreator"; + private FlattrServiceCreator(){} + + public static final String TAG = "FlattrServiceCreator"; private static volatile FlattrService flattrService; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java index 313d1c2f2..919fc82f2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java @@ -1,8 +1,6 @@ package de.danoeh.antennapod.core.util.flattr; import android.content.Context; -import android.content.DialogInterface; -import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; @@ -36,6 +34,8 @@ import de.danoeh.antennapod.core.storage.DBWriter; */ public class FlattrUtils { + private FlattrUtils(){} + private static final String TAG = "FlattrUtils"; private static final String HOST_NAME = "de.danoeh.antennapod"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/gui/MoreContentListFooterUtil.java b/core/src/main/java/de/danoeh/antennapod/core/util/gui/MoreContentListFooterUtil.java index 386f46724..6e5c3e84b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/gui/MoreContentListFooterUtil.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/gui/MoreContentListFooterUtil.java @@ -27,8 +27,8 @@ public class MoreContentListFooterUtil { } public void setLoadingState(boolean newState) { - final ImageView imageView = (ImageView) root.findViewById(R.id.imgExpand); - final ProgressBar progressBar = (ProgressBar) root.findViewById(R.id.progBar); + final ImageView imageView = root.findViewById(R.id.imgExpand); + final ProgressBar progressBar = root.findViewById(R.id.progBar); if (newState) { imageView.setVisibility(View.GONE); progressBar.setVisibility(View.VISIBLE); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java index 2a537dc62..52a43aab2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/gui/NotificationUtils.java @@ -6,6 +6,7 @@ import android.app.NotificationManager; import android.content.Context; import android.os.Build; import android.support.annotation.RequiresApi; + import de.danoeh.antennapod.core.R; public class NotificationUtils { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/MediaPlayerError.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/MediaPlayerError.java index a576dd497..b04c02075 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/MediaPlayerError.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/MediaPlayerError.java @@ -7,6 +7,7 @@ import de.danoeh.antennapod.core.R; /** Utility class for MediaPlayer errors. */ public class MediaPlayerError { + private MediaPlayerError(){} /** Get a human-readable string for a specific error code. */ public static String getErrorString(Context context, int code) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/Playable.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Playable.java index ff7f5b79d..da9b96430 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/Playable.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Playable.java @@ -176,6 +176,8 @@ public interface Playable extends Parcelable, * Provides utility methods for Playable objects. */ class PlayableUtils { + private PlayableUtils(){} + private static final String TAG = "PlayableUtils"; /** diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java index 31067839a..408789cc9 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackController.java @@ -7,12 +7,10 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; -import android.content.SharedPreferences; import android.content.res.TypedArray; import android.media.MediaPlayer; import android.os.Build; import android.os.IBinder; -import android.preference.PreferenceManager; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; @@ -24,10 +22,8 @@ import android.widget.ImageButton; import android.widget.SeekBar; import android.widget.TextView; -import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import de.danoeh.antennapod.core.R; @@ -42,12 +38,10 @@ import de.danoeh.antennapod.core.service.playback.PlayerStatus; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.playback.Playable.PlayableUtils; -import rx.Completable; import rx.Observable; import rx.Single; import rx.Subscription; import rx.android.schedulers.AndroidSchedulers; -import rx.observers.Subscribers; import rx.schedulers.Schedulers; /** @@ -702,7 +696,7 @@ public abstract class PlaybackController { return org.antennapod.audio.MediaPlayer.isPrestoLibraryInstalled(activity.getApplicationContext()) || UserPreferences.useSonic() || Build.VERSION.SDK_INT >= 23 - || playbackService != null && playbackService.canSetSpeed(); + || (playbackService != null && playbackService.canSetSpeed()); } public void setPlaybackSpeed(float speed) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackServiceStarter.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackServiceStarter.java index 3ba553d12..f7d2ee409 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackServiceStarter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/PlaybackServiceStarter.java @@ -3,7 +3,9 @@ package de.danoeh.antennapod.core.util.playback; import android.content.Context; import android.content.Intent; import android.media.MediaPlayer; +import android.support.annotation.NonNull; import android.support.v4.content.ContextCompat; + import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.service.playback.PlaybackService; |