diff options
author | orionlee <orionlee@yahoo.com> | 2019-01-09 14:27:59 -0800 |
---|---|---|
committer | orionlee <orionlee@yahoo.com> | 2019-04-06 13:43:11 -0700 |
commit | 670fc124ebbbce8575364e473e6c87ce4f914ccd (patch) | |
tree | b92ea8689d30791d48095b84663a966342e6fcd9 /core/src/main/java | |
parent | 5f86af88b18b94d3ba741963a6ae4ea51a532050 (diff) | |
download | AntennaPod-670fc124ebbbce8575364e473e6c87ce4f914ccd.zip |
#2966 RxJava2 null - explicit mark underlying Rx sources as NonNull
to be on the safe side, for cases that the consuming observers
already assumes the result is not null.
Rx observer : underlying sources marked as NonNull
OnlineFeedViewActivity.listener member : DBReader.getFeedList
StatisticsActivity.loadStatistics : DBReader.getStatistics
CustomMRControllerDialog.updateViews : CustomMRControllerDialog.fetchArt
CompletedDownloadsFragment.loadItems : DBReader.getDownloadedItems
DownloadLogFragment.loadItems : DBReader.getDownloadedItems
ItemDescriptionFragment.onViewCreated : .loadData, Timeline.processShownotes
SubscriptionFragment.loadSubscriptions : DBReader.getNavDrawerData
SubscriptionFragment.onContextItemSelected (x2) : DBWriter.markFeedSeen, DBWriter.markFeedRead
PreferenceController.export : ExportWorker.output member
Diffstat (limited to 'core/src/main/java')
3 files changed, 12 insertions, 2 deletions
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 63227e550..6c619fa31 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 @@ -1,6 +1,7 @@ package de.danoeh.antennapod.core.storage; import android.database.Cursor; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.util.ArrayMap; import android.text.TextUtils; @@ -58,6 +59,7 @@ public final class DBReader { * of the returned list does NOT have its list of FeedItems yet. The FeedItem-list * can be loaded separately with {@link #getFeedItemList(Feed)}. */ + @NonNull public static List<Feed> getFeedList() { Log.d(TAG, "Extracting Feedlist"); @@ -70,6 +72,7 @@ public final class DBReader { } } + @NonNull private static List<Feed> getFeedList(PodDBAdapter adapter) { Cursor cursor = null; try { @@ -324,6 +327,7 @@ public final class DBReader { * * @return A list of FeedItems whose episdoe has been downloaded. */ + @NonNull public static List<FeedItem> getDownloadedItems() { Log.d(TAG, "getDownloadedItems() called"); @@ -859,6 +863,7 @@ public final class DBReader { * countAll calculation time * @return The StatisticsInfo object */ + @NonNull public static StatisticsData getStatistics(boolean sortByCountAll) { PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); @@ -1025,6 +1030,7 @@ public final class DBReader { * the list of subscriptions, the number of items in the queue and the number of unread * items. */ + @NonNull public static NavDrawerData getNavDrawerData() { Log.d(TAG, "getNavDrawerData() called with: " + ""); PodDBAdapter adapter = PodDBAdapter.getInstance(); 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 ad20bfa0a..45dac4c53 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 @@ -5,6 +5,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; +import android.support.annotation.NonNull; import android.util.Log; import org.shredzone.flattr4j.model.Flattr; @@ -633,11 +634,13 @@ public class DBWriter { * FeedItem.NEW, FeedItem.UNPLAYED * @param resetMediaPosition true if this method should also reset the position of the FeedItem's FeedMedia object. */ + @NonNull public static Future<?> markItemPlayed(FeedItem item, int played, boolean resetMediaPosition) { long mediaId = (item.hasMedia()) ? item.getMedia().getId() : 0; return markItemPlayed(item.getId(), played, mediaId, resetMediaPosition); } + @NonNull private static Future<?> markItemPlayed(final long itemId, final int played, final long mediaId, 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 56550bb06..75229b9cf 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 @@ -83,6 +83,7 @@ public class Timeline { * @param addTimecodes True if this method should add timecode links * @return The processed HTML string. */ + @NonNull public String processShownotes(final boolean addTimecodes) { final Playable playable = (shownotesProvider instanceof Playable) ? (Playable) shownotesProvider : null; @@ -92,8 +93,8 @@ public class Timeline { try { shownotes = shownotesProvider.loadShownotes().call(); } catch (Exception e) { - e.printStackTrace(); - return null; + Log.e(TAG, "processShownotes() - encounters exceptions unexpectedly in load, treat as if no shownotes.", e); + shownotes = ""; } if (TextUtils.isEmpty(shownotes)) { |