diff options
author | orionlee <orionlee@yahoo.com> | 2018-04-30 15:44:19 -0700 |
---|---|---|
committer | orionlee <orionlee@yahoo.com> | 2018-04-30 15:44:19 -0700 |
commit | 345fcc17d0416f8db61a2506aa88c25b53718ebb (patch) | |
tree | 7e3579e22be33aa0c31660b0b0daaf40c6039d84 /core/src/main/java/de/danoeh/antennapod | |
parent | 36507eb5064fe4b10a364f7b24855dba7f10d1c0 (diff) | |
download | AntennaPod-345fcc17d0416f8db61a2506aa88c25b53718ebb.zip |
FeedItem Visit Website tweak: use feed website as a fallback,
analogous to how share FeedItem link work.
Applicable to both feed playback screen and feed information screen.
Diffstat (limited to 'core/src/main/java/de/danoeh/antennapod')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java | 15 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java | 19 |
2 files changed, 17 insertions, 17 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java index 892e5ff38..129c1923e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/FeedItemUtil.java @@ -2,6 +2,7 @@ package de.danoeh.antennapod.core.util; import java.util.List; +import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.FeedItem; public class FeedItemUtil { @@ -75,4 +76,18 @@ public class FeedItemUtil { return false; } + /** + * Get the link for the feed item for the purpose of Share. It fallbacks to + * use the feed's link if the named feed item has no link. + */ + public static String getLinkWithFallback(FeedItem item) { + String link = item.getLink(); + if (link == null) { + Feed feed = item.getFeed(); + if (feed != null) { + link = feed.getLink(); + } + } + return link; + } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java index 149cdcbc6..0fbca2437 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java @@ -50,27 +50,12 @@ public class ShareUtils { return item.getFeed().getTitle() + ": " + item.getTitle(); } - /** - * Get the link for the feed item for the purpose of Share. It fallbacks to - * use the feed's link if the named feed item has no link. - */ - private static String getItemShareLink(FeedItem item) { - String link = item.getLink(); - if (link == null) { - Feed feed = item.getFeed(); - if (feed != null) { - link = feed.getLink(); - } - } - return link; - } - public static boolean hasLinkToShare(FeedItem item) { - return ( item != null && getItemShareLink(item) != null ); + return ( item != null && FeedItemUtil.getLinkWithFallback(item) != null ); } public static void shareFeedItemLink(Context context, FeedItem item, boolean withPosition) { - String text = getItemShareText(item) + " " + getItemShareLink(item); + String text = getItemShareText(item) + " " + FeedItemUtil.getLinkWithFallback(item); if(withPosition) { int pos = item.getMedia().getPosition(); text += " [" + Converter.getDurationStringLong(pos) + "]"; |