summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2012-07-10 17:40:35 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2012-07-10 17:40:35 +0200
commit919e978f8d3a76a145e12412b581897544ea2c29 (patch)
tree1e5d97420ebf9f716e42d7596b831efda50fb0ba /src
parentd30a4f84956b9bf23ca601de6f691ec6d5eaa919 (diff)
downloadAntennaPod-919e978f8d3a76a145e12412b581897544ea2c29.zip
Implemented sharing menus
Diffstat (limited to 'src')
-rw-r--r--src/de/podfetcher/util/FeedItemMenuHandler.java5
-rw-r--r--src/de/podfetcher/util/FeedMenuHandler.java9
-rw-r--r--src/de/podfetcher/util/ShareUtils.java34
3 files changed, 48 insertions, 0 deletions
diff --git a/src/de/podfetcher/util/FeedItemMenuHandler.java b/src/de/podfetcher/util/FeedItemMenuHandler.java
index 59d46de0f..83c2fcb3e 100644
--- a/src/de/podfetcher/util/FeedItemMenuHandler.java
+++ b/src/de/podfetcher/util/FeedItemMenuHandler.java
@@ -38,6 +38,8 @@ public class FeedItemMenuHandler {
} else {
menu.findItem(R.id.add_to_queue_item).setVisible(true);
}
+
+ menu.findItem(R.id.share_link_item).setVisible(selectedItem.getLink() != null);
}
if (selectedItem.isRead()) {
@@ -100,6 +102,9 @@ public class FeedItemMenuHandler {
Uri supportUri = Uri.parse(selectedItem.getPaymentLink());
context.startActivity(new Intent(Intent.ACTION_VIEW, supportUri));
break;
+ case R.id.share_link_item:
+ ShareUtils.shareFeedItemLink(context, selectedItem);
+ break;
default:
return false;
}
diff --git a/src/de/podfetcher/util/FeedMenuHandler.java b/src/de/podfetcher/util/FeedMenuHandler.java
index 10fdcb2ab..1f0667be5 100644
--- a/src/de/podfetcher/util/FeedMenuHandler.java
+++ b/src/de/podfetcher/util/FeedMenuHandler.java
@@ -40,6 +40,9 @@ public class FeedMenuHandler {
} else {
refresh.setVisible(true);
}
+
+ menu.findItem(R.id.share_link_item).setVisible(selectedFeed.getLink() != null);
+
return true;
}
@@ -68,6 +71,12 @@ public class FeedMenuHandler {
Uri supportUri = Uri.parse(selectedFeed.getPaymentLink());
context.startActivity(new Intent(Intent.ACTION_VIEW, supportUri));
break;
+ case R.id.share_link_item:
+ ShareUtils.shareFeedlink(context, selectedFeed);
+ break;
+ case R.id.share_source_item:
+ ShareUtils.shareFeedDownloadLink(context, selectedFeed);
+ break;
default:
return false;
}
diff --git a/src/de/podfetcher/util/ShareUtils.java b/src/de/podfetcher/util/ShareUtils.java
new file mode 100644
index 000000000..f9230b311
--- /dev/null
+++ b/src/de/podfetcher/util/ShareUtils.java
@@ -0,0 +1,34 @@
+package de.podfetcher.util;
+
+import de.podfetcher.feed.Feed;
+import de.podfetcher.feed.FeedItem;
+import android.content.Context;
+import android.content.Intent;
+
+/** Utility methods for sharing data */
+public class ShareUtils {
+ private static final String TAG = "ShareUtils";
+
+ private ShareUtils() {}
+
+ private static void shareLink(Context context, String link) {
+ Intent i = new Intent(Intent.ACTION_SEND);
+ i.setType("text/plain");
+ i.putExtra(Intent.EXTRA_SUBJECT, "Sharing URL");
+ i.putExtra(Intent.EXTRA_TEXT, link);
+ context.startActivity(Intent.createChooser(i, "Share URL"));
+ }
+
+ public static void shareFeedItemLink(Context context, FeedItem item) {
+ shareLink(context, item.getLink());
+ }
+
+ public static void shareFeedDownloadLink(Context context, Feed feed) {
+ shareLink(context, feed.getDownload_url());
+ }
+
+ public static void shareFeedlink(Context context, Feed feed) {
+ shareLink(context, feed.getLink());
+ }
+
+}