diff options
author | H. Lehmann <ByteHamster@users.noreply.github.com> | 2017-06-04 14:38:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-04 14:38:20 +0200 |
commit | 341928b3bac5ee86f04251790488c4b0a259387a (patch) | |
tree | 15b008066885dcc048bf058fd67b47ecc2f03e41 /core | |
parent | dc6141ea1dfcfdef11127d7ac61ae4924a2ed450 (diff) | |
parent | 75ece930e92704749664198de06c85a793f2c6b9 (diff) | |
download | AntennaPod-341928b3bac5ee86f04251790488c4b0a259387a.zip |
Merge pull request #2305 from ByteHamster/share-file
Allow sharing feed file, as suggested in #2236
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java | 11 | ||||
-rw-r--r-- | core/src/main/res/values/strings.xml | 1 |
2 files changed, 12 insertions, 0 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 35916a604..887c0055c 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,11 @@ 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()))); + i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + 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..86cff515f 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -126,6 +126,7 @@ <string name="remove_feed_label">Remove Podcast</string> <string name="share_label">Share…</string> <string name="share_link_label">Share Link</string> + <string name="share_file_label">Share File</string> <string name="share_link_with_position_label">Share Link with Position</string> <string name="share_feed_url_label">Share Feed URL</string> <string name="share_item_url_label">Share Episode File URL</string> |