summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authororionlee <orionlee@yahoo.com>2018-04-30 14:59:45 -0700
committerorionlee <orionlee@yahoo.com>2018-04-30 15:03:04 -0700
commit4bba6b30a1b5e82b93edc27742ec35362b08d1c7 (patch)
tree59cabda48d1d74c7060e8c184d6021afed0c8be5 /core/src
parent9d3d92cc9d98a908a5e2147aee0c6d5cb6b4db47 (diff)
downloadAntennaPod-4bba6b30a1b5e82b93edc27742ec35362b08d1c7.zip
Issue #2579: Provide share Link in episode playback screen even
when the episode has no link - Use podcast link as the fallback. Also bug fix share link with position: to include epsiode and podcast title.
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java23
1 files changed, 21 insertions, 2 deletions
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 898f7bedb..149cdcbc6 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,11 +50,30 @@ 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 );
+ }
+
public static void shareFeedItemLink(Context context, FeedItem item, boolean withPosition) {
- String text = getItemShareText(item) + " " + item.getLink();
+ String text = getItemShareText(item) + " " + getItemShareLink(item);
if(withPosition) {
int pos = item.getMedia().getPosition();
- text = item.getLink() + " [" + Converter.getDurationStringLong(pos) + "]";
+ text += " [" + Converter.getDurationStringLong(pos) + "]";
}
shareLink(context, text);
}