diff options
author | orionlee <orionlee@yahoo.com> | 2019-01-10 11:44:08 -0800 |
---|---|---|
committer | orionlee <orionlee@yahoo.com> | 2019-04-06 13:43:11 -0700 |
commit | 0472bb9237bd461a30f93c962d3dc9c8fdb7d4cd (patch) | |
tree | 2e49068255d4999fd36e51b9c824a5064f85c4e5 /core/src/main/java | |
parent | 670fc124ebbbce8575364e473e6c87ce4f914ccd (diff) | |
download | AntennaPod-0472bb9237bd461a30f93c962d3dc9c8fdb7d4cd.zip |
#2966 RxJava2 null - explicit mark underlying Rx sources as NonNull
to be on the safe side, for cases that the consuming observers checks null
unnecessarily.
Rx observer : underlying sources marked as NonNull
OnlineFeedViewActivity.startFeedDownload : Downloader.getResult
AllEpisodesFragment.loadItems : AllEpisodesFragment.loadData
PlaybackHistoryFragment.loadItems : DBReader.getPlaybackHistory
QueueFragment.loadItems : DBReader.getQueue
SearchFragment.search : .performSearch
Diffstat (limited to 'core/src/main/java')
4 files changed, 16 insertions, 3 deletions
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 445210d3a..38b93eab8 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 @@ -2,6 +2,7 @@ package de.danoeh.antennapod.core.service.download; import android.content.Context; import android.net.wifi.WifiManager; +import android.support.annotation.NonNull; import java.util.concurrent.Callable; @@ -18,10 +19,12 @@ public abstract class Downloader implements Callable<Downloader> { volatile boolean cancelled; + @NonNull final DownloadRequest request; + @NonNull final DownloadStatus result; - Downloader(DownloadRequest request) { + Downloader(@NonNull DownloadRequest request) { super(); this.request = request; this.request.setStatusMsg(R.string.download_pending); @@ -54,10 +57,12 @@ public abstract class Downloader implements Callable<Downloader> { return this; } + @NonNull public DownloadRequest getDownloadRequest() { return request; } + @NonNull public DownloadStatus getResult() { return result; } 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 842ad0c60..c27cefc10 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 @@ -1,5 +1,6 @@ package de.danoeh.antennapod.core.service.download; +import android.support.annotation.NonNull; import android.text.TextUtils; import android.util.Log; @@ -38,7 +39,7 @@ public class HttpDownloader extends Downloader { private static final int BUFFER_SIZE = 8 * 1024; - public HttpDownloader(DownloadRequest request) { + public HttpDownloader(@NonNull DownloadRequest request) { super(request); } 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 6c619fa31..86d2b8893 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 @@ -202,6 +202,7 @@ public final class DBReader { } } + @NonNull private static List<FeedItem> extractItemlistFromCursor(PodDBAdapter adapter, Cursor cursor) { List<FeedItem> result = new ArrayList<>(cursor.getCount()); @@ -254,6 +255,7 @@ public final class DBReader { return feed; } + @NonNull static List<FeedItem> getQueue(PodDBAdapter adapter) { Log.d(TAG, "getQueue()"); Cursor cursor = null; @@ -310,6 +312,7 @@ public final class DBReader { * @return A list of FeedItems sorted by the same order as the queue. The caller can wrap the returned * list in a {@link de.danoeh.antennapod.core.util.QueueAccess} object for easier access to the queue's properties. */ + @NonNull public static List<FeedItem> getQueue() { Log.d(TAG, "getQueue() called"); @@ -418,6 +421,7 @@ public final class DBReader { * * @param limit The maximum number of episodes that should be loaded. */ + @NonNull public static List<FeedItem> getRecentlyPublishedEpisodes(int limit) { Log.d(TAG, "getRecentlyPublishedEpisodes() called with: " + "limit = [" + limit + "]"); @@ -444,6 +448,7 @@ public final class DBReader { * @return The playback history. The FeedItems are sorted by their media's playbackCompletionDate in descending order. * The size of the returned list is limited by {@link #PLAYBACK_HISTORY_SIZE}. */ + @NonNull public static List<FeedItem> getPlaybackHistory() { Log.d(TAG, "getPlaybackHistory() called"); 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 f91e2ad08..4093c41a5 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 @@ -1,6 +1,7 @@ package de.danoeh.antennapod.core.storage; import android.content.Context; +import android.support.annotation.NonNull; import java.util.ArrayList; import java.util.Collections; @@ -35,6 +36,7 @@ public class FeedSearcher { * @param selectedFeed feed to search, 0 to search through all feeds * @return list of episodes containing the query */ + @NonNull public static List<SearchResult> performSearch(final Context context, final String query, final long selectedFeed) { final int values[] = {2, 1, 0, 0, 0, 0}; @@ -45,7 +47,7 @@ public class FeedSearcher { context.getString(R.string.found_in_authors_label), context.getString(R.string.found_in_feeds_label)}; - List<SearchResult> result = new ArrayList<>(); + final List<SearchResult> result = new ArrayList<>(); List<FutureTask<List<FeedItem>>> tasks = new ArrayList<>(); tasks.add(DBTasks.searchFeedItemTitle(context, selectedFeed, query)); |