summaryrefslogtreecommitdiff
path: root/core/src/main/java
diff options
context:
space:
mode:
authorvbh <code@bindu.io>2022-01-03 14:19:33 +0000
committerGitHub <noreply@github.com>2022-01-03 15:19:33 +0100
commit67bdb80d973addd4c143942fcdd011d006da6af5 (patch)
tree2591e0454f7a6208b8c2c25e2ebb53ca18bdddc4 /core/src/main/java
parent63cd326aa06b5099d29de93e1c57936134e0d935 (diff)
downloadAntennaPod-67bdb80d973addd4c143942fcdd011d006da6af5.zip
Combine 'Episode webpage' & 'Media file address' share options (#5626)
Diffstat (limited to 'core/src/main/java')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java39
1 files changed, 18 insertions, 21 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 34b9d294d..974519400 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
@@ -43,14 +43,6 @@ public class ShareUtils {
shareLink(context, feed.getTitle() + ": " + feed.getDownload_url());
}
- public static void shareFeedItemLink(Context context, FeedItem item) {
- shareFeedItemLink(context, item, false);
- }
-
- public static void shareFeedItemDownloadLink(Context context, FeedItem item) {
- shareFeedItemDownloadLink(context, item, false);
- }
-
private static String getItemShareText(FeedItem item) {
return item.getFeed().getTitle() + ": " + item.getTitle();
}
@@ -59,21 +51,26 @@ public class ShareUtils {
return FeedItemUtil.getLinkWithFallback(item) != null;
}
- public static void shareFeedItemLink(Context context, FeedItem item, boolean withPosition) {
- String text = getItemShareText(item) + " " + FeedItemUtil.getLinkWithFallback(item);
- if (withPosition) {
- int pos = item.getMedia().getPosition();
- text += " [" + Converter.getDurationStringLong(pos) + "]";
+ public static void shareFeedItemLinkWithDownloadLink(Context context, FeedItem item, boolean withPosition) {
+ String text = getItemShareText(item);
+ int pos = 0;
+ if (item.getMedia() != null && withPosition) {
+ text += "\n" + context.getResources().getString(R.string.share_starting_position_label) + ": ";
+ pos = item.getMedia().getPosition();
+ text += Converter.getDurationStringLong(pos);
+ }
+
+ if (hasLinkToShare(item)) {
+ text += "\n\n" + context.getResources().getString(R.string.share_dialog_episode_website_label) + ": ";
+ text += FeedItemUtil.getLinkWithFallback(item);
}
- shareLink(context, text);
- }
- public static void shareFeedItemDownloadLink(Context context, FeedItem item, boolean withPosition) {
- String text = getItemShareText(item) + " " + item.getMedia().getDownload_url();
- if (withPosition) {
- int pos = item.getMedia().getPosition();
- text += "#t=" + pos / 1000;
- text += " [" + Converter.getDurationStringLong(pos) + "]";
+ if (item.getMedia() != null && item.getMedia().getDownload_url() != null) {
+ text += "\n\n" + context.getResources().getString(R.string.share_dialog_media_file_label) + ": ";
+ text += item.getMedia().getDownload_url();
+ if (withPosition) {
+ text += "#t=" + pos / 1000;
+ }
}
shareLink(context, text);
}