diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2018-01-21 22:12:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-21 22:12:54 +0100 |
commit | 82378f36476b7ceb44053df52b76dd7d3eb43e36 (patch) | |
tree | f820079027b8940626403ef25ea77ab604200b47 /core | |
parent | 278e93880e9a4bc0b54e36c8d486cad84ed7fd6e (diff) | |
parent | 34a5d7eb17d2074d746107abcdc6872ae7ad285c (diff) | |
download | AntennaPod-82378f36476b7ceb44053df52b76dd7d3eb43e36.zip |
Merge branch 'develop' into stringbuilder
Diffstat (limited to 'core')
113 files changed, 509 insertions, 577 deletions
diff --git a/core/src/androidTest/java/de/danoeh/antennapod/core/feed/FeedImageMother.java b/core/src/androidTest/java/de/danoeh/antennapod/core/feed/FeedImageMother.java index f240c870e..0fb4992ba 100644 --- a/core/src/androidTest/java/de/danoeh/antennapod/core/feed/FeedImageMother.java +++ b/core/src/androidTest/java/de/danoeh/antennapod/core/feed/FeedImageMother.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.core.feed; -public class FeedImageMother { +class FeedImageMother { public static FeedImage anyFeedImage() { return new FeedImage(0, "image", null, "http://example.com/picture", false); diff --git a/core/src/androidTest/java/de/danoeh/antennapod/core/feed/FeedMother.java b/core/src/androidTest/java/de/danoeh/antennapod/core/feed/FeedMother.java index 1cea6b9c9..fecc8e377 100644 --- a/core/src/androidTest/java/de/danoeh/antennapod/core/feed/FeedMother.java +++ b/core/src/androidTest/java/de/danoeh/antennapod/core/feed/FeedMother.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.feed; import static de.danoeh.antennapod.core.feed.FeedImageMother.anyFeedImage; -public class FeedMother { +class FeedMother { public static Feed anyFeed() { FeedImage image = anyFeedImage(); diff --git a/core/src/free/java/de/danoeh/antennapod/core/feed/FeedMediaFlavorHelper.java b/core/src/free/java/de/danoeh/antennapod/core/feed/FeedMediaFlavorHelper.java index 8818f6b46..9833e2cc9 100644 --- a/core/src/free/java/de/danoeh/antennapod/core/feed/FeedMediaFlavorHelper.java +++ b/core/src/free/java/de/danoeh/antennapod/core/feed/FeedMediaFlavorHelper.java @@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.feed; /** * Implements methods for FeedMedia that are flavor dependent. */ -public class FeedMediaFlavorHelper { +class FeedMediaFlavorHelper { private FeedMediaFlavorHelper(){} static boolean instanceOfRemoteMedia(Object o) { return false; diff --git a/core/src/free/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceFlavorHelper.java b/core/src/free/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceFlavorHelper.java index 4e6482fda..37109ddca 100644 --- a/core/src/free/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceFlavorHelper.java +++ b/core/src/free/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceFlavorHelper.java @@ -8,9 +8,9 @@ import android.support.v4.media.session.PlaybackStateCompat; /** * Class intended to work along PlaybackService and provide support for different flavors. */ -public class PlaybackServiceFlavorHelper { +class PlaybackServiceFlavorHelper { - private PlaybackService.FlavorHelperCallback callback; + private final PlaybackService.FlavorHelperCallback callback; PlaybackServiceFlavorHelper(Context context, PlaybackService.FlavorHelperCallback callback) { this.callback = callback; 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 8362c4a4e..96e3a77be 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/UpdateManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/UpdateManager.java @@ -23,9 +23,9 @@ import de.danoeh.antennapod.core.storage.DBWriter; /* * This class's job is do perform maintenance tasks whenever the app has been updated */ -public class UpdateManager { +class UpdateManager { - public static final String TAG = UpdateManager.class.getSimpleName(); + private static final String TAG = UpdateManager.class.getSimpleName(); private static final String PREF_NAME = "app_version"; private static final String KEY_VERSION_CODE = "version_code"; @@ -55,11 +55,11 @@ public class UpdateManager { } } - public static int getStoredVersionCode() { + private static int getStoredVersionCode() { return prefs.getInt(KEY_VERSION_CODE, -1); } - public static void setCurrentVersionCode() { + private static void setCurrentVersionCode() { prefs.edit().putInt(KEY_VERSION_CODE, currentVersionCode).apply(); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/asynctask/DBTaskLoader.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/DBTaskLoader.java index 0f402f44a..1b4aafeaa 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/asynctask/DBTaskLoader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/DBTaskLoader.java @@ -8,7 +8,7 @@ import android.support.v4.content.AsyncTaskLoader; * This class will provide a useful default implementation that would otherwise always be necessary when interacting * with the DB*-classes with an AsyncTaskLoader. */ -public abstract class DBTaskLoader<D> extends AsyncTaskLoader<D> { +abstract class DBTaskLoader<D> extends AsyncTaskLoader<D> { public DBTaskLoader(Context context) { super(context); 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 1a0772f16..1e0c07b01 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 @@ -1,6 +1,5 @@ package de.danoeh.antennapod.core.asynctask; -import android.annotation.SuppressLint; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; @@ -15,9 +14,9 @@ import de.danoeh.antennapod.core.storage.DBWriter; /** Removes a feed in the background. */ public class FeedRemover extends AsyncTask<Void, Void, Void> { - Context context; - ProgressDialog dialog; - Feed feed; + private final Context context; + private ProgressDialog dialog; + private final Feed feed; public boolean skipOnCompletion = false; public FeedRemover(Context context, Feed feed) { 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 19501ea94..5bd65f4e9 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 @@ -1,6 +1,5 @@ package de.danoeh.antennapod.core.asynctask; -import android.annotation.TargetApi; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; @@ -39,7 +38,7 @@ import de.danoeh.antennapod.core.util.flattr.FlattrUtils; * to flattr something, a notification will be displayed. */ public class FlattrClickWorker extends AsyncTask<Void, Integer, FlattrClickWorker.ExitCode> { - protected static final String TAG = "FlattrClickWorker"; + private static final String TAG = "FlattrClickWorker"; private static final int NOTIFICATION_ID = 4; 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 4c084eaaf..420a60469 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 @@ -18,8 +18,8 @@ import de.danoeh.antennapod.core.util.flattr.FlattrUtils; */ public class FlattrStatusFetcher extends Thread { - protected static final String TAG = "FlattrStatusFetcher"; - protected Context context; + private static final String TAG = "FlattrStatusFetcher"; + private final Context context; public FlattrStatusFetcher(Context context) { super(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrTokenFetcher.java b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrTokenFetcher.java index 5333b2273..985cabbf8 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrTokenFetcher.java +++ b/core/src/main/java/de/danoeh/antennapod/core/asynctask/FlattrTokenFetcher.java @@ -1,7 +1,6 @@ package de.danoeh.antennapod.core.asynctask; -import android.annotation.SuppressLint; import android.app.ProgressDialog; import android.content.Context; import android.net.Uri; @@ -23,12 +22,12 @@ import de.danoeh.antennapod.core.util.flattr.FlattrUtils; public class FlattrTokenFetcher extends AsyncTask<Void, Void, AccessToken> { private static final String TAG = "FlattrTokenFetcher"; - Context context; - AndroidAuthenticator auth; - AccessToken token; - Uri uri; - ProgressDialog dialog; - FlattrException exception; + private final Context context; + private final AndroidAuthenticator auth; + private AccessToken token; + private final Uri uri; + private ProgressDialog dialog; + private FlattrException exception; public FlattrTokenFetcher(Context context, AndroidAuthenticator auth, Uri uri) { super(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java index b14803751..c626a8189 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java +++ b/core/src/main/java/de/danoeh/antennapod/core/dialog/ConfirmationDialog.java @@ -15,9 +15,9 @@ public abstract class ConfirmationDialog { private static final String TAG = ConfirmationDialog.class.getSimpleName(); - protected Context context; - private int titleId; - private String message; + private final Context context; + private final int titleId; + private final String message; private int positiveText; private int negativeText; @@ -32,7 +32,7 @@ public abstract class ConfirmationDialog { this.message = message; } - public void onCancelButtonPressed(DialogInterface dialog) { + private void onCancelButtonPressed(DialogInterface dialog) { Log.d(TAG, "Dialog was cancelled"); dialog.dismiss(); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/FavoritesEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/FavoritesEvent.java index d09f6802f..578007561 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/event/FavoritesEvent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/event/FavoritesEvent.java @@ -11,8 +11,8 @@ public class FavoritesEvent { ADDED, REMOVED } - public final Action action; - public final FeedItem item; + private final Action action; + private final FeedItem item; private FavoritesEvent(Action action, FeedItem item) { this.action = action; diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/FeedItemEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/FeedItemEvent.java index 7ff241456..9db262857 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/event/FeedItemEvent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/event/FeedItemEvent.java @@ -17,7 +17,8 @@ public class FeedItemEvent { UPDATE, DELETE_MEDIA } - @NonNull public final Action action; + @NonNull + private final Action action; @NonNull public final List<FeedItem> items; private FeedItemEvent(Action action, List<FeedItem> items) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/FeedMediaEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/FeedMediaEvent.java index 864d0a405..4a591c996 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/event/FeedMediaEvent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/event/FeedMediaEvent.java @@ -8,8 +8,8 @@ public class FeedMediaEvent { UPDATE } - public final Action action; - public final FeedMedia media; + private final Action action; + private final FeedMedia media; private FeedMediaEvent(Action action, FeedMedia media) { this.action = action; diff --git a/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlSymbols.java b/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlSymbols.java index 40b0e23b8..86091720d 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlSymbols.java +++ b/core/src/main/java/de/danoeh/antennapod/core/export/opml/OpmlSymbols.java @@ -3,7 +3,7 @@ package de.danoeh.antennapod.core.export.opml; import de.danoeh.antennapod.core.export.CommonSymbols; /** Contains symbols for reading and writing OPML documents. */ -public final class OpmlSymbols extends CommonSymbols { +final class OpmlSymbols extends CommonSymbols { public static final String OPML = "opml"; static final String OUTLINE = "outline"; diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/Chapter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/Chapter.java index f221ed32e..f3dfdfdb6 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/Chapter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/Chapter.java @@ -7,19 +7,19 @@ import de.danoeh.antennapod.core.storage.PodDBAdapter; public abstract class Chapter extends FeedComponent { /** Defines starting point in milliseconds. */ - protected long start; - protected String title; - protected String link; + long start; + String title; + String link; - public Chapter() { + Chapter() { } - public Chapter(long start) { + Chapter(long start) { super(); this.start = start; } - public Chapter(long start, String title, FeedItem item, String link) { + Chapter(long start, String title, FeedItem item, String link) { super(); this.start = start; this.title = title; diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/EventDistributor.java b/core/src/main/java/de/danoeh/antennapod/core/feed/EventDistributor.java index 514a79fad..b769eaf55 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/EventDistributor.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/EventDistributor.java @@ -27,8 +27,8 @@ public class EventDistributor extends Observable { public static final int DOWNLOAD_HANDLED = 64; public static final int PLAYER_STATUS_UPDATE = 128; - private Handler handler; - private AbstractQueue<Integer> events; + private final Handler handler; + private final AbstractQueue<Integer> events; private static EventDistributor instance; @@ -52,7 +52,7 @@ public class EventDistributor extends Observable { deleteObserver(el); } - public void addEvent(Integer i) { + private void addEvent(Integer i) { events.offer(i); handler.post(EventDistributor.this::processEventQueue); } 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 90b5e50b7..a3f91b1c9 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 @@ -7,9 +7,9 @@ package de.danoeh.antennapod.core.feed; */ public abstract class FeedComponent { - protected long id; + long id; - public FeedComponent() { + FeedComponent() { super(); } @@ -26,7 +26,7 @@ public abstract class FeedComponent { * FeedComponent. This method should only update attributes which where read from * the feed. */ - public void updateFromOther(FeedComponent other) { + void updateFromOther(FeedComponent other) { } /** @@ -36,7 +36,7 @@ public abstract class FeedComponent { * * @return true if attribute values are different, false otherwise */ - public boolean compareWithOther(FeedComponent other) { + boolean compareWithOther(FeedComponent other) { return false; } diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedEvent.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedEvent.java index d04d236e4..b790faadf 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedEvent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedEvent.java @@ -9,7 +9,7 @@ public class FeedEvent { FILTER_CHANGED } - public final Action action; + private final Action action; public final long feedId; public FeedEvent(Action action, long feedId) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFile.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFile.java index ca9af058b..cc4dd230f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFile.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFile.java @@ -9,9 +9,9 @@ import java.io.File; */ public abstract class FeedFile extends FeedComponent { - protected String file_url; + String file_url; protected String download_url; - protected boolean downloaded; + boolean downloaded; /** * Creates a new FeedFile object. @@ -40,7 +40,7 @@ public abstract class FeedFile extends FeedComponent { * FeedFile. This method should only update attributes which where read from * the feed. */ - public void updateFromOther(FeedFile other) { + void updateFromOther(FeedFile other) { super.updateFromOther(other); this.download_url = other.download_url; } @@ -52,7 +52,7 @@ public abstract class FeedFile extends FeedComponent { * * @return true if attribute values are different, false otherwise */ - public boolean compareWithOther(FeedFile other) { + boolean compareWithOther(FeedFile other) { if (super.compareWithOther(other)) { return true; } diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFilter.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFilter.java index 35abb8de6..28161ac9b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFilter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedFilter.java @@ -9,8 +9,8 @@ public class FeedFilter { private static final String TAG = "FeedFilter"; - private String includeFilter; - private String excludeFilter; + private final String includeFilter; + private final String excludeFilter; public FeedFilter() { this("", ""); diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedImage.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedImage.java index f0c508830..45bd2ad31 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedImage.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedImage.java @@ -11,8 +11,8 @@ import de.danoeh.antennapod.core.storage.PodDBAdapter; public class FeedImage extends FeedFile implements ImageResource { public static final int FEEDFILETYPE_FEEDIMAGE = 1; - protected String title; - protected FeedComponent owner; + private String title; + private FeedComponent owner; public FeedImage(FeedComponent owner, String download_url, String title) { super(null, download_url, false); 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 66c4b10d0..7b387b1d3 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 @@ -59,7 +59,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr public static final int PLAYED = 1; private String paymentLink; - private FlattrStatus flattrStatus; + private final FlattrStatus flattrStatus; /** * Is true if the database contains any chapters that belong to this item. This attribute is only @@ -87,7 +87,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr /** * Any tags assigned to this item */ - private Set<String> tags = new HashSet<>(); + private final Set<String> tags = new HashSet<>(); public FeedItem() { this.state = UNPLAYED; @@ -159,7 +159,6 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr int indexAutoDownload = cursor.getColumnIndex(PodDBAdapter.KEY_AUTO_DOWNLOAD); long id = cursor.getInt(indexId); - assert(id > 0); String title = cursor.getString(indexTitle); String link = cursor.getString(indexLink); Date pubDate = new Date(cursor.getLong(indexPubDate)); 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 5eea4f3da..2d551e1b2 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 @@ -34,7 +34,7 @@ public class FeedMedia extends FeedFile implements Playable { public static final int PLAYABLE_TYPE_FEEDMEDIA = 1; public static final String PREF_MEDIA_ID = "FeedMedia.PrefMediaId"; - public static final String PREF_FEED_ID = "FeedMedia.PrefFeedId"; + private static final String PREF_FEED_ID = "FeedMedia.PrefFeedId"; /** * Indicates we've checked on the size of the item via the network @@ -88,10 +88,10 @@ public class FeedMedia extends FeedFile implements Playable { this.lastPlayedTime = lastPlayedTime; } - public FeedMedia(long id, FeedItem item, int duration, int position, - long size, String mime_type, String file_url, String download_url, - boolean downloaded, Date playbackCompletionDate, int played_duration, - Boolean hasEmbeddedPicture, long lastPlayedTime) { + private FeedMedia(long id, FeedItem item, int duration, int position, + long size, String mime_type, String file_url, String download_url, + boolean downloaded, Date playbackCompletionDate, int played_duration, + Boolean hasEmbeddedPicture, long lastPlayedTime) { this(id, item, duration, position, size, mime_type, file_url, download_url, downloaded, playbackCompletionDate, played_duration, lastPlayedTime); this.hasEmbeddedPicture = hasEmbeddedPicture; diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedPreferences.java b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedPreferences.java index 66fc4024b..3285ad7cb 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/FeedPreferences.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/FeedPreferences.java @@ -33,7 +33,7 @@ public class FeedPreferences { this(feedID, autoDownload, true, auto_delete_action, username, password, new FeedFilter()); } - public FeedPreferences(long feedID, boolean autoDownload, boolean keepUpdated, AutoDeleteAction auto_delete_action, String username, String password, @NonNull FeedFilter filter) { + private FeedPreferences(long feedID, boolean autoDownload, boolean keepUpdated, AutoDeleteAction auto_delete_action, String username, String password, @NonNull FeedFilter filter) { this.feedID = feedID; this.autoDownload = autoDownload; this.keepUpdated = keepUpdated; diff --git a/core/src/main/java/de/danoeh/antennapod/core/feed/SearchResult.java b/core/src/main/java/de/danoeh/antennapod/core/feed/SearchResult.java index 9aa8d3170..ea8eb7871 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/feed/SearchResult.java +++ b/core/src/main/java/de/danoeh/antennapod/core/feed/SearchResult.java @@ -1,11 +1,11 @@ package de.danoeh.antennapod.core.feed; public class SearchResult { - private FeedComponent component; + private final FeedComponent component; /** Additional information (e.g. where it was found) */ private String subtitle; /** Higher value means more importance */ - private int value; + private final int value; public SearchResult(FeedComponent component, int value, String subtitle) { super(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/glide/ApOkHttpUrlLoader.java b/core/src/main/java/de/danoeh/antennapod/core/glide/ApOkHttpUrlLoader.java index 8ca9faa0d..3e4f06a12 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/glide/ApOkHttpUrlLoader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/glide/ApOkHttpUrlLoader.java @@ -27,7 +27,7 @@ import okhttp3.Response; /** * @see com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader */ -public class ApOkHttpUrlLoader implements ModelLoader<String, InputStream> { +class ApOkHttpUrlLoader implements ModelLoader<String, InputStream> { private static final String TAG = ApOkHttpUrlLoader.class.getSimpleName(); @@ -37,7 +37,7 @@ public class ApOkHttpUrlLoader implements ModelLoader<String, InputStream> { public static class Factory implements ModelLoaderFactory<String, InputStream> { private static volatile OkHttpClient internalClient; - private OkHttpClient client; + private final OkHttpClient client; private static OkHttpClient getInternalClient() { if (internalClient == null) { @@ -80,7 +80,7 @@ public class ApOkHttpUrlLoader implements ModelLoader<String, InputStream> { private final OkHttpClient client; - public ApOkHttpUrlLoader(OkHttpClient client) { + private ApOkHttpUrlLoader(OkHttpClient client) { this.client = client; } diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceBadStatusCodeException.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceBadStatusCodeException.java index 16f01f0f4..84c085ed2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceBadStatusCodeException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceBadStatusCodeException.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.core.gpoddernet; -public class GpodnetServiceBadStatusCodeException extends GpodnetServiceException { - int statusCode; +class GpodnetServiceBadStatusCodeException extends GpodnetServiceException { + private final int statusCode; public GpodnetServiceBadStatusCodeException(String message, int statusCode) { super(message); diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceException.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceException.java index ce704f7e3..78ddfc945 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/GpodnetServiceException.java @@ -2,10 +2,10 @@ package de.danoeh.antennapod.core.gpoddernet; public class GpodnetServiceException extends Exception { - public GpodnetServiceException() { + GpodnetServiceException() { } - public GpodnetServiceException(String message) { + GpodnetServiceException(String message) { super(message); } @@ -13,7 +13,7 @@ public class GpodnetServiceException extends Exception { super(cause); } - public GpodnetServiceException(String message, Throwable cause) { + GpodnetServiceException(String message, Throwable cause) { super(message, cause); } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetDevice.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetDevice.java index 79eb33cb5..faf4264e5 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetDevice.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetDevice.java @@ -4,10 +4,10 @@ import android.support.annotation.NonNull; public class GpodnetDevice { - private String id; - private String caption; - private DeviceType type; - private int subscriptions; + private final String id; + private final String caption; + private final DeviceType type; + private final int subscriptions; public GpodnetDevice(@NonNull String id, String caption, 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 9627ecae6..b76988fd8 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 @@ -131,7 +131,7 @@ public class GpodnetEpisodeAction { return this.action; } - public String getActionString() { + private String getActionString() { return this.action.name().toLowerCase(); } @@ -199,16 +199,14 @@ public class GpodnetEpisodeAction { } public String writeToString() { - StringBuilder result = new StringBuilder(); - result.append(this.podcast).append("\t"); - result.append(this.episode).append("\t"); - result.append(this.deviceId).append("\t"); - result.append(this.action).append("\t"); - result.append(this.timestamp.getTime()).append("\t"); - result.append(String.valueOf(this.started)).append("\t"); - result.append(String.valueOf(this.position)).append("\t"); - result.append(String.valueOf(this.total)); - return result.toString(); + return this.podcast + "\t" + + this.episode + "\t" + + this.deviceId + "\t" + + this.action + "\t" + + this.timestamp.getTime() + "\t" + + String.valueOf(this.started) + "\t" + + String.valueOf(this.position) + "\t" + + String.valueOf(this.total); } /** diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeActionPostResponse.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeActionPostResponse.java index 03c33c9a1..b6efab016 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeActionPostResponse.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetEpisodeActionPostResponse.java @@ -21,9 +21,9 @@ public class GpodnetEpisodeActionPostResponse { * URLs that should be updated. The key of the map is the original URL, the value of the map * is the sanitized URL. */ - public final Map<String, String> updatedUrls; + private final Map<String, String> updatedUrls; - public GpodnetEpisodeActionPostResponse(long timestamp, Map<String, String> updatedUrls) { + private GpodnetEpisodeActionPostResponse(long timestamp, Map<String, String> updatedUrls) { this.timestamp = timestamp; this.updatedUrls = updatedUrls; } diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetPodcast.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetPodcast.java index 191c0fa39..680dc1042 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetPodcast.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetPodcast.java @@ -3,13 +3,13 @@ package de.danoeh.antennapod.core.gpoddernet.model; import android.support.annotation.NonNull; public class GpodnetPodcast { - private String url; - private String title; - private String description; - private int subscribers; - private String logoUrl; - private String website; - private String mygpoLink; + private final String url; + private final String title; + private final String description; + private final int subscribers; + private final String logoUrl; + private final String website; + private final String mygpoLink; public GpodnetPodcast(@NonNull String url, @NonNull String title, diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetSubscriptionChange.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetSubscriptionChange.java index 6cc9b79a3..0f1961bef 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetSubscriptionChange.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetSubscriptionChange.java @@ -5,9 +5,9 @@ import android.support.annotation.NonNull; import java.util.List; public class GpodnetSubscriptionChange { - private List<String> added; - private List<String> removed; - private long timestamp; + private final List<String> added; + private final List<String> removed; + private final long timestamp; public GpodnetSubscriptionChange(@NonNull List<String> added, @NonNull List<String> removed, diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetTag.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetTag.java index 42a31afc5..40543592e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetTag.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetTag.java @@ -16,7 +16,7 @@ public class GpodnetTag implements Parcelable { this.usage = usage; } - protected GpodnetTag(Parcel in) { + private GpodnetTag(Parcel in) { title = in.readString(); tag = in.readString(); usage = in.readInt(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetUploadChangesResponse.java b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetUploadChangesResponse.java index 9bd1881e4..9f9c3bd74 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetUploadChangesResponse.java +++ b/core/src/main/java/de/danoeh/antennapod/core/gpoddernet/model/GpodnetUploadChangesResponse.java @@ -22,9 +22,9 @@ public class GpodnetUploadChangesResponse { * URLs that should be updated. The key of the map is the original URL, the value of the map * is the sanitized URL. */ - public final Map<String, String> updatedUrls; + private final Map<String, String> updatedUrls; - public GpodnetUploadChangesResponse(long timestamp, Map<String, String> updatedUrls) { + private GpodnetUploadChangesResponse(long timestamp, Map<String, String> updatedUrls) { this.timestamp = timestamp; this.updatedUrls = updatedUrls; } 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 f14c9e36c..b51b8d996 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 @@ -7,6 +7,7 @@ import android.util.Log; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -26,26 +27,26 @@ public class GpodnetPreferences { private static final String TAG = "GpodnetPreferences"; private static final String PREF_NAME = "gpodder.net"; - public static final String PREF_GPODNET_USERNAME = "de.danoeh.antennapod.preferences.gpoddernet.username"; - public static final String PREF_GPODNET_PASSWORD = "de.danoeh.antennapod.preferences.gpoddernet.password"; - public static final String PREF_GPODNET_DEVICEID = "de.danoeh.antennapod.preferences.gpoddernet.deviceID"; - public static final String PREF_GPODNET_HOSTNAME = "prefGpodnetHostname"; + private static final String PREF_GPODNET_USERNAME = "de.danoeh.antennapod.preferences.gpoddernet.username"; + private static final String PREF_GPODNET_PASSWORD = "de.danoeh.antennapod.preferences.gpoddernet.password"; + private static final String PREF_GPODNET_DEVICEID = "de.danoeh.antennapod.preferences.gpoddernet.deviceID"; + private static final String PREF_GPODNET_HOSTNAME = "prefGpodnetHostname"; - public static final String PREF_LAST_SUBSCRIPTION_SYNC_TIMESTAMP = "de.danoeh.antennapod.preferences.gpoddernet.last_sync_timestamp"; - public static final String PREF_LAST_EPISODE_ACTIONS_SYNC_TIMESTAMP = "de.danoeh.antennapod.preferences.gpoddernet.last_episode_actions_sync_timestamp"; - public static final String PREF_SYNC_ADDED = "de.danoeh.antennapod.preferences.gpoddernet.sync_added"; - public static final String PREF_SYNC_REMOVED = "de.danoeh.antennapod.preferences.gpoddernet.sync_removed"; - public static final String PREF_SYNC_EPISODE_ACTIONS = "de.danoeh.antennapod.preferences.gpoddernet.sync_queued_episode_actions"; + private static final String PREF_LAST_SUBSCRIPTION_SYNC_TIMESTAMP = "de.danoeh.antennapod.preferences.gpoddernet.last_sync_timestamp"; + private static final String PREF_LAST_EPISODE_ACTIONS_SYNC_TIMESTAMP = "de.danoeh.antennapod.preferences.gpoddernet.last_episode_actions_sync_timestamp"; + private static final String PREF_SYNC_ADDED = "de.danoeh.antennapod.preferences.gpoddernet.sync_added"; + private static final String PREF_SYNC_REMOVED = "de.danoeh.antennapod.preferences.gpoddernet.sync_removed"; + private static final String PREF_SYNC_EPISODE_ACTIONS = "de.danoeh.antennapod.preferences.gpoddernet.sync_queued_episode_actions"; public static final String PREF_LAST_SYNC_ATTEMPT_TIMESTAMP = "de.danoeh.antennapod.preferences.gpoddernet.last_sync_attempt_timestamp"; - public static final String PREF_LAST_SYNC_ATTEMPT_RESULT = "de.danoeh.antennapod.preferences.gpoddernet.last_sync_attempt_result"; + private static final String PREF_LAST_SYNC_ATTEMPT_RESULT = "de.danoeh.antennapod.preferences.gpoddernet.last_sync_attempt_result"; private static String username; private static String password; private static String deviceID; private static String hostname; - private static ReentrantLock feedListLock = new ReentrantLock(); + private static final ReentrantLock feedListLock = new ReentrantLock(); private static Set<String> addedFeeds; private static Set<String> removedFeeds; @@ -316,9 +317,7 @@ public class GpodnetPreferences { private static Set<String> readListFromString(String s) { Set<String> result = new HashSet<>(); - for (String item : s.split(" ")) { - result.add(item); - } + Collections.addAll(result, s.split(" ")); return result; } 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 65298ff8d..743ee135d 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 @@ -7,6 +7,7 @@ import android.content.Intent; import android.content.SharedPreferences; import android.os.SystemClock; import android.preference.PreferenceManager; +import android.support.annotation.IntRange; import android.support.annotation.NonNull; import android.support.v4.app.NotificationCompat; import android.text.TextUtils; @@ -41,79 +42,79 @@ import de.danoeh.antennapod.core.util.Converter; */ public class UserPreferences { - public static final String IMPORT_DIR = "import/"; + private static final String IMPORT_DIR = "import/"; private static final String TAG = "UserPreferences"; // User Interface public static final String PREF_THEME = "prefTheme"; public static final String PREF_HIDDEN_DRAWER_ITEMS = "prefHiddenDrawerItems"; - public static final String PREF_DRAWER_FEED_ORDER = "prefDrawerFeedOrder"; - public static final String PREF_DRAWER_FEED_COUNTER = "prefDrawerFeedIndicator"; - public static final String PREF_EXPANDED_NOTIFICATION = "prefExpandNotify"; - public static final String PREF_PERSISTENT_NOTIFICATION = "prefPersistNotify"; + 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"; + 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"; - public static final String PREF_SHOW_DOWNLOAD_REPORT = "prefShowDownloadReport"; + private static final String PREF_SHOW_DOWNLOAD_REPORT = "prefShowDownloadReport"; // Queue - public static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront"; + private static final String PREF_QUEUE_ADD_TO_FRONT = "prefQueueAddToFront"; // Playback public static final String PREF_PAUSE_ON_HEADSET_DISCONNECT = "prefPauseOnHeadsetDisconnect"; public static final String PREF_UNPAUSE_ON_HEADSET_RECONNECT = "prefUnpauseOnHeadsetReconnect"; - public static final String PREF_UNPAUSE_ON_BLUETOOTH_RECONNECT = "prefUnpauseOnBluetoothReconnect"; - public static final String PREF_HARDWARE_FOWARD_BUTTON_SKIPS = "prefHardwareForwardButtonSkips"; - public static final String PREF_HARDWARE_PREVIOUS_BUTTON_RESTARTS = "prefHardwarePreviousButtonRestarts"; + private static final String PREF_UNPAUSE_ON_BLUETOOTH_RECONNECT = "prefUnpauseOnBluetoothReconnect"; + private static final String PREF_HARDWARE_FOWARD_BUTTON_SKIPS = "prefHardwareForwardButtonSkips"; + private static final String PREF_HARDWARE_PREVIOUS_BUTTON_RESTARTS = "prefHardwarePreviousButtonRestarts"; public static final String PREF_FOLLOW_QUEUE = "prefFollowQueue"; - public static final String PREF_SKIP_KEEPS_EPISODE = "prefSkipKeepsEpisode"; - public static final String PREF_FAVORITE_KEEPS_EPISODE = "prefFavoriteKeepsEpisode"; - public static final String PREF_AUTO_DELETE = "prefAutoDelete"; + private static final String PREF_SKIP_KEEPS_EPISODE = "prefSkipKeepsEpisode"; + private static final String PREF_FAVORITE_KEEPS_EPISODE = "prefFavoriteKeepsEpisode"; + private static final String PREF_AUTO_DELETE = "prefAutoDelete"; public static final String PREF_SMART_MARK_AS_PLAYED_SECS = "prefSmartMarkAsPlayedSecs"; - public static final String PREF_PLAYBACK_SPEED_ARRAY = "prefPlaybackSpeedArray"; - public static final String PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS = "prefPauseForFocusLoss"; - public static final String PREF_RESUME_AFTER_CALL = "prefResumeAfterCall"; + private static final String PREF_PLAYBACK_SPEED_ARRAY = "prefPlaybackSpeedArray"; + private static final String PREF_PAUSE_PLAYBACK_FOR_FOCUS_LOSS = "prefPauseForFocusLoss"; + private static final String PREF_RESUME_AFTER_CALL = "prefResumeAfterCall"; // Network - public static final String PREF_ENQUEUE_DOWNLOADED = "prefEnqueueDownloaded"; + private static final String PREF_ENQUEUE_DOWNLOADED = "prefEnqueueDownloaded"; public static final String PREF_UPDATE_INTERVAL = "prefAutoUpdateIntervall"; - public static final String PREF_MOBILE_UPDATE = "prefMobileUpdate"; + private static final String PREF_MOBILE_UPDATE = "prefMobileUpdate"; public static final String PREF_EPISODE_CLEANUP = "prefEpisodeCleanup"; public static final String PREF_PARALLEL_DOWNLOADS = "prefParallelDownloads"; public static final String PREF_EPISODE_CACHE_SIZE = "prefEpisodeCacheSize"; public static final String PREF_ENABLE_AUTODL = "prefEnableAutoDl"; public static final String PREF_ENABLE_AUTODL_ON_BATTERY = "prefEnableAutoDownloadOnBattery"; public static final String PREF_ENABLE_AUTODL_WIFI_FILTER = "prefEnableAutoDownloadWifiFilter"; - public static final String PREF_ENABLE_AUTODL_ON_MOBILE = "prefEnableAutoDownloadOnMobile"; - public static final String PREF_AUTODL_SELECTED_NETWORKS = "prefAutodownloadSelectedNetworks"; - public static final String PREF_PROXY_TYPE = "prefProxyType"; - public static final String PREF_PROXY_HOST = "prefProxyHost"; - public static final String PREF_PROXY_PORT = "prefProxyPort"; - public static final String PREF_PROXY_USER = "prefProxyUser"; - public static final String PREF_PROXY_PASSWORD = "prefProxyPassword"; + private static final String PREF_ENABLE_AUTODL_ON_MOBILE = "prefEnableAutoDownloadOnMobile"; + private static final String PREF_AUTODL_SELECTED_NETWORKS = "prefAutodownloadSelectedNetworks"; + private static final String PREF_PROXY_TYPE = "prefProxyType"; + private static final String PREF_PROXY_HOST = "prefProxyHost"; + private static final String PREF_PROXY_PORT = "prefProxyPort"; + private static final String PREF_PROXY_USER = "prefProxyUser"; + private static final String PREF_PROXY_PASSWORD = "prefProxyPassword"; // Services - public static final String PREF_AUTO_FLATTR = "pref_auto_flattr"; - public static final String PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD = "prefAutoFlattrPlayedDurationThreshold"; - public static final String PREF_GPODNET_NOTIFICATIONS = "pref_gpodnet_notifications"; + private static final String PREF_AUTO_FLATTR = "pref_auto_flattr"; + private static final String PREF_AUTO_FLATTR_PLAYED_DURATION_THRESHOLD = "prefAutoFlattrPlayedDurationThreshold"; + private static final String PREF_GPODNET_NOTIFICATIONS = "pref_gpodnet_notifications"; // Other - public static final String PREF_DATA_FOLDER = "prefDataFolder"; + private static final String PREF_DATA_FOLDER = "prefDataFolder"; public static final String PREF_IMAGE_CACHE_SIZE = "prefImageCacheSize"; // Mediaplayer - public static final String PREF_PLAYBACK_SPEED = "prefPlaybackSpeed"; + private static final String PREF_PLAYBACK_SPEED = "prefPlaybackSpeed"; private static final String PREF_FAST_FORWARD_SECS = "prefFastForwardSecs"; private static final String PREF_REWIND_SECS = "prefRewindSecs"; - public static final String PREF_QUEUE_LOCKED = "prefQueueLocked"; - public static final String IMAGE_CACHE_DEFAULT_VALUE = "100"; - public static final int IMAGE_CACHE_SIZE_MINIMUM = 20; - public static final String PREF_LEFT_VOLUME = "prefLeftVolume"; - public static final String PREF_RIGHT_VOLUME = "prefRightVolume"; + private static final String PREF_QUEUE_LOCKED = "prefQueueLocked"; + private static final String IMAGE_CACHE_DEFAULT_VALUE = "100"; + private static final int IMAGE_CACHE_SIZE_MINIMUM = 20; + private static final String PREF_LEFT_VOLUME = "prefLeftVolume"; + private static final String PREF_RIGHT_VOLUME = "prefRightVolume"; // Experimental public static final String PREF_SONIC = "prefSonic"; - public static final String PREF_STEREO_TO_MONO = "PrefStereoToMono"; + private static final String PREF_STEREO_TO_MONO = "PrefStereoToMono"; public static final String PREF_NORMALIZER = "prefNormalizer"; public static final String PREF_CAST_ENABLED = "prefCast"; //Used for enabling Chromecast support public static final int EPISODE_CLEANUP_QUEUE = -1; @@ -182,8 +183,8 @@ public class UserPreferences { String.valueOf(NOTIFICATION_BUTTON_SKIP)), ","); List<Integer> notificationButtons = new ArrayList<>(); - for (int i=0; i<buttons.length; i++) { - notificationButtons.add(Integer.parseInt(buttons[i])); + for (String button : buttons) { + notificationButtons.add(Integer.parseInt(button)); } return notificationButtons; } @@ -513,9 +514,8 @@ public class UserPreferences { .apply(); } - public static void setVolume(int leftVolume, int rightVolume) { - assert(0 <= leftVolume && leftVolume <= 100); - assert(0 <= rightVolume && rightVolume <= 100); + public static void setVolume(@IntRange(from = 0, to = 100) int leftVolume, + @IntRange(from = 0, to = 100) int rightVolume) { prefs.edit() .putInt(PREF_LEFT_VOLUME, leftVolume) .putInt(PREF_RIGHT_VOLUME, rightVolume) @@ -786,7 +786,7 @@ public class UserPreferences { /** * Sets the interval in which the feeds are refreshed automatically */ - public static void restartUpdateIntervalAlarm(long triggerAtMillis, long intervalMillis) { + private static void restartUpdateIntervalAlarm(long triggerAtMillis, long intervalMillis) { Log.d(TAG, "Restarting update alarm."); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, FeedUpdateReceiver.class); @@ -805,7 +805,7 @@ public class UserPreferences { /** * Sets time of day the feeds are refreshed automatically */ - public static void restartUpdateTimeOfDayAlarm(int hoursOfDay, int minute) { + private static void restartUpdateTimeOfDayAlarm(int hoursOfDay, int minute) { Log.d(TAG, "Restarting update alarm."); AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); PendingIntent updateIntent = PendingIntent.getBroadcast(context, 0, 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 6b3ece4ab..a723097a2 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 @@ -47,11 +47,11 @@ public class GpodnetSyncService extends Service { private static final long WAIT_INTERVAL = 5000L; - public static final String ARG_ACTION = "action"; + private static final String ARG_ACTION = "action"; - public static final String ACTION_SYNC = "de.danoeh.antennapod.intent.action.sync"; - public static final String ACTION_SYNC_SUBSCRIPTIONS = "de.danoeh.antennapod.intent.action.sync_subscriptions"; - public static final String ACTION_SYNC_ACTIONS = "de.danoeh.antennapod.intent.action.sync_ACTIONS"; + private static final String ACTION_SYNC = "de.danoeh.antennapod.intent.action.sync"; + private static final String ACTION_SYNC_SUBSCRIPTIONS = "de.danoeh.antennapod.intent.action.sync_subscriptions"; + private static final String ACTION_SYNC_ACTIONS = "de.danoeh.antennapod.intent.action.sync_ACTIONS"; private GpodnetService service; @@ -222,14 +222,12 @@ public class GpodnetSyncService extends Service { } catch (GpodnetServiceException e) { e.printStackTrace(); updateErrorNotification(e); - } catch (DownloadRequestException e) { - e.printStackTrace(); } } private synchronized void processEpisodeActions(List<GpodnetEpisodeAction> localActions, - List<GpodnetEpisodeAction> remoteActions) throws DownloadRequestException { + List<GpodnetEpisodeAction> remoteActions) { if(remoteActions.size() == 0) { return; } @@ -333,7 +331,7 @@ public class GpodnetSyncService extends Service { nm.notify(id, notification); } - private WaiterThread syncWaiterThread = new WaiterThread(WAIT_INTERVAL) { + private final WaiterThread syncWaiterThread = new WaiterThread(WAIT_INTERVAL) { @Override public void onWaitCompleted() { sync(); @@ -341,7 +339,7 @@ public class GpodnetSyncService extends Service { }; private abstract class WaiterThread { - private long waitInterval; + private final long waitInterval; private Thread thread; private WaiterThread(long waitInterval) { 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 eb28050f0..57d099dfc 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 @@ -42,10 +42,10 @@ import okhttp3.internal.http.StatusLine; public class AntennapodHttpClient { private static final String TAG = "AntennapodHttpClient"; - public static final int CONNECTION_TIMEOUT = 30000; - public static final int READ_TIMEOUT = 30000; + private static final int CONNECTION_TIMEOUT = 30000; + private static final int READ_TIMEOUT = 30000; - public static final int MAX_CONNECTIONS = 8; + private static final int MAX_CONNECTIONS = 8; private static volatile OkHttpClient httpClient = null; 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 de91916a9..9a64bebf7 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 @@ -17,15 +17,15 @@ public class DownloadRequest implements Parcelable { private String username; private String password; private String lastModified; - private boolean deleteOnFailure; + private final boolean deleteOnFailure; private final long feedfileId; private final int feedfileType; private final Bundle arguments; - protected int progressPercent; - protected long soFar; - protected long size; - protected int statusMsg; + private int progressPercent; + private long soFar; + private long size; + private int statusMsg; public DownloadRequest(@NonNull String destination, @NonNull String source, @@ -53,7 +53,7 @@ public class DownloadRequest implements Parcelable { this(destination, source, title, feedfileId, feedfileType, null, null, true, null); } - public DownloadRequest(Builder builder) { + private DownloadRequest(Builder builder) { this.destination = builder.destination; this.source = builder.source; this.title = builder.title; @@ -254,15 +254,15 @@ public class DownloadRequest implements Parcelable { } public static class Builder { - private String destination; - private String source; - private String title; + private final String destination; + private final String source; + private final String title; private String username; private String password; private String lastModified; private boolean deleteOnFailure = false; - private long feedfileId; - private int feedfileType; + private final long feedfileId; + private final int feedfileType; private Bundle arguments; public Builder(@NonNull String destination, @NonNull FeedFile item) { 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 5ee137563..d66af22ef 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 @@ -152,7 +152,7 @@ public class DownloadService extends Service { private static final int SCHED_EX_POOL_SIZE = 1; private ScheduledThreadPoolExecutor schedExecutor; - private Handler postHandler = new Handler(); + private final Handler postHandler = new Handler(); private final IBinder mBinder = new LocalBinder(); @@ -162,7 +162,7 @@ public class DownloadService extends Service { } } - private Thread downloadCompletionThread = new Thread() { + private final Thread downloadCompletionThread = new Thread() { private static final String TAG = "downloadCompletionThd"; @Override @@ -384,7 +384,7 @@ public class DownloadService extends Service { return null; } - private BroadcastReceiver cancelDownloadReceiver = new BroadcastReceiver() { + private final BroadcastReceiver cancelDownloadReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { @@ -534,14 +534,14 @@ public class DownloadService extends Service { * Calls query downloads on the services main thread. This method should be used instead of queryDownloads if it is * used from a thread other than the main thread. */ - void queryDownloadsAsync() { + private void queryDownloadsAsync() { handler.post(DownloadService.this::queryDownloads); } /** * Check if there's something else to download, otherwise stop */ - void queryDownloads() { + private void queryDownloads() { Log.d(TAG, numberOfDownloads.get() + " downloads left"); if (numberOfDownloads.get() <= 0 && DownloadRequester.getInstance().hasNoDownloads()) { @@ -604,9 +604,9 @@ public class DownloadService extends Service { private class FeedSyncThread extends Thread { private static final String TAG = "FeedSyncThread"; - private BlockingQueue<DownloadRequest> completedRequests = new LinkedBlockingDeque<>(); - private CompletionService<Pair<DownloadRequest, FeedHandlerResult>> parserService = new ExecutorCompletionService<>(Executors.newSingleThreadExecutor()); - private ExecutorService dbService = Executors.newSingleThreadExecutor(); + private final BlockingQueue<DownloadRequest> completedRequests = new LinkedBlockingDeque<>(); + private final CompletionService<Pair<DownloadRequest, FeedHandlerResult>> parserService = new ExecutorCompletionService<>(Executors.newSingleThreadExecutor()); + private final ExecutorService dbService = Executors.newSingleThreadExecutor(); private Future<?> dbUpdateFuture; private volatile boolean isActive = true; private volatile boolean isCollectingRequests = false; @@ -766,7 +766,7 @@ public class DownloadService extends Service { private class FeedParserTask implements Callable<Pair<DownloadRequest, FeedHandlerResult>> { - private DownloadRequest request; + private final DownloadRequest request; private FeedParserTask(DownloadRequest request) { this.request = request; @@ -952,8 +952,8 @@ public class DownloadService extends Service { */ private static class FailedDownloadHandler implements Runnable { - private DownloadRequest request; - private DownloadStatus status; + private final DownloadRequest request; + private final DownloadStatus status; FailedDownloadHandler(DownloadStatus status, DownloadRequest request) { this.request = request; @@ -975,7 +975,7 @@ public class DownloadService extends Service { */ private class MediaHandlerThread implements Runnable { - private DownloadRequest request; + private final DownloadRequest request; private DownloadStatus status; MediaHandlerThread(@NonNull DownloadStatus status, @@ -1091,7 +1091,7 @@ public class DownloadService extends Service { private long lastPost = 0; - final Runnable postDownloaderTask = new Runnable() { + private final Runnable postDownloaderTask = new Runnable() { @Override public void run() { List<Downloader> list = Collections.unmodifiableList(downloads); diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java index ed2b00dfe..5debc6d05 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/DownloadStatus.java @@ -19,37 +19,37 @@ public class DownloadStatus { // ----------------------------------- ATTRIBUTES STORED IN DB /** Unique id for storing the object in database. */ - protected long id; + private long id; /** * A human-readable string which is shown to the user so that he can * identify the download. Should be the title of the item/feed/media or the * URL if the download has no other title. */ - protected String title; - protected DownloadError reason; + private final String title; + private DownloadError reason; /** * A message which can be presented to the user to give more information. * Should be null if Download was successful. */ - protected String reasonDetailed; - protected boolean successful; - protected Date completionDate; - protected long feedfileId; + private String reasonDetailed; + private boolean successful; + private Date completionDate; + private final long feedfileId; /** * Is used to determine the type of the feedfile even if the feedfile does * not exist anymore. The value should be FEEDFILETYPE_FEED, * FEEDFILETYPE_FEEDIMAGE or FEEDFILETYPE_FEEDMEDIA */ - protected int feedfileType; + private final int feedfileType; // ------------------------------------ NOT STORED IN DB - protected boolean done; - protected boolean cancelled; + private boolean done; + private boolean cancelled; /** Constructor for restoring Download status entries from DB. */ - public DownloadStatus(long id, String title, long feedfileId, - int feedfileType, boolean successful, DownloadError reason, - Date completionDate, String reasonDetailed) { + private DownloadStatus(long id, String title, long feedfileId, + int feedfileType, boolean successful, DownloadError reason, + Date completionDate, String reasonDetailed) { this.id = id; this.title = title; this.done = true; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/Downloader.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/Downloader.java index d8042d202..445210d3a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/Downloader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/Downloader.java @@ -14,14 +14,14 @@ import de.danoeh.antennapod.core.R; public abstract class Downloader implements Callable<Downloader> { private static final String TAG = "Downloader"; - protected volatile boolean finished; + private volatile boolean finished; - protected volatile boolean cancelled; + volatile boolean cancelled; - protected DownloadRequest request; - protected DownloadStatus result; + final DownloadRequest request; + final DownloadStatus result; - public Downloader(DownloadRequest request) { + Downloader(DownloadRequest request) { super(); this.request = request; this.request.setStatusMsg(R.string.download_pending); @@ -33,7 +33,7 @@ public abstract class Downloader implements Callable<Downloader> { public final Downloader call() { WifiManager wifiManager = (WifiManager) - ClientConfig.applicationCallbacks.getApplicationInstance().getSystemService(Context.WIFI_SERVICE); + ClientConfig.applicationCallbacks.getApplicationInstance().getApplicationContext().getSystemService(Context.WIFI_SERVICE); WifiManager.WifiLock wifiLock = null; if (wifiManager != null) { wifiLock = wifiManager.createWifiLock(TAG); 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 77d664b74..181a6f619 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 @@ -316,7 +316,7 @@ public class HttpDownloader extends Downloader { private static class BasicAuthorizationInterceptor implements Interceptor { - private DownloadRequest downloadRequest; + private final DownloadRequest downloadRequest; public BasicAuthorizationInterceptor(DownloadRequest downloadRequest) { this.downloadRequest = downloadRequest; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java index 11cd21db5..5f205c515 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java @@ -32,7 +32,7 @@ import de.danoeh.antennapod.core.util.playback.VideoPlayer; * Manages the MediaPlayer object of the PlaybackService. */ public class LocalPSMP extends PlaybackServiceMediaPlayer { - public static final String TAG = "LclPlaybackSvcMPlayer"; + private static final String TAG = "LclPlaybackSvcMPlayer"; private final AudioManager audioManager; @@ -42,7 +42,7 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { private volatile boolean stream; private volatile MediaType mediaType; - private volatile AtomicBoolean startWhenPrepared; + private final AtomicBoolean startWhenPrepared; private volatile boolean pausedBecauseOfTransientAudiofocusLoss; private volatile Pair<Integer, Integer> videoSize; @@ -710,52 +710,49 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { @Override public void onAudioFocusChange(final int focusChange) { - executor.submit(new Runnable() { - @Override - public void run() { - playerLock.lock(); - - // If there is an incoming call, playback should be paused permanently - TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); - final int callState = (tm != null) ? tm.getCallState() : 0; - Log.i(TAG, "Call state:" + callState); - - if (focusChange == AudioManager.AUDIOFOCUS_LOSS || - (!UserPreferences.shouldResumeAfterCall() && callState != TelephonyManager.CALL_STATE_IDLE)) { - Log.d(TAG, "Lost audio focus"); - pause(true, false); - callback.shouldStop(); - } else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) { - Log.d(TAG, "Gained audio focus"); - if (pausedBecauseOfTransientAudiofocusLoss) { // we paused => play now - resume(); - } else { // we ducked => raise audio level back - setVolumeSync(UserPreferences.getLeftVolume(), - UserPreferences.getRightVolume()); - } - } else if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) { - if (playerStatus == PlayerStatus.PLAYING) { - if (!UserPreferences.shouldPauseForFocusLoss()) { - Log.d(TAG, "Lost audio focus temporarily. Ducking..."); - final float DUCK_FACTOR = 0.25f; - setVolumeSync(DUCK_FACTOR * UserPreferences.getLeftVolume(), - DUCK_FACTOR * UserPreferences.getRightVolume()); - pausedBecauseOfTransientAudiofocusLoss = false; - } else { - Log.d(TAG, "Lost audio focus temporarily. Could duck, but won't, pausing..."); - pause(false, false); - pausedBecauseOfTransientAudiofocusLoss = true; - } - } - } else if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT) { - if (playerStatus == PlayerStatus.PLAYING) { - Log.d(TAG, "Lost audio focus temporarily. Pausing..."); + executor.submit(() -> { + playerLock.lock(); + + // If there is an incoming call, playback should be paused permanently + TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); + final int callState = (tm != null) ? tm.getCallState() : 0; + Log.i(TAG, "Call state:" + callState); + + if (focusChange == AudioManager.AUDIOFOCUS_LOSS || + (!UserPreferences.shouldResumeAfterCall() && callState != TelephonyManager.CALL_STATE_IDLE)) { + Log.d(TAG, "Lost audio focus"); + pause(true, false); + callback.shouldStop(); + } else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) { + Log.d(TAG, "Gained audio focus"); + if (pausedBecauseOfTransientAudiofocusLoss) { // we paused => play now + resume(); + } else { // we ducked => raise audio level back + setVolumeSync(UserPreferences.getLeftVolume(), + UserPreferences.getRightVolume()); + } + } else if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) { + if (playerStatus == PlayerStatus.PLAYING) { + if (!UserPreferences.shouldPauseForFocusLoss()) { + Log.d(TAG, "Lost audio focus temporarily. Ducking..."); + final float DUCK_FACTOR = 0.25f; + setVolumeSync(DUCK_FACTOR * UserPreferences.getLeftVolume(), + DUCK_FACTOR * UserPreferences.getRightVolume()); + pausedBecauseOfTransientAudiofocusLoss = false; + } else { + Log.d(TAG, "Lost audio focus temporarily. Could duck, but won't, pausing..."); pause(false, false); pausedBecauseOfTransientAudiofocusLoss = true; } } - playerLock.unlock(); + } else if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT) { + if (playerStatus == PlayerStatus.PLAYING) { + Log.d(TAG, "Lost audio focus temporarily. Pausing..."); + pause(false, false); + pausedBecauseOfTransientAudiofocusLoss = true; + } } + playerLock.unlock(); }); } }; 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 c600501c0..417716810 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 @@ -88,7 +88,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { /** * True if cast session should disconnect. */ - public static final String EXTRA_CAST_DISCONNECT = "extra.de.danoeh.antennapod.core.service.castDisconnect"; + private static final String EXTRA_CAST_DISCONNECT = "extra.de.danoeh.antennapod.core.service.castDisconnect"; /** * True if media should be streamed. */ @@ -198,7 +198,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { /** * Is true if the service was running, but paused due to headphone disconnect */ - public static boolean transientPause = false; + private static boolean transientPause = false; /** * Is true if a Cast Device is connected to the service. */ @@ -910,7 +910,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { taskManager.setSleepTimer(waitingTime, shakeToReset, vibrate); sendNotificationBroadcast(NOTIFICATION_TYPE_SLEEPTIMER_UPDATE, 0); EventBus.getDefault().post(new MessageEvent(getString(R.string.sleep_timer_enabled_label), - () -> disableSleepTimer())); + this::disableSleepTimer)); } public void disableSleepTimer() { @@ -1630,7 +1630,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { } - public void seekDelta(final int d) { + private void seekDelta(final int d) { mediaPlayer.seekDelta(d); } @@ -1784,7 +1784,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { } }; - private SharedPreferences.OnSharedPreferenceChangeListener prefListener = + private final SharedPreferences.OnSharedPreferenceChangeListener prefListener = (sharedPreferences, key) -> { if (UserPreferences.PREF_LOCKSCREEN_BACKGROUND.equals(key)) { updateMediaSessionMetadata(getPlayable()); @@ -1806,7 +1806,7 @@ public class PlaybackService extends MediaBrowserServiceCompat { void unregisterReceiver(BroadcastReceiver receiver); } - private FlavorHelperCallback flavorHelperCallback = new FlavorHelperCallback() { + private final FlavorHelperCallback flavorHelperCallback = new FlavorHelperCallback() { @Override public PlaybackServiceMediaPlayer.PSMPCallback getMediaPlayerCallback() { return PlaybackService.this.mediaPlayerCallback; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java index 393019fd1..a2481b801 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceMediaPlayer.java @@ -24,14 +24,14 @@ import de.danoeh.antennapod.core.util.playback.Playable; * and remote (cast devices) playback. */ public abstract class PlaybackServiceMediaPlayer { - public static final String TAG = "PlaybackSvcMediaPlayer"; + private static final String TAG = "PlaybackSvcMediaPlayer"; /** * Return value of some PSMP methods if the method call failed. */ static final int INVALID_TIME = -1; - volatile PlayerStatus oldPlayerStatus; + private volatile PlayerStatus oldPlayerStatus; volatile PlayerStatus playerStatus; /** @@ -39,8 +39,8 @@ public abstract class PlaybackServiceMediaPlayer { */ private WifiManager.WifiLock wifiLock; - protected final PSMPCallback callback; - protected final Context context; + final PSMPCallback callback; + final Context context; PlaybackServiceMediaPlayer(@NonNull Context context, @NonNull PSMPCallback callback){ @@ -279,7 +279,7 @@ public abstract class PlaybackServiceMediaPlayer { final synchronized void acquireWifiLockIfNecessary() { if (shouldLockWifi()) { if (wifiLock == null) { - wifiLock = ((WifiManager) context.getSystemService(Context.WIFI_SERVICE)) + wifiLock = ((WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL, TAG); wifiLock.setReferenceCounted(false); } @@ -365,7 +365,7 @@ public abstract class PlaybackServiceMediaPlayer { * Holds information about a PSMP object. */ public static class PSMPInfo { - public PlayerStatus oldPlayerStatus; + public final PlayerStatus oldPlayerStatus; public PlayerStatus playerStatus; public Playable playable; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java index 0c7d5e718..3d97e862a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceTaskManager.java @@ -295,7 +295,7 @@ public class PlaybackServiceTaskManager { /** * Sleeps for a given time and then pauses playback. */ - protected class SleepTimer implements Runnable { + class SleepTimer implements Runnable { private static final String TAG = "SleepTimer"; private static final long UPDATE_INTERVAL = 1000L; private static final long NOTIFICATION_THRESHOLD = 10000; diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/ShakeListener.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/ShakeListener.java index fcd96826b..c0b1b3bc0 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/ShakeListener.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/ShakeListener.java @@ -7,14 +7,14 @@ import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.util.Log; -public class ShakeListener implements SensorEventListener +class ShakeListener implements SensorEventListener { private static final String TAG = ShakeListener.class.getSimpleName(); private Sensor mAccelerometer; private SensorManager mSensorMgr; - private PlaybackServiceTaskManager.SleepTimer mSleepTimer; - private Context mContext; + private final PlaybackServiceTaskManager.SleepTimer mSleepTimer; + private final Context mContext; public ShakeListener(Context context, PlaybackServiceTaskManager.SleepTimer sleepTimer) { mContext = context; @@ -22,7 +22,7 @@ public class ShakeListener implements SensorEventListener resume(); } - public void resume() { + private void resume() { // only a precaution, the user should actually not be able to activate shake to reset // when the accelerometer is not available mSensorMgr = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE); 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 743accb08..fa87cc216 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 @@ -44,7 +44,7 @@ public final class DBReader { /** * Maximum size of the list returned by {@link #getDownloadLog()}. */ - public static final int DOWNLOAD_LOG_SIZE = 200; + private static final int DOWNLOAD_LOG_SIZE = 200; private DBReader() { @@ -120,7 +120,7 @@ public final class DBReader { loadFeedDataOfFeedItemList(items); } - public static void loadTagsOfFeedItemList(List<FeedItem> items) { + private static void loadTagsOfFeedItemList(List<FeedItem> items) { LongList favoriteIds = getFavoriteIDList(); LongList queueIds = getQueueIDList(); @@ -141,7 +141,7 @@ public final class DBReader { * * @param items The FeedItems whose Feed-objects should be loaded. */ - public static void loadFeedDataOfFeedItemList(List<FeedItem> items) { + private static void loadFeedDataOfFeedItemList(List<FeedItem> items) { List<Feed> feeds = getFeedList(); Map<Long, Feed> feedIndex = new ArrayMap<>(feeds.size()); @@ -412,7 +412,7 @@ public final class DBReader { } } - public static LongList getFavoriteIDList() { + private static LongList getFavoriteIDList() { Log.d(TAG, "getFavoriteIDList() called"); PodDBAdapter adapter = PodDBAdapter.getInstance(); @@ -663,7 +663,7 @@ public final class DBReader { } } - static FeedItem getFeedItem(final String podcastUrl, final String episodeUrl, PodDBAdapter adapter) { + private static FeedItem getFeedItem(final String podcastUrl, final String episodeUrl, PodDBAdapter adapter) { Log.d(TAG, "Loading feeditem with podcast url " + podcastUrl + " and episode url " + episodeUrl); Cursor cursor = null; try { @@ -797,7 +797,7 @@ public final class DBReader { } } - static void loadChaptersOfFeedItem(PodDBAdapter adapter, FeedItem item) { + private static void loadChaptersOfFeedItem(PodDBAdapter adapter, FeedItem item) { Cursor cursor = null; try { cursor = adapter.getSimpleChaptersOfFeedItemCursor(item); @@ -1023,14 +1023,14 @@ public final class DBReader { /** * Simply sums up time of podcasts that are marked as played */ - public long totalTimeCountAll; + public final long totalTimeCountAll; /** * Respects speed, listening twice, ... */ - public long totalTime; + public final long totalTime; - public List<StatisticsItem> feedTime; + public final List<StatisticsItem> feedTime; public StatisticsData(long totalTime, long totalTimeCountAll, List<StatisticsItem> feedTime) { this.totalTime = totalTime; @@ -1040,26 +1040,26 @@ public final class DBReader { } public static class StatisticsItem { - public Feed feed; - public long time; + public final Feed feed; + public final long time; /** * Respects speed, listening twice, ... */ - public long timePlayed; + public final long timePlayed; /** * Simply sums up time of podcasts that are marked as played */ - public long timePlayedCountAll; - public long episodes; + public final long timePlayedCountAll; + public final long episodes; /** * Episodes that are actually played */ - public long episodesStarted; + public final long episodesStarted; /** * All episodes that are marked as played (or have position != 0) */ - public long episodesStartedIncludingMarked; + public final long episodesStartedIncludingMarked; public StatisticsItem(Feed feed, long time, long timePlayed, long timePlayedCountAll, long episodes, long episodesStarted, long episodesStartedIncludingMarked) { @@ -1195,12 +1195,12 @@ public final class DBReader { } public static class NavDrawerData { - public List<Feed> feeds; - public int queueSize; - public int numNewItems; - public int numDownloadedItems; - public LongIntMap feedCounters; - public int reclaimableSpace; + public final List<Feed> feeds; + public final int queueSize; + public final int numNewItems; + public final int numDownloadedItems; + public final LongIntMap feedCounters; + public final int reclaimableSpace; public NavDrawerData(List<Feed> feeds, int queueSize, 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 90ef217ff..573954412 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 @@ -47,13 +47,13 @@ import static android.content.Context.MODE_PRIVATE; public final class DBTasks { private static final String TAG = "DBTasks"; - public static final String PREF_NAME = "dbtasks"; + private static final String PREF_NAME = "dbtasks"; private static final String PREF_LAST_REFRESH = "last_refresh"; /** * Executor service used by the autodownloadUndownloadedEpisodes method. */ - private static ExecutorService autodownloadExec; + private static final ExecutorService autodownloadExec; static { autodownloadExec = Executors.newSingleThreadExecutor(r -> { @@ -149,7 +149,7 @@ public final class DBTasks { } } - private static AtomicBoolean isRefreshing = new AtomicBoolean(false); + private static final AtomicBoolean isRefreshing = new AtomicBoolean(false); /** * Refreshes a given list of Feeds in a separate Thread. This method might ignore subsequent calls if it is still @@ -292,7 +292,7 @@ public final class DBTasks { * @param context Used for requesting the download. * @param feed The Feed object. */ - public static void refreshFeed(Context context, Feed feed) + private static void refreshFeed(Context context, Feed feed) throws DownloadRequestException { Log.d(TAG, "refreshFeed(feed.id: " + feed.getId() +")"); refreshFeed(context, feed, false, false); @@ -803,7 +803,7 @@ public final class DBTasks { */ abstract static class QueryTask<T> implements Callable<T> { private T result; - private Context context; + private final Context context; public QueryTask(Context context) { this.context = context; @@ -820,7 +820,7 @@ public final class DBTasks { public abstract void execute(PodDBAdapter adapter); - protected void setResult(T result) { + void setResult(T result) { this.result = result; } } 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 8d507fb9a..75510d2f6 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 @@ -382,8 +382,8 @@ public class DBWriter { // add item to either front ot back of queue boolean addToFront = UserPreferences.enqueueAtFront(); if (addToFront) { - queue.add(0 + i, item); - events.add(QueueEvent.added(item, 0 + i)); + queue.add(i, item); + events.add(QueueEvent.added(item, i)); } else { queue.add(item); events.add(QueueEvent.added(item, queue.size() - 1)); @@ -838,9 +838,9 @@ public class DBWriter { * * @param startFlattrClickWorker true if FlattrClickWorker should be started after the FlattrStatus has been saved */ - public static Future<?> setFeedItemFlattrStatus(final Context context, - final FeedItem item, - final boolean startFlattrClickWorker) { + private static Future<?> setFeedItemFlattrStatus(final Context context, + final FeedItem item, + final boolean startFlattrClickWorker) { return dbExec.submit(() -> { PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); 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 933be07ff..a8fd79fda 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 @@ -33,8 +33,8 @@ public class DownloadRequester { private static final String TAG = "DownloadRequester"; public static final String IMAGE_DOWNLOADPATH = "images/"; - public static final String FEED_DOWNLOADPATH = "cache/"; - public static final String MEDIA_DOWNLOADPATH = "media/"; + private static final String FEED_DOWNLOADPATH = "cache/"; + private static final String MEDIA_DOWNLOADPATH = "media/"; /** * Denotes the page of the feed that is contained in the DownloadRequest sent by the DownloadRequester. @@ -48,7 +48,7 @@ public class DownloadRequester { private static DownloadRequester downloader; - private Map<String, DownloadRequest> downloads; + private final Map<String, DownloadRequest> downloads; private DownloadRequester() { downloads = new ConcurrentHashMap<>(); @@ -305,13 +305,13 @@ public class DownloadRequester { return downloads.size(); } - public synchronized String getFeedfilePath(Context context) + private synchronized String getFeedfilePath(Context context) throws DownloadRequestException { return getExternalFilesDirOrThrowException(context, FEED_DOWNLOADPATH) .toString() + "/"; } - public synchronized String getFeedfileName(Feed feed) { + private synchronized String getFeedfileName(Feed feed) { String filename = feed.getDownload_url(); if (feed.getTitle() != null && !feed.getTitle().isEmpty()) { filename = feed.getTitle(); @@ -319,7 +319,7 @@ public class DownloadRequester { return "feed-" + FileNameGenerator.generateFileName(filename); } - public synchronized String getMediafilePath(Context context, FeedMedia media) + private synchronized String getMediafilePath(Context context, FeedMedia media) throws DownloadRequestException { File externalStorage = getExternalFilesDirOrThrowException( context, diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java index 97cbdca33..aae5b352e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java @@ -15,7 +15,7 @@ public abstract class EpisodeCleanupAlgorithm { * or getPerformCleanupParameter. * @return The number of episodes that were deleted. */ - public abstract int performCleanup(Context context, int numToRemove); + protected abstract int performCleanup(Context context, int numToRemove); public int performCleanup(Context context) { return performCleanup(context, getDefaultCleanupParameter()); @@ -26,7 +26,7 @@ public abstract class EpisodeCleanupAlgorithm { * space to free to satisfy the episode cache conditions. If the conditions are already satisfied, this * method should not have any effects. */ - public abstract int getDefaultCleanupParameter(); + protected abstract int getDefaultCleanupParameter(); /** * Cleans up just enough episodes to make room for the requested number @@ -48,7 +48,7 @@ public abstract class EpisodeCleanupAlgorithm { * @param amountOfRoomNeeded the number of episodes we want to download * @return the number of episodes to delete in order to make room */ - protected int getNumEpisodesToCleanup(final int amountOfRoomNeeded) { + int getNumEpisodesToCleanup(final int amountOfRoomNeeded) { if (amountOfRoomNeeded >= 0 && UserPreferences.getEpisodeCacheSize() != UserPreferences .getEpisodeCacheSizeUnlimited()) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/FeedItemStatistics.java b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedItemStatistics.java index 09949b87e..d84279f6e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/FeedItemStatistics.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedItemStatistics.java @@ -8,11 +8,11 @@ import java.util.Date; * Contains information about a feed's items. */ public class FeedItemStatistics { - private long feedID; - private int numberOfItems; - private int numberOfNewItems; - private int numberOfInProgressItems; - private Date lastUpdate; + private final long feedID; + private final int numberOfItems; + private final int numberOfNewItems; + private final int numberOfInProgressItems; + private final Date lastUpdate; private static final Date UNKNOWN_DATE = new Date(0); @@ -26,7 +26,7 @@ public class FeedItemStatistics { * @param lastUpdate pubDate of the latest episode. A lastUpdate value of 0 will be interpreted as DATE_UNKOWN if * numberOfItems is 0. */ - public FeedItemStatistics(long feedID, int numberOfItems, int numberOfNewItems, int numberOfInProgressItems, Date lastUpdate) { + private FeedItemStatistics(long feedID, int numberOfItems, int numberOfNewItems, int numberOfInProgressItems, Date lastUpdate) { this.feedID = feedID; this.numberOfItems = numberOfItems; this.numberOfNewItems = numberOfNewItems; 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 31499c33e..7d6ba0e32 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 @@ -10,7 +10,6 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; import android.media.MediaMetadataRetriever; -import android.os.Build; import android.text.TextUtils; import android.util.Log; @@ -74,7 +73,7 @@ public class PodDBAdapter { public static final String KEY_MIME_TYPE = "mime_type"; public static final String KEY_IMAGE = "image"; public static final String KEY_FEED = "feed"; - public static final String KEY_MEDIA = "media"; + private static final String KEY_MEDIA = "media"; public static final String KEY_DOWNLOADED = "downloaded"; public static final String KEY_LASTUPDATE = "last_update"; public static final String KEY_FEEDFILE = "feedfile"; @@ -126,7 +125,7 @@ public class PodDBAdapter { private static final String TABLE_PRIMARY_KEY = KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ,"; - public static final String CREATE_TABLE_FEEDS = "CREATE TABLE " + private static final String CREATE_TABLE_FEEDS = "CREATE TABLE " + TABLE_NAME_FEEDS + " (" + TABLE_PRIMARY_KEY + KEY_TITLE + " TEXT," + KEY_CUSTOM_TITLE + " TEXT," + KEY_FILE_URL + " TEXT," + KEY_DOWNLOAD_URL + " TEXT," + KEY_DOWNLOADED + " INTEGER," + KEY_LINK + " TEXT," @@ -146,7 +145,7 @@ public class PodDBAdapter { + KEY_LAST_UPDATE_FAILED + " INTEGER DEFAULT 0," + KEY_AUTO_DELETE_ACTION + " INTEGER DEFAULT 0)"; - public static final String CREATE_TABLE_FEED_ITEMS = "CREATE TABLE " + private static final String CREATE_TABLE_FEED_ITEMS = "CREATE TABLE " + TABLE_NAME_FEED_ITEMS + " (" + TABLE_PRIMARY_KEY + KEY_TITLE + " TEXT," + KEY_CONTENT_ENCODED + " TEXT," + KEY_PUBDATE + " INTEGER," + KEY_READ + " INTEGER," + KEY_LINK + " TEXT," @@ -157,12 +156,12 @@ public class PodDBAdapter { + KEY_IMAGE + " INTEGER," + KEY_AUTO_DOWNLOAD + " INTEGER)"; - public static final String CREATE_TABLE_FEED_IMAGES = "CREATE TABLE " + private static final String CREATE_TABLE_FEED_IMAGES = "CREATE TABLE " + TABLE_NAME_FEED_IMAGES + " (" + TABLE_PRIMARY_KEY + KEY_TITLE + " TEXT," + KEY_FILE_URL + " TEXT," + KEY_DOWNLOAD_URL + " TEXT," + KEY_DOWNLOADED + " INTEGER)"; - public static final String CREATE_TABLE_FEED_MEDIA = "CREATE TABLE " + private static final String CREATE_TABLE_FEED_MEDIA = "CREATE TABLE " + TABLE_NAME_FEED_MEDIA + " (" + TABLE_PRIMARY_KEY + KEY_DURATION + " INTEGER," + KEY_FILE_URL + " TEXT," + KEY_DOWNLOAD_URL + " TEXT," + KEY_DOWNLOADED + " INTEGER," + KEY_POSITION @@ -173,53 +172,53 @@ public class PodDBAdapter { + KEY_HAS_EMBEDDED_PICTURE + " INTEGER," + KEY_LAST_PLAYED_TIME + " INTEGER)"; - public static final String CREATE_TABLE_DOWNLOAD_LOG = "CREATE TABLE " + private static final String CREATE_TABLE_DOWNLOAD_LOG = "CREATE TABLE " + TABLE_NAME_DOWNLOAD_LOG + " (" + TABLE_PRIMARY_KEY + KEY_FEEDFILE + " INTEGER," + KEY_FEEDFILETYPE + " INTEGER," + KEY_REASON + " INTEGER," + KEY_SUCCESSFUL + " INTEGER," + KEY_COMPLETION_DATE + " INTEGER," + KEY_REASON_DETAILED + " TEXT," + KEY_DOWNLOADSTATUS_TITLE + " TEXT)"; - public static final String CREATE_TABLE_QUEUE = "CREATE TABLE " + private static final String CREATE_TABLE_QUEUE = "CREATE TABLE " + TABLE_NAME_QUEUE + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_FEEDITEM + " INTEGER," + KEY_FEED + " INTEGER)"; - public static final String CREATE_TABLE_SIMPLECHAPTERS = "CREATE TABLE " + private static final String CREATE_TABLE_SIMPLECHAPTERS = "CREATE TABLE " + TABLE_NAME_SIMPLECHAPTERS + " (" + TABLE_PRIMARY_KEY + KEY_TITLE + " TEXT," + KEY_START + " INTEGER," + KEY_FEEDITEM + " INTEGER," + KEY_LINK + " TEXT," + KEY_CHAPTER_TYPE + " INTEGER)"; // SQL Statements for creating indexes - public static final String CREATE_INDEX_FEEDITEMS_FEED = "CREATE INDEX " + private static final String CREATE_INDEX_FEEDITEMS_FEED = "CREATE INDEX " + TABLE_NAME_FEED_ITEMS + "_" + KEY_FEED + " ON " + TABLE_NAME_FEED_ITEMS + " (" + KEY_FEED + ")"; - public static final String CREATE_INDEX_FEEDITEMS_IMAGE = "CREATE INDEX " + private static final String CREATE_INDEX_FEEDITEMS_IMAGE = "CREATE INDEX " + TABLE_NAME_FEED_ITEMS + "_" + KEY_IMAGE + " ON " + TABLE_NAME_FEED_ITEMS + " (" + KEY_IMAGE + ")"; - public static final String CREATE_INDEX_FEEDITEMS_PUBDATE = "CREATE INDEX IF NOT EXISTS " + private static final String CREATE_INDEX_FEEDITEMS_PUBDATE = "CREATE INDEX IF NOT EXISTS " + TABLE_NAME_FEED_ITEMS + "_" + KEY_PUBDATE + " ON " + TABLE_NAME_FEED_ITEMS + " (" + KEY_PUBDATE + ")"; - public static final String CREATE_INDEX_FEEDITEMS_READ = "CREATE INDEX IF NOT EXISTS " + private static final String CREATE_INDEX_FEEDITEMS_READ = "CREATE INDEX IF NOT EXISTS " + TABLE_NAME_FEED_ITEMS + "_" + KEY_READ + " ON " + TABLE_NAME_FEED_ITEMS + " (" + KEY_READ + ")"; - public static final String CREATE_INDEX_QUEUE_FEEDITEM = "CREATE INDEX " + private static final String CREATE_INDEX_QUEUE_FEEDITEM = "CREATE INDEX " + TABLE_NAME_QUEUE + "_" + KEY_FEEDITEM + " ON " + TABLE_NAME_QUEUE + " (" + KEY_FEEDITEM + ")"; - public static final String CREATE_INDEX_FEEDMEDIA_FEEDITEM = "CREATE INDEX " + private static final String CREATE_INDEX_FEEDMEDIA_FEEDITEM = "CREATE INDEX " + TABLE_NAME_FEED_MEDIA + "_" + KEY_FEEDITEM + " ON " + TABLE_NAME_FEED_MEDIA + " (" + KEY_FEEDITEM + ")"; - public static final String CREATE_INDEX_SIMPLECHAPTERS_FEEDITEM = "CREATE INDEX " + private static final String CREATE_INDEX_SIMPLECHAPTERS_FEEDITEM = "CREATE INDEX " + TABLE_NAME_SIMPLECHAPTERS + "_" + KEY_FEEDITEM + " ON " + TABLE_NAME_SIMPLECHAPTERS + " (" + KEY_FEEDITEM + ")"; - public static final String CREATE_TABLE_FAVORITES = "CREATE TABLE " + private static final String CREATE_TABLE_FAVORITES = "CREATE TABLE " + TABLE_NAME_FAVORITES + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_FEEDITEM + " INTEGER," + KEY_FEED + " INTEGER)"; @@ -310,8 +309,8 @@ public class PodDBAdapter { private static PodDBHelper dbHelper; private static volatile SQLiteDatabase db; - private static Lock dbLock = new ReentrantLock(); - private static AtomicInteger counter = new AtomicInteger(0); + private static final Lock dbLock = new ReentrantLock(); + private static final AtomicInteger counter = new AtomicInteger(0); public static void init(Context context) { PodDBAdapter.context = context.getApplicationContext(); @@ -392,7 +391,7 @@ public class PodDBAdapter { * * @return the id of the entry */ - public long setFeed(Feed feed) { + private long setFeed(Feed feed) { ContentValues values = new ContentValues(); values.put(KEY_TITLE, feed.getFeedTitle()); values.put(KEY_LINK, feed.getLink()); @@ -839,7 +838,7 @@ public class PodDBAdapter { } } - public void setChapters(FeedItem item) { + private void setChapters(FeedItem item) { ContentValues values = new ContentValues(); for (Chapter chapter : item.getChapters()) { values.put(KEY_TITLE, chapter.getTitle()); @@ -947,7 +946,7 @@ public class PodDBAdapter { db.execSQL(deleteClause); } - public boolean isItemInFavorites(FeedItem item) { + private boolean isItemInFavorites(FeedItem item) { String query = String.format("SELECT %s from %s WHERE %s=%d", KEY_ID, TABLE_NAME_FAVORITES, KEY_FEEDITEM, item.getId()); Cursor c = db.rawQuery(query, null); @@ -991,7 +990,7 @@ public class PodDBAdapter { db.delete(TABLE_NAME_QUEUE, null, null); } - public void removeFeedMedia(FeedMedia media) { + private void removeFeedMedia(FeedMedia media) { // delete download log entries for feed media db.delete(TABLE_NAME_DOWNLOAD_LOG, KEY_FEEDFILE + "=? AND " + KEY_FEEDFILETYPE + "=?", new String[]{String.valueOf(media.getId()), String.valueOf(FeedMedia.FEEDFILETYPE_FEEDMEDIA)}); @@ -1000,12 +999,12 @@ public class PodDBAdapter { new String[]{String.valueOf(media.getId())}); } - public void removeChaptersOfItem(FeedItem item) { + private void removeChaptersOfItem(FeedItem item) { db.delete(TABLE_NAME_SIMPLECHAPTERS, KEY_FEEDITEM + "=?", new String[]{String.valueOf(item.getId())}); } - public void removeFeedImage(FeedImage image) { + private void removeFeedImage(FeedImage image) { db.delete(TABLE_NAME_FEED_IMAGES, KEY_ID + "=?", new String[]{String.valueOf(image.getId())}); } @@ -1013,7 +1012,7 @@ public class PodDBAdapter { /** * Remove a FeedItem and its FeedMedia entry. */ - public void removeFeedItem(FeedItem item) { + private void removeFeedItem(FeedItem item) { if (item.getMedia() != null) { removeFeedMedia(item.getMedia()); } @@ -1089,7 +1088,7 @@ public class PodDBAdapter { return getAllItemsOfFeedCursor(feed.getId()); } - public final Cursor getAllItemsOfFeedCursor(final long feedId) { + private Cursor getAllItemsOfFeedCursor(final long feedId) { return db.query(TABLE_NAME_FEED_ITEMS, FEEDITEM_SEL_FI_SMALL, KEY_FEED + "=?", new String[]{String.valueOf(feedId)}, null, null, null); @@ -1332,11 +1331,7 @@ public class PodDBAdapter { if (size == 1) { return "(?)"; } - StringBuilder builder = - new StringBuilder("(") - .append(TextUtils.join(",", Collections.nCopies(size, "?"))) - .append(")"); - return builder.toString(); + return "(" + TextUtils.join(",", Collections.nCopies(size, "?")) + ")"; } public final Cursor getFeedCursor(final long id) { @@ -1668,7 +1663,7 @@ public class PodDBAdapter { private static final int VERSION = 1060200; - private Context context; + private final Context context; /** * Constructor. diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java index f67721a6e..77300d864 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/FeedHandlerResult.java @@ -9,8 +9,8 @@ import de.danoeh.antennapod.core.feed.Feed; */ public class FeedHandlerResult { - public Feed feed; - public Map<String, String> alternateFeedUrls; + public final Feed feed; + public final Map<String, String> alternateFeedUrls; public FeedHandlerResult(Feed feed, Map<String, String> alternateFeedUrls) { this.feed = feed; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java index fe9f335b1..1cd05aa26 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/HandlerState.java @@ -20,20 +20,20 @@ public class HandlerState { /** * Feed that the Handler is currently processing. */ - protected Feed feed; + Feed feed; /** * Contains links to related feeds, e.g. feeds with enclosures in other formats. The key of the map is the * URL of the feed, the value is the title */ - protected Map<String, String> alternateUrls; - protected ArrayList<FeedItem> items; - protected FeedItem currentItem; - protected Stack<SyndElement> tagstack; + final Map<String, String> alternateUrls; + private final ArrayList<FeedItem> items; + private FeedItem currentItem; + final Stack<SyndElement> tagstack; /** * Namespaces that have been defined so far. */ - protected Map<String, Namespace> namespaces; - protected Stack<Namespace> defaultNamespaces; + final Map<String, Namespace> namespaces; + final Stack<Namespace> defaultNamespaces; /** * Buffer for saving characters. */ @@ -42,7 +42,7 @@ public class HandlerState { /** * Temporarily saved objects. */ - protected Map<String, Object> tempObjects; + private final Map<String, Object> tempObjects; public HandlerState(Feed feed) { this.feed = feed; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java index c3db59382..ab66b912b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/SyndHandler.java @@ -18,10 +18,10 @@ import de.danoeh.antennapod.core.syndication.namespace.SyndElement; import de.danoeh.antennapod.core.syndication.namespace.atom.NSAtom; /** Superclass for all SAX Handlers which process Syndication formats */ -public class SyndHandler extends DefaultHandler { +class SyndHandler extends DefaultHandler { private static final String TAG = "SyndHandler"; private static final String DEFAULT_PREFIX = ""; - protected HandlerState state; + final HandlerState state; public SyndHandler(Feed feed, TypeGetter.Type type) { state = new HandlerState(feed); diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java index 3da9251d9..606f93faf 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/UnsupportedFeedtypeException.java @@ -4,7 +4,7 @@ import de.danoeh.antennapod.core.syndication.handler.TypeGetter.Type; public class UnsupportedFeedtypeException extends Exception { private static final long serialVersionUID = 9105878964928170669L; - private TypeGetter.Type type; + private final TypeGetter.Type type; private String rootElement; public UnsupportedFeedtypeException(Type type) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSITunes.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSITunes.java index 7d60566b2..670e99fce 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSITunes.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSITunes.java @@ -21,8 +21,8 @@ public class NSITunes extends Namespace { private static final String AUTHOR = "author"; public static final String DURATION = "duration"; - public static final String SUBTITLE = "subtitle"; - public static final String SUMMARY = "summary"; + private static final String SUBTITLE = "subtitle"; + private static final String SUMMARY = "summary"; @Override diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java index 703817a35..45266569a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/NSSimpleChapters.java @@ -17,11 +17,11 @@ public class NSSimpleChapters extends Namespace { public static final String NSTAG = "psc|sc"; public static final String NSURI = "http://podlove.org/simple-chapters"; - public static final String CHAPTERS = "chapters"; - public static final String CHAPTER = "chapter"; - public static final String START = "start"; - public static final String TITLE = "title"; - public static final String HREF = "href"; + private static final String CHAPTERS = "chapters"; + private static final String CHAPTER = "chapter"; + private static final String START = "start"; + private static final String TITLE = "title"; + private static final String HREF = "href"; @Override public SyndElement handleElementStart(String localName, HandlerState state, diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/SyndElement.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/SyndElement.java index 8adcd2086..ba1b8ba5c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/SyndElement.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/SyndElement.java @@ -2,8 +2,8 @@ package de.danoeh.antennapod.core.syndication.namespace; /** Defines a XML Element that is pushed on the tagstack */ public class SyndElement { - protected String name; - protected Namespace namespace; + private final String name; + private final Namespace namespace; public SyndElement(String name, Namespace namespace) { this.name = name; diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java index d4a3edd09..ea1b724d4 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java @@ -8,10 +8,10 @@ import de.danoeh.antennapod.core.syndication.namespace.SyndElement; /** Represents Atom Element which contains text (content, title, summary). */ public class AtomText extends SyndElement { public static final String TYPE_TEXT = "text"; - public static final String TYPE_HTML = "html"; - public static final String TYPE_XHTML = "xhtml"; + private static final String TYPE_HTML = "html"; + private static final String TYPE_XHTML = "xhtml"; - private String type; + private final String type; private String content; public AtomText(String name, Namespace namespace, String type) { 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 cfb20d578..1fe388d9d 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 @@ -64,8 +64,8 @@ public class NSAtom extends Namespace { private static final String isText = TITLE + "|" + CONTENT + "|" + SUBTITLE + "|" + SUMMARY; - public static final String isFeed = FEED + "|" + NSRSS20.CHANNEL; - public static final String isFeedItem = ENTRY + "|" + NSRSS20.ITEM; + private static final String isFeed = FEED + "|" + NSRSS20.CHANNEL; + private static final String isFeedItem = ENTRY + "|" + NSRSS20.ITEM; @Override public SyndElement handleElementStart(String localName, HandlerState state, 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 70a180913..b513fbe99 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 @@ -71,8 +71,8 @@ public final class Converter { int m = rest / MINUTES_MIL; rest -= m * MINUTES_MIL; int s = rest / SECONDS_MIL; - - return String.format("%02d:%02d:%02d", h, m, s); + + return String.format(Locale.getDefault(), "%02d:%02d:%02d", h, m, s); } /** Converts milliseconds to a string containing hours and minutes */ @@ -81,7 +81,7 @@ public final class Converter { int rest = duration - h * HOURS_MIL; int m = rest / MINUTES_MIL; - return String.format("%02d:%02d", h, m); + return String.format(Locale.getDefault(), "%02d:%02d", h, m); } /** Converts long duration string (HH:MM:SS) to milliseconds. */ diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/DuckType.java b/core/src/main/java/de/danoeh/antennapod/core/util/DuckType.java index f432424f8..69dc38895 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/DuckType.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/DuckType.java @@ -92,7 +92,7 @@ public class DuckType { * false otherwise. */ @SuppressWarnings("rawtypes") - public boolean quacksLikeA(Class iface) { + private boolean quacksLikeA(Class iface) { for (Method method : iface.getMethods()) { if (findMethodBySignature(method) == null) { return false; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java b/core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java index 89edd7dbe..fb1b0dc8f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/EpisodeFilter.java @@ -5,7 +5,7 @@ import java.util.List; import de.danoeh.antennapod.core.feed.FeedItem; -public class EpisodeFilter { +class EpisodeFilter { private EpisodeFilter() { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/FeedtitleComparator.java b/core/src/main/java/de/danoeh/antennapod/core/util/FeedtitleComparator.java index cc5b0f18f..29d095cd2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/FeedtitleComparator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/FeedtitleComparator.java @@ -5,7 +5,7 @@ import java.util.Comparator; import de.danoeh.antennapod.core.feed.Feed; /** Compares the title of two feeds for sorting. */ -public class FeedtitleComparator implements Comparator<Feed> { +class FeedtitleComparator implements Comparator<Feed> { @Override public int compare(Feed lhs, Feed rhs) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/IntList.java b/core/src/main/java/de/danoeh/antennapod/core/util/IntList.java index f48b9169b..1da5417c1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/IntList.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/IntList.java @@ -8,7 +8,7 @@ import java.util.Arrays; public final class IntList { private int[] values; - protected int size; + private int size; /** * Constructs an empty instance with a default initial capacity. @@ -22,7 +22,7 @@ public final class IntList { * * @param initialCapacity {@code >= 0;} initial capacity of the list */ - public IntList(int initialCapacity) { + private IntList(int initialCapacity) { if(initialCapacity < 0) { throw new IllegalArgumentException("initial capacity must be 0 or higher"); } @@ -200,7 +200,7 @@ public final class IntList { * @param value value to find * @return index of value or -1 */ - public int indexOf(int value) { + private int indexOf(int value) { for (int i = 0; i < size; i++) { if (values[i] == value) { return i; 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 287ec4d0c..7ec7f84c4 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 @@ -7,7 +7,7 @@ import java.nio.charset.Charset; public class LangUtils { public static final Charset UTF_8 = Charset.forName("UTF-8"); - private static ArrayMap<String, String> languages; + private static final ArrayMap<String, String> languages; static { languages = new ArrayMap<>(); languages.put("af", "Afrikaans"); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/LongIntMap.java b/core/src/main/java/de/danoeh/antennapod/core/util/LongIntMap.java index c5ac44bf5..78ed002ac 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/LongIntMap.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/LongIntMap.java @@ -88,7 +88,7 @@ public class LongIntMap { /** * Removes the mapping at the given index. */ - public void removeAt(int index) { + private void removeAt(int index) { System.arraycopy(keys, index + 1, keys, index, size - (index + 1)); System.arraycopy(values, index + 1, values, index, size - (index + 1)); size--; @@ -130,7 +130,7 @@ public class LongIntMap { * smallest key and <code>keyAt(size()-1)</code> will return the largest * key.</p> */ - public long keyAt(int index) { + private long keyAt(int index) { if (index >= size) { throw new IndexOutOfBoundsException("n >= size()"); } else if(index < 0) { @@ -150,7 +150,7 @@ public class LongIntMap { * smallest key and <code>valueAt(size()-1)</code> will return the value * associated with the largest key.</p> */ - public int valueAt(int index) { + private int valueAt(int index) { if (index >= size) { throw new IndexOutOfBoundsException("n >= size()"); } else if(index < 0) { 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 e6ff3a981..cbda583fa 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 @@ -54,7 +54,7 @@ public class NetworkUtils { Log.d(TAG, "Auto-dl filter is disabled"); return true; } else { - WifiManager wm = (WifiManager) context + WifiManager wm = (WifiManager) context.getApplicationContext() .getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wm.getConnectionInfo(); List<String> selectedNetworks = Arrays @@ -93,7 +93,7 @@ public class NetworkUtils { return UserPreferences.isAllowMobileUpdate() || !NetworkUtils.isNetworkMetered(); } - public static boolean isNetworkMetered() { + private static boolean isNetworkMetered() { ConnectivityManager connManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); return ConnectivityManagerCompat.isActiveNetworkMetered(connManager); @@ -103,7 +103,7 @@ public class NetworkUtils { * Returns the SSID of the wifi connection, or <code>null</code> if there is no wifi. */ public static String getWifiSsid() { - WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); if (wifiInfo != null) { return wifiInfo.getSSID(); @@ -112,63 +112,60 @@ public class NetworkUtils { } public static Observable<Long> getFeedMediaSizeObservable(FeedMedia media) { - return Observable.create(new Observable.OnSubscribe<Long>() { - @Override - public void call(Subscriber<? super Long> subscriber) { - if (!NetworkUtils.isDownloadAllowed()) { + return Observable.create((Observable.OnSubscribe<Long>) subscriber -> { + if (!NetworkUtils.isDownloadAllowed()) { + subscriber.onNext(0L); + subscriber.onCompleted(); + return; + } + long size = Integer.MIN_VALUE; + if (media.isDownloaded()) { + File mediaFile = new File(media.getLocalMediaUrl()); + if (mediaFile.exists()) { + size = mediaFile.length(); + } + } else if (!media.checkedOnSizeButUnknown()) { + // only query the network if we haven't already checked + + String url = media.getDownload_url(); + if(TextUtils.isEmpty(url)) { subscriber.onNext(0L); subscriber.onCompleted(); return; } - long size = Integer.MIN_VALUE; - if (media.isDownloaded()) { - File mediaFile = new File(media.getLocalMediaUrl()); - if (mediaFile.exists()) { - size = mediaFile.length(); - } - } else if (!media.checkedOnSizeButUnknown()) { - // only query the network if we haven't already checked - - String url = media.getDownload_url(); - if(TextUtils.isEmpty(url)) { - subscriber.onNext(0L); - subscriber.onCompleted(); - return; - } - OkHttpClient client = AntennapodHttpClient.getHttpClient(); - Request.Builder httpReq = new Request.Builder() - .url(url) - .header("Accept-Encoding", "identity") - .head(); - try { - Response response = client.newCall(httpReq.build()).execute(); - if (response.isSuccessful()) { - String contentLength = response.header("Content-Length"); - try { - size = Integer.parseInt(contentLength); - } catch (NumberFormatException e) { - Log.e(TAG, Log.getStackTraceString(e)); - } + OkHttpClient client = AntennapodHttpClient.getHttpClient(); + Request.Builder httpReq = new Request.Builder() + .url(url) + .header("Accept-Encoding", "identity") + .head(); + try { + Response response = client.newCall(httpReq.build()).execute(); + if (response.isSuccessful()) { + String contentLength = response.header("Content-Length"); + try { + size = Integer.parseInt(contentLength); + } catch (NumberFormatException e) { + Log.e(TAG, Log.getStackTraceString(e)); } - } catch (IOException e) { - subscriber.onNext(0L); - subscriber.onCompleted(); - Log.e(TAG, Log.getStackTraceString(e)); - return; // better luck next time } + } catch (IOException e) { + subscriber.onNext(0L); + subscriber.onCompleted(); + Log.e(TAG, Log.getStackTraceString(e)); + return; // better luck next time } - Log.d(TAG, "new size: " + size); - if (size <= 0) { - // they didn't tell us the size, but we don't want to keep querying on it - media.setCheckedOnSizeButUnknown(); - } else { - media.setSize(size); - } - subscriber.onNext(size); - subscriber.onCompleted(); - DBWriter.setFeedMedia(media); } + Log.d(TAG, "new size: " + size); + if (size <= 0) { + // they didn't tell us the size, but we don't want to keep querying on it + media.setCheckedOnSizeButUnknown(); + } else { + media.setSize(size); + } + subscriber.onNext(size); + subscriber.onCompleted(); + DBWriter.setFeedMedia(media); }) .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread()); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/exception/MediaFileNotFoundException.java b/core/src/main/java/de/danoeh/antennapod/core/util/exception/MediaFileNotFoundException.java index 287fe1100..ecb641dad 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/exception/MediaFileNotFoundException.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/exception/MediaFileNotFoundException.java @@ -5,7 +5,7 @@ import de.danoeh.antennapod.core.feed.FeedMedia; public class MediaFileNotFoundException extends Exception { private static final long serialVersionUID = 1L; - private FeedMedia media; + private final FeedMedia media; public MediaFileNotFoundException(String msg, FeedMedia media) { super(msg); 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 c6150b0fd..45cb56988 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 @@ -10,8 +10,8 @@ import de.danoeh.antennapod.core.BuildConfig; /** Ensures that only one instance of the FlattrService class exists at a time */ -public class FlattrServiceCreator { - public static final String TAG = "FlattrServiceCreator"; +class FlattrServiceCreator { + private static final String TAG = "FlattrServiceCreator"; private static volatile FlattrService flattrService; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrStatus.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrStatus.java index d82171d1a..40a9fc7d5 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrStatus.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrStatus.java @@ -3,9 +3,9 @@ package de.danoeh.antennapod.core.util.flattr; import java.util.Calendar; public class FlattrStatus { - public static final int STATUS_UNFLATTERED = 0; + private static final int STATUS_UNFLATTERED = 0; public static final int STATUS_QUEUE = 1; - public static final int STATUS_FLATTRED = 2; + private static final int STATUS_FLATTRED = 2; private int status = STATUS_UNFLATTERED; private Calendar lastFlattred; @@ -38,7 +38,7 @@ public class FlattrStatus { status = STATUS_QUEUE; } - public void fromLong(long status) { + private void fromLong(long status) { if (status == STATUS_UNFLATTERED || status == STATUS_QUEUE) this.status = (int) status; else { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrThing.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrThing.java index 515028ab6..d5bb88771 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrThing.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrThing.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.core.util.flattr; public interface FlattrThing { - public String getTitle(); - public String getPaymentLink(); - public FlattrStatus getFlattrStatus(); + String getTitle(); + String getPaymentLink(); + FlattrStatus getFlattrStatus(); } 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 6ddfb0366..313d1c2f2 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 @@ -99,7 +99,7 @@ public class FlattrUtils { cachedToken = token; } - public static void deleteToken() { + private static void deleteToken() { Log.d(TAG, "Deleting flattr token"); storeToken(null); } @@ -116,7 +116,7 @@ public class FlattrUtils { public static List<Flattr> retrieveFlattredThings() throws FlattrException { - ArrayList<Flattr> myFlattrs = new ArrayList<Flattr>(); + ArrayList<Flattr> myFlattrs = new ArrayList<>(); if (hasToken()) { FlattrService fs = FlattrServiceCreator.getService(retrieveToken()); @@ -172,17 +172,11 @@ public class FlattrUtils { // ------------------------------------------------ DIALOGS - public static void showRevokeDialog(final Context context) { + private static void showRevokeDialog(final Context context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.access_revoked_title); builder.setMessage(R.string.access_revoked_info); - builder.setNeutralButton(android.R.string.ok, new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.cancel(); - } - }); + builder.setNeutralButton(android.R.string.ok, (dialog, which) -> dialog.cancel()); builder.create().show(); } @@ -197,27 +191,15 @@ public class FlattrUtils { builder.setTitle(R.string.no_flattr_token_title); builder.setMessage(R.string.no_flattr_token_msg); builder.setPositiveButton(R.string.authenticate_now_label, - new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - context.startActivity( - ClientConfig.flattrCallbacks.getFlattrAuthenticationActivityIntent(context)); - } - - } + (dialog, which) -> context.startActivity( + ClientConfig.flattrCallbacks.getFlattrAuthenticationActivityIntent(context)) ); builder.setNegativeButton(R.string.visit_website_label, - new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - Uri uri = Uri.parse(url); - context.startActivity(new Intent(Intent.ACTION_VIEW, - uri)); - } - + (dialog, which) -> { + Uri uri = Uri.parse(url); + context.startActivity(new Intent(Intent.ACTION_VIEW, + uri)); } ); builder.create().show(); @@ -231,13 +213,7 @@ public class FlattrUtils { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.error_label); builder.setMessage(msg); - builder.setNeutralButton(android.R.string.ok, new OnClickListener() { - - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.cancel(); - } - }); + builder.setNeutralButton(android.R.string.ok, (dialog, which) -> dialog.cancel()); builder.create().show(); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/SimpleFlattrThing.java b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/SimpleFlattrThing.java index 2c178496e..43cd5f170 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/flattr/SimpleFlattrThing.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/flattr/SimpleFlattrThing.java @@ -24,7 +24,7 @@ public class SimpleFlattrThing implements FlattrThing { return this.status; } - private String title; - private String url; - private FlattrStatus status; + private final String title; + private final String url; + private final FlattrStatus status; } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ID3Reader.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ID3Reader.java index 5a2b6f37f..7290b9d98 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ID3Reader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/ID3Reader.java @@ -19,10 +19,10 @@ public class ID3Reader { private static final int ID3_LENGTH = 3; private static final int FRAME_ID_LENGTH = 4; - protected static final int ACTION_SKIP = 1; - protected static final int ACTION_DONT_SKIP = 2; + private static final int ACTION_SKIP = 1; + static final int ACTION_DONT_SKIP = 2; - protected int readerPosition; + private int readerPosition; private static final byte ENCODING_UTF16_WITH_BOM = 1; private static final byte ENCODING_UTF16_WITHOUT_BOM = 2; @@ -30,7 +30,7 @@ public class ID3Reader { private TagHeader tagHeader; - public ID3Reader() { + ID3Reader() { } public final void readInputStream(InputStream input) throws IOException, @@ -92,7 +92,7 @@ public class ID3Reader { * Read a certain number of bytes from the given input stream. This method * changes the readerPosition-attribute. */ - protected char[] readBytes(InputStream input, int number) + char[] readBytes(InputStream input, int number) throws IOException, ID3ReaderException { char[] header = new char[number]; for (int i = 0; i < number; i++) { @@ -111,7 +111,7 @@ public class ID3Reader { * Skip a certain number of bytes on the given input stream. This method * changes the readerPosition-attribute. */ - protected void skipBytes(InputStream input, int number) throws IOException { + void skipBytes(InputStream input, int number) throws IOException { if (number <= 0) { number = 1; } @@ -193,7 +193,6 @@ public class ID3Reader { protected int readISOString(StringBuilder buffer, InputStream input, int max) throws IOException, ID3ReaderException { - int bytesRead = 0; char c; while (++bytesRead <= max && (c = (char) input.read()) > 0) { @@ -231,20 +230,20 @@ public class ID3Reader { return i; } - public int onStartTagHeader(TagHeader header) { + int onStartTagHeader(TagHeader header) { return ACTION_SKIP; } - public int onStartFrameHeader(FrameHeader header, InputStream input) + int onStartFrameHeader(FrameHeader header, InputStream input) throws IOException, ID3ReaderException { return ACTION_SKIP; } - public void onEndTag() { + void onEndTag() { } - public void onNoTagHeaderFound() { + void onNoTagHeaderFound() { } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/FrameHeader.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/FrameHeader.java index 89eab1398..2f3f378ab 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/FrameHeader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/FrameHeader.java @@ -2,7 +2,7 @@ package de.danoeh.antennapod.core.util.id3reader.model; public class FrameHeader extends Header { - protected char flags; + private final char flags; public FrameHeader(String id, int size, char flags) { super(id, size); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/Header.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/Header.java index 346e2893f..29185748f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/Header.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/Header.java @@ -2,10 +2,10 @@ package de.danoeh.antennapod.core.util.id3reader.model; public abstract class Header { - protected String id; - protected int size; + final String id; + final int size; - public Header(String id, int size) { + Header(String id, int size) { super(); this.id = id; this.size = size; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/TagHeader.java b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/TagHeader.java index 0a6b8357f..b652a139c 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/TagHeader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/id3reader/model/TagHeader.java @@ -2,8 +2,8 @@ package de.danoeh.antennapod.core.util.id3reader.model; public class TagHeader extends Header { - protected char version; - protected byte flags; + private final char version; + private final byte flags; public TagHeader(String id, int size, char version, byte flags) { super(id, size); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/ExternalMedia.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/ExternalMedia.java index c4acdb65e..645bae5f3 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/ExternalMedia.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/ExternalMedia.java @@ -23,7 +23,7 @@ public class ExternalMedia implements Playable { public static final String PREF_MEDIA_TYPE = "ExternalMedia.PrefMediaType"; public static final String PREF_LAST_PLAYED_TIME = "ExternalMedia.PrefLastPlayedTime"; - private String source; + private final String source; private String episodeTitle; private String feedTitle; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/IPlayer.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/IPlayer.java index d67153a4e..aba395ec1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/IPlayer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/IPlayer.java @@ -45,7 +45,7 @@ public interface IPlayer { void setScreenOnWhilePlaying(boolean screenOn); void setDataSource(String path) throws IllegalStateException, IOException, - IllegalArgumentException, SecurityException; + IllegalArgumentException, SecurityException; void setDisplay(SurfaceHolder sh); @@ -67,7 +67,7 @@ public interface IPlayer { void stop(); - public void setVideoScalingMode(int mode); + void setVideoScalingMode(int mode); - public void setWakeMode(Context context, int mode); + void setWakeMode(Context context, int mode); } 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 9d3854f41..a160b4f0a 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 @@ -87,13 +87,7 @@ public abstract class PlaybackController { Thread t = new Thread(r); t.setPriority(Thread.MIN_PRIORITY); return t; - }, new RejectedExecutionHandler() { - @Override - public void rejectedExecution(Runnable r, - ThreadPoolExecutor executor) { - Log.w(TAG, "Rejected execution of runnable in schedExecutor"); - } - } + }, (r, executor) -> Log.w(TAG, "Rejected execution of runnable in schedExecutor") ); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java index efdf46a97..34cfe6d05 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/playback/Timeline.java @@ -14,6 +14,7 @@ import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; +import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -42,22 +43,22 @@ public class Timeline { private final int pageMargin; public Timeline(Context context, ShownotesProvider shownotesProvider) { - if (shownotesProvider == null) throw new IllegalArgumentException("shownotesProvider = null"); + if (shownotesProvider == null) { + throw new IllegalArgumentException("shownotesProvider = null"); + } this.shownotesProvider = shownotesProvider; noShownotesLabel = context.getString(R.string.no_shownotes_label); - TypedArray res = context.getTheme().obtainStyledAttributes( - new int[]{ android.R.attr.textColorPrimary}); + TypedArray res = context.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorPrimary}); @ColorInt int col = res.getColor(0, 0); colorPrimaryString = "rgba(" + Color.red(col) + "," + Color.green(col) + "," + - Color.blue(col) + "," + (Color.alpha(col)/256.0) + ")"; + Color.blue(col) + "," + (Color.alpha(col) / 255.0) + ")"; res.recycle(); - res = context.getTheme().obtainStyledAttributes( - new int[]{android.R.attr.textColorSecondary}); + res = context.getTheme().obtainStyledAttributes(new int[]{android.R.attr.textColorSecondary}); col = res.getColor(0, 0); colorSecondaryString = "rgba(" + Color.red(col) + "," + Color.green(col) + "," + - Color.blue(col) + "," + (Color.alpha(col)/256.0) + ")"; + Color.blue(col) + "," + (Color.alpha(col) / 255.0) + ")"; res.recycle(); pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, @@ -93,9 +94,9 @@ public class Timeline { return null; } - if(TextUtils.isEmpty(shownotes)) { + if (TextUtils.isEmpty(shownotes)) { Log.d(TAG, "shownotesProvider contained no shownotes. Returning 'no shownotes' message"); - shownotes ="<html>" + + shownotes = "<html>" + "<head>" + "<style type='text/css'>" + "html, body { margin: 0; padding: 0; width: 100%; height: 100%; } " + @@ -113,15 +114,15 @@ public class Timeline { } // replace ASCII line breaks with HTML ones if shownotes don't contain HTML line breaks already - if(!LINE_BREAK_REGEX.matcher(shownotes).find() && !shownotes.contains("<p>")) { + if (!LINE_BREAK_REGEX.matcher(shownotes).find() && !shownotes.contains("<p>")) { shownotes = shownotes.replace("\n", "<br />"); } Document document = Jsoup.parse(shownotes); // apply style - String styleStr = String.format(WEBVIEW_STYLE, colorPrimaryString, "100%", pageMargin, - pageMargin, pageMargin, pageMargin); + String styleStr = String.format(Locale.getDefault(), WEBVIEW_STYLE, colorPrimaryString, "100%", + pageMargin, pageMargin, pageMargin, pageMargin); document.head().appendElement("style").attr("type", "text/css").text(styleStr); // apply timecode links @@ -139,7 +140,7 @@ public class Timeline { String rep; if (playable == null || playable.getDuration() > time) { - rep = String.format(TIMECODE_LINK, time, group); + rep = String.format(Locale.getDefault(), TIMECODE_LINK, time, group); } else { rep = group; } @@ -150,7 +151,7 @@ public class Timeline { element.html(buffer.toString()); } } - + return document.toString(); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/syndication/FeedDiscoverer.java b/core/src/main/java/de/danoeh/antennapod/core/util/syndication/FeedDiscoverer.java index 13cb9f002..c5ad9cfd6 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/syndication/FeedDiscoverer.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/syndication/FeedDiscoverer.java @@ -41,7 +41,7 @@ public class FeedDiscoverer { * @return A map which contains the feed URLs as keys and titles as values (the feed URL is also used as a title if * a title cannot be found). */ - public Map<String, String> findLinks(String in, String baseUrl) throws IOException { + public Map<String, String> findLinks(String in, String baseUrl) { return findLinks(Jsoup.parse(in), baseUrl); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/syndication/HtmlToPlainText.java b/core/src/main/java/de/danoeh/antennapod/core/util/syndication/HtmlToPlainText.java index c497bfb4f..cc6a8ec90 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/syndication/HtmlToPlainText.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/syndication/HtmlToPlainText.java @@ -42,7 +42,7 @@ public class HtmlToPlainText { // the formatting rules, implemented in a breadth-first DOM traverse private static class FormattingVisitor implements NodeVisitor { - private StringBuilder accum = new StringBuilder(); // holds the accumulated text + private final StringBuilder accum = new StringBuilder(); // holds the accumulated text // hit when the node is first seen public void head(Node node, int depth) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/OggInputStream.java b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/OggInputStream.java index 4799d3881..cdf171299 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/OggInputStream.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/OggInputStream.java @@ -6,8 +6,8 @@ import java.io.IOException; import java.io.InputStream; import java.util.Arrays; -public class OggInputStream extends InputStream { - private InputStream input; +class OggInputStream extends InputStream { + private final InputStream input; /** True if OggInputStream is currently inside an Ogg page. */ private boolean isInPage; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentHeader.java b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentHeader.java index 5f9dd0faf..ff7508390 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentHeader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentHeader.java @@ -1,7 +1,7 @@ package de.danoeh.antennapod.core.util.vorbiscommentreader; -public class VorbisCommentHeader { - private String vendorString; - private long userCommentLength; +class VorbisCommentHeader { + private final String vendorString; + private final long userCommentLength; public VorbisCommentHeader(String vendorString, long userCommentLength) { super(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentReader.java b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentReader.java index 49ea18721..55498afcb 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/vorbiscommentreader/VorbisCommentReader.java @@ -19,29 +19,29 @@ public abstract class VorbisCommentReader { private static final int PACKET_TYPE_COMMENT = 3; /** Called when Reader finds identification header. */ - public abstract void onVorbisCommentFound(); + protected abstract void onVorbisCommentFound(); - public abstract void onVorbisCommentHeaderFound(VorbisCommentHeader header); + protected abstract void onVorbisCommentHeaderFound(VorbisCommentHeader header); /** * Is called every time the Reader finds a content vector. The handler * should return true if it wants to handle the content vector. */ - public abstract boolean onContentVectorKey(String content); + protected abstract boolean onContentVectorKey(String content); /** * Is called if onContentVectorKey returned true for the key. * * @throws VorbisCommentReaderException */ - public abstract void onContentVectorValue(String key, String value) + protected abstract void onContentVectorValue(String key, String value) throws VorbisCommentReaderException; - public abstract void onNoVorbisCommentFound(); + protected abstract void onNoVorbisCommentFound(); - public abstract void onEndOfComment(); + protected abstract void onEndOfComment(); - public abstract void onError(VorbisCommentReaderException exception); + protected abstract void onError(VorbisCommentReaderException exception); public void readInputStream(InputStream input) throws VorbisCommentReaderException { diff --git a/core/src/main/res/drawable-hdpi-v11/ic_stat_antenna_default.png b/core/src/main/res/drawable-hdpi-v11/ic_stat_antenna_default.png Binary files differdeleted file mode 100644 index af99f4b3b..000000000 --- a/core/src/main/res/drawable-hdpi-v11/ic_stat_antenna_default.png +++ /dev/null diff --git a/core/src/main/res/drawable-hdpi-v11/ic_stat_authentication.png b/core/src/main/res/drawable-hdpi-v11/ic_stat_authentication.png Binary files differdeleted file mode 100755 index 398dffa4b..000000000 --- a/core/src/main/res/drawable-hdpi-v11/ic_stat_authentication.png +++ /dev/null diff --git a/core/src/main/res/drawable-hdpi/ic_stat_antenna_default.png b/core/src/main/res/drawable-hdpi/ic_stat_antenna_default.png Binary files differindex fb15f7ee1..af99f4b3b 100644 --- a/core/src/main/res/drawable-hdpi/ic_stat_antenna_default.png +++ b/core/src/main/res/drawable-hdpi/ic_stat_antenna_default.png diff --git a/core/src/main/res/drawable-hdpi/ic_stat_authentication.png b/core/src/main/res/drawable-hdpi/ic_stat_authentication.png Binary files differindex f40820ef7..398dffa4b 100755..100644 --- a/core/src/main/res/drawable-hdpi/ic_stat_authentication.png +++ b/core/src/main/res/drawable-hdpi/ic_stat_authentication.png diff --git a/core/src/main/res/drawable-ldpi-v11/ic_stat_antenna_default.png b/core/src/main/res/drawable-ldpi-v11/ic_stat_antenna_default.png Binary files differdeleted file mode 100644 index ddf545c0b..000000000 --- a/core/src/main/res/drawable-ldpi-v11/ic_stat_antenna_default.png +++ /dev/null diff --git a/core/src/main/res/drawable-ldpi/ic_stat_antenna_default.png b/core/src/main/res/drawable-ldpi/ic_stat_antenna_default.png Binary files differindex 501dfa848..ddf545c0b 100644 --- a/core/src/main/res/drawable-ldpi/ic_stat_antenna_default.png +++ b/core/src/main/res/drawable-ldpi/ic_stat_antenna_default.png diff --git a/core/src/main/res/drawable-mdpi-v11/ic_stat_antenna_default.png b/core/src/main/res/drawable-mdpi-v11/ic_stat_antenna_default.png Binary files differdeleted file mode 100644 index 41fd20655..000000000 --- a/core/src/main/res/drawable-mdpi-v11/ic_stat_antenna_default.png +++ /dev/null diff --git a/core/src/main/res/drawable-mdpi-v11/ic_stat_authentication.png b/core/src/main/res/drawable-mdpi-v11/ic_stat_authentication.png Binary files differdeleted file mode 100755 index 550b56b33..000000000 --- a/core/src/main/res/drawable-mdpi-v11/ic_stat_authentication.png +++ /dev/null diff --git a/core/src/main/res/drawable-mdpi/ic_stat_antenna_default.png b/core/src/main/res/drawable-mdpi/ic_stat_antenna_default.png Binary files differindex 152239888..41fd20655 100644 --- a/core/src/main/res/drawable-mdpi/ic_stat_antenna_default.png +++ b/core/src/main/res/drawable-mdpi/ic_stat_antenna_default.png diff --git a/core/src/main/res/drawable-mdpi/ic_stat_authentication.png b/core/src/main/res/drawable-mdpi/ic_stat_authentication.png Binary files differindex 7fab11a83..550b56b33 100755..100644 --- a/core/src/main/res/drawable-mdpi/ic_stat_authentication.png +++ b/core/src/main/res/drawable-mdpi/ic_stat_authentication.png diff --git a/core/src/main/res/drawable-xhdpi-v11/ic_stat_antenna_default.png b/core/src/main/res/drawable-xhdpi-v11/ic_stat_antenna_default.png Binary files differdeleted file mode 100644 index 30431ed6a..000000000 --- a/core/src/main/res/drawable-xhdpi-v11/ic_stat_antenna_default.png +++ /dev/null diff --git a/core/src/main/res/drawable-xhdpi-v11/ic_stat_authentication.png b/core/src/main/res/drawable-xhdpi-v11/ic_stat_authentication.png Binary files differdeleted file mode 100755 index e83cbc333..000000000 --- a/core/src/main/res/drawable-xhdpi-v11/ic_stat_authentication.png +++ /dev/null diff --git a/core/src/main/res/drawable-xhdpi/ic_stat_antenna_default.png b/core/src/main/res/drawable-xhdpi/ic_stat_antenna_default.png Binary files differindex 3d8a046a8..30431ed6a 100644 --- a/core/src/main/res/drawable-xhdpi/ic_stat_antenna_default.png +++ b/core/src/main/res/drawable-xhdpi/ic_stat_antenna_default.png diff --git a/core/src/main/res/drawable-xhdpi/ic_stat_authentication.png b/core/src/main/res/drawable-xhdpi/ic_stat_authentication.png Binary files differindex 200b60c96..e83cbc333 100755..100644 --- a/core/src/main/res/drawable-xhdpi/ic_stat_authentication.png +++ b/core/src/main/res/drawable-xhdpi/ic_stat_authentication.png diff --git a/core/src/main/res/values-v11/colors.xml b/core/src/main/res/values-v11/colors.xml deleted file mode 100644 index 520efaa06..000000000 --- a/core/src/main/res/values-v11/colors.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <color name="selection_background_color_dark">#286E8A</color> - <color name="selection_background_color_light">#81CFEA</color> -</resources>
\ No newline at end of file diff --git a/core/src/main/res/values-v14/dimens.xml b/core/src/main/res/values-v14/dimens.xml deleted file mode 100644 index 090a476a8..000000000 --- a/core/src/main/res/values-v14/dimens.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <dimen name="widget_margin">0dp</dimen> - -</resources>
\ No newline at end of file diff --git a/core/src/main/res/values-v14/styles.xml b/core/src/main/res/values-v14/styles.xml deleted file mode 100644 index 6a39d6175..000000000 --- a/core/src/main/res/values-v14/styles.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <style name="AntennaPod.TextView.UnreadIndicator" parent="@android:style/TextAppearance.Small"> - <item name="android:textSize">@dimen/text_size_micro</item> - <item name="android:textColor">@color/new_indicator_green</item> - <item name="android:text">@string/new_label</item> - <item name="android:textAllCaps">true</item> - </style> -</resources>
\ No newline at end of file diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml index a570a3fcb..981d16d03 100644 --- a/core/src/main/res/values/colors.xml +++ b/core/src/main/res/values/colors.xml @@ -21,9 +21,8 @@ <color name="new_indicator_green">#669900</color> <color name="image_readability_tint">#80000000</color> - <!-- Use Gingerbread-orange --> - <color name="selection_background_color_dark">#FEBB20</color> - <color name="selection_background_color_light">#FEBB20</color> + <color name="selection_background_color_dark">#286E8A</color> + <color name="selection_background_color_light">#81CFEA</color> <!-- Theme colors --> <color name="primary_light">#FFFFFF</color> diff --git a/core/src/main/res/values/dimens.xml b/core/src/main/res/values/dimens.xml index a9a3aa8d9..46da1d68e 100644 --- a/core/src/main/res/values/dimens.xml +++ b/core/src/main/res/values/dimens.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <dimen name="widget_margin">8dp</dimen> + <dimen name="widget_margin">0dp</dimen> <dimen name="thumbnail_length">70dp</dimen> <dimen name="external_player_height">56dp</dimen> <dimen name="enc_icons_size">20dp</dimen> diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index a88d8c3a8..b9a9fb293 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -299,6 +299,7 @@ <item name="android:textSize">@dimen/text_size_micro</item> <item name="android:textColor">@color/new_indicator_green</item> <item name="android:text">@string/new_label</item> + <item name="android:textAllCaps">true</item> </style> <style name="Widget.AntennaPod.Button" parent="Widget.AppCompat.Button"> |