From 932f24c892306ece534a0027472b6939b5b85c91 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Tue, 18 Apr 2017 10:50:47 +0200 Subject: Allow sharing feed file, as suggested in #2236 --- .../main/java/de/danoeh/antennapod/core/util/ShareUtils.java | 10 ++++++++++ core/src/main/res/values/strings.xml | 1 + 2 files changed, 11 insertions(+) (limited to 'core') 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 35916a604..4193a7674 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 @@ -3,9 +3,13 @@ package de.danoeh.antennapod.core.util; import android.content.Context; import android.content.Intent; +import android.net.Uri; import de.danoeh.antennapod.core.R; import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; + +import java.io.File; /** Utility methods for sharing data */ public class ShareUtils { @@ -58,4 +62,10 @@ public class ShareUtils { shareLink(context, text); } + public static void shareFeedItemFile(Context context, FeedMedia media) { + Intent i = new Intent(Intent.ACTION_SEND); + i.setType(media.getMime_type()); + i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(media.getLocalMediaUrl()))); + context.startActivity(Intent.createChooser(i, context.getString(R.string.share_file_label))); + } } diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index b82a03801..04a2f4f5c 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -126,6 +126,7 @@ Remove Podcast Share… Share Link + Share file Share Link with Position Share Feed URL Share Episode File URL -- cgit v1.2.3