summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorByteHamster <ByteHamster@users.noreply.github.com>2021-11-28 14:59:51 +0100
committerGitHub <noreply@github.com>2021-11-28 14:59:51 +0100
commitaf2835c59dcb0473aba7a48b38f5abe28dca34d3 (patch)
tree9765ab679334cc555536646b4d2078bb02c9ca79 /core
parentb4f1f44c28900ccac2dee6da2044c178e73685eb (diff)
parent7eead38f52335e2ab7262b4da518944afae85c3d (diff)
downloadAntennaPod-af2835c59dcb0473aba7a48b38f5abe28dca34d3.zip
Merge pull request #5558 from johnjohndoe/share-intent
Use ShareCompat.IntentBuilder to compose share intent.
Diffstat (limited to 'core')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/ShareUtils.java17
1 files changed, 11 insertions, 6 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 a5aed5da9..34b9d294d 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
@@ -5,9 +5,12 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
-import androidx.core.content.FileProvider;
import android.util.Log;
+import androidx.annotation.NonNull;
+import androidx.core.app.ShareCompat;
+import androidx.core.content.FileProvider;
+
import java.io.File;
import java.util.List;
@@ -23,11 +26,13 @@ public class ShareUtils {
private ShareUtils() {
}
- public static void shareLink(Context context, String text) {
- Intent i = new Intent(Intent.ACTION_SEND);
- i.setType("text/plain");
- i.putExtra(Intent.EXTRA_TEXT, text);
- context.startActivity(Intent.createChooser(i, context.getString(R.string.share_url_label)));
+ public static void shareLink(@NonNull Context context, @NonNull String text) {
+ Intent intent = new ShareCompat.IntentBuilder(context)
+ .setType("text/plain")
+ .setText(text)
+ .setChooserTitle(R.string.share_url_label)
+ .createChooserIntent();
+ context.startActivity(intent);
}
public static void shareFeedlink(Context context, Feed feed) {