diff options
13 files changed, 52 insertions, 22 deletions
diff --git a/app/build.gradle b/app/build.gradle index cd3fb7aa1..f246d2a2c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -164,3 +164,11 @@ task copyTextFiles(type: Copy) { } preBuild.dependsOn filterAbout, copyTextFiles + +allprojects { + gradle.projectsEvaluated { + tasks.withType(JavaCompile) { + options.compilerArgs << "-Xlint" << "-Xlint:-deprecation" << "-Xlint:-serial" + } + } +} diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/CoverTarget.java b/app/src/main/java/de/danoeh/antennapod/adapter/CoverTarget.java index 40cd5a903..538af8c79 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/CoverTarget.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/CoverTarget.java @@ -48,7 +48,7 @@ class CoverTarget extends GlideDrawableImageViewTarget { } @Override - public void onResourceReady(GlideDrawable drawable, GlideAnimation anim) { + public void onResourceReady(GlideDrawable drawable, GlideAnimation<? super GlideDrawable> anim) { super.onResourceReady(drawable, anim); TextView txtvPlaceholder = placeholder.get(); if (txtvPlaceholder != null) { diff --git a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java index 6c03dc7ae..183ef338a 100644 --- a/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java +++ b/app/src/main/java/de/danoeh/antennapod/preferences/PreferenceController.java @@ -127,7 +127,7 @@ public class PreferenceController implements SharedPreferences.OnSharedPreferenc * * @return PreferenceActivity if the API level is greater than 10, PreferenceActivityGingerbread otherwise. */ - public static Class getPreferenceActivity() { + public static Class<? extends Activity> getPreferenceActivity() { if (Build.VERSION.SDK_INT > 10) { return PreferenceActivity.class; } else { diff --git a/core/build.gradle b/core/build.gradle index 5264e435b..31042456b 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -63,3 +63,11 @@ dependencies { compile "com.android.support:mediarouter-v7:$supportVersion" compile "com.google.android.gms:play-services-cast:$playServicesVersion" } + +allprojects { + gradle.projectsEvaluated { + tasks.withType(JavaCompile) { + options.compilerArgs << "-Xlint" << "-Xlint:-deprecation" << "-Xlint:-serial" + } + } +} 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 3ddaba52e..d991006e5 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 @@ -106,7 +106,7 @@ public class FlattrClickWorker extends AsyncTask<Void, Integer, FlattrClickWorke return ExitCode.NO_THINGS; } - List<Future> dbFutures = new LinkedList<>(); + List<Future<?>> dbFutures = new LinkedList<>(); for (FlattrThing thing : flattrQueue) { if (BuildConfig.DEBUG) Log.d(TAG, "Processing " + thing.getTitle()); @@ -131,7 +131,7 @@ public class FlattrClickWorker extends AsyncTask<Void, Integer, FlattrClickWorke } } - for (Future f : dbFutures) { + for (Future<?> f : dbFutures) { try { f.get(); } catch (InterruptedException | ExecutionException e) { diff --git a/core/src/main/java/de/danoeh/antennapod/core/cast/RemoteMedia.java b/core/src/main/java/de/danoeh/antennapod/core/cast/RemoteMedia.java index a5301db17..e2d8f8ad5 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/cast/RemoteMedia.java +++ b/core/src/main/java/de/danoeh/antennapod/core/cast/RemoteMedia.java @@ -25,6 +25,8 @@ import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.util.ChapterUtils; import de.danoeh.antennapod.core.util.playback.Playable; +import org.apache.commons.lang3.builder.HashCodeBuilder; + /** * Playable implementation for media on a Cast Device for which a local version of * {@link de.danoeh.antennapod.core.feed.FeedMedia} hasn't been found. @@ -343,4 +345,13 @@ public class RemoteMedia implements Playable { } return false; } + + @Override + public int hashCode() { + return new HashCodeBuilder() + .append(downloadUrl) + .append(feedUrl) + .append(itemIdentifier) + .toHashCode(); + } } 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 9704d2111..160ba487b 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 @@ -232,7 +232,7 @@ public class GpodnetSyncService extends Service { } Map<Pair<String, String>, GpodnetEpisodeAction> localMostRecentPlayAction = new ArrayMap<>(); for(GpodnetEpisodeAction action : localActions) { - Pair key = new Pair(action.getPodcast(), action.getEpisode()); + Pair<String, String> key = new Pair<>(action.getPodcast(), action.getEpisode()); GpodnetEpisodeAction mostRecent = localMostRecentPlayAction.get(key); if (mostRecent == null || mostRecent.getTimestamp() == null) { localMostRecentPlayAction.put(key, action); @@ -256,7 +256,7 @@ public class GpodnetSyncService extends Service { case DOWNLOAD: break; case PLAY: - Pair key = new Pair(action.getPodcast(), action.getEpisode()); + Pair<String, String> key = new Pair<>(action.getPodcast(), action.getEpisode()); GpodnetEpisodeAction localMostRecent = localMostRecentPlayAction.get(key); if(localMostRecent == null || localMostRecent.getTimestamp() == null || 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 06a89ca64..f773cdf2a 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 @@ -145,7 +145,7 @@ public class DownloadService extends Service { private Handler handler; private NotificationUpdater notificationUpdater; - private ScheduledFuture notificationUpdaterFuture; + private ScheduledFuture<?> notificationUpdaterFuture; private static final int SCHED_EX_POOL_SIZE = 1; private ScheduledThreadPoolExecutor schedExecutor; 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 8a0964d36..7fd7602a8 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 @@ -42,11 +42,11 @@ public class PlaybackServiceTaskManager { private static final int SCHED_EX_POOL_SIZE = 2; private final ScheduledThreadPoolExecutor schedExecutor; - private ScheduledFuture positionSaverFuture; - private ScheduledFuture widgetUpdaterFuture; - private ScheduledFuture sleepTimerFuture; + private ScheduledFuture<?> positionSaverFuture; + private ScheduledFuture<?> widgetUpdaterFuture; + private ScheduledFuture<?> sleepTimerFuture; private volatile Future<List<FeedItem>> queueFuture; - private volatile Future chapterLoaderFuture; + private volatile Future<?> chapterLoaderFuture; private SleepTimer sleepTimer; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java index d7c9e9108..b88d774a2 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/FeedSearcher.java @@ -33,15 +33,18 @@ public class FeedSearcher { List<SearchResult> result = new ArrayList<>(); - FutureTask<List<FeedItem>>[] tasks = new FutureTask[4]; - (tasks[0] = DBTasks.searchFeedItemContentEncoded(context, selectedFeed, query)).run(); - (tasks[1] = DBTasks.searchFeedItemDescription(context, selectedFeed, query)).run(); - (tasks[2] = DBTasks.searchFeedItemChapters(context, selectedFeed, query)).run(); - (tasks[3] = DBTasks.searchFeedItemTitle(context, selectedFeed, query)).run(); + List<FutureTask<List<FeedItem>>> tasks = new ArrayList<>(); + tasks.add(DBTasks.searchFeedItemContentEncoded(context, selectedFeed, query)); + tasks.add(DBTasks.searchFeedItemDescription(context, selectedFeed, query)); + tasks.add(DBTasks.searchFeedItemChapters(context, selectedFeed, query)); + tasks.add(DBTasks.searchFeedItemTitle(context, selectedFeed, query)); + for (FutureTask<List<FeedItem>> task : tasks) { + task.run(); + } try { - for (int i = 0; i < tasks.length; i++) { - FutureTask task = tasks[i]; - List<FeedItem> items = (List<FeedItem>) task.get(); + for (int i = 0; i < tasks.size(); i++) { + FutureTask<List<FeedItem>> task = tasks.get(i); + List<FeedItem> items = task.get(); for (FeedItem item : items) { result.add(new SearchResult(item, values[i], subtitles[i])); } diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java index f84d6ee96..a086d6632 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/handler/TypeGetter.java @@ -78,9 +78,8 @@ public class TypeGetter { } } catch (IOException e1) { e1.printStackTrace(); - } finally { - throw new UnsupportedFeedtypeException(Type.INVALID, rootElement); } + throw new UnsupportedFeedtypeException(Type.INVALID, rootElement); } catch (IOException e) { e.printStackTrace(); diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java b/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java index 5dc194dbd..a17ecb124 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/QueueSorter.java @@ -59,6 +59,7 @@ public class QueueSorter { return -1 * (duration1 - duration2); }; + break; default: } 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 7870c747e..217655bf4 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 @@ -65,7 +65,7 @@ public abstract class PlaybackController { private static final int SCHED_EX_POOLSIZE = 1; private MediaPositionObserver positionObserver; - private ScheduledFuture positionObserverFuture; + private ScheduledFuture<?> positionObserverFuture; private boolean mediaInfoLoaded = false; private boolean released = false; |