summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Preuss <tobias.preuss@googlemail.com>2021-11-20 23:47:10 +0100
committerTobias Preuss <tobias.preuss@googlemail.com>2021-11-23 06:20:30 +0100
commit7eead38f52335e2ab7262b4da518944afae85c3d (patch)
tree9765ab679334cc555536646b4d2078bb02c9ca79
parentb4f1f44c28900ccac2dee6da2044c178e73685eb (diff)
downloadAntennaPod-7eead38f52335e2ab7262b4da518944afae85c3d.zip
Use ShareCompat.IntentBuilder to compose share intent.
-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) {