Merge pull request #4721 from tonytamsf/share-by-timecode
share by timecode
This commit is contained in:
commit
d20557c1b0
|
@ -21,7 +21,8 @@ import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||||
public class ShareUtils {
|
public class ShareUtils {
|
||||||
private static final String TAG = "ShareUtils";
|
private static final String TAG = "ShareUtils";
|
||||||
|
|
||||||
private ShareUtils() {}
|
private ShareUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void shareLink(Context context, String text) {
|
public static void shareLink(Context context, String text) {
|
||||||
Intent i = new Intent(Intent.ACTION_SEND);
|
Intent i = new Intent(Intent.ACTION_SEND);
|
||||||
|
@ -56,7 +57,7 @@ public class ShareUtils {
|
||||||
|
|
||||||
public static void shareFeedItemLink(Context context, FeedItem item, boolean withPosition) {
|
public static void shareFeedItemLink(Context context, FeedItem item, boolean withPosition) {
|
||||||
String text = getItemShareText(item) + " " + FeedItemUtil.getLinkWithFallback(item);
|
String text = getItemShareText(item) + " " + FeedItemUtil.getLinkWithFallback(item);
|
||||||
if(withPosition) {
|
if (withPosition) {
|
||||||
int pos = item.getMedia().getPosition();
|
int pos = item.getMedia().getPosition();
|
||||||
text += " [" + Converter.getDurationStringLong(pos) + "]";
|
text += " [" + Converter.getDurationStringLong(pos) + "]";
|
||||||
}
|
}
|
||||||
|
@ -65,8 +66,9 @@ public class ShareUtils {
|
||||||
|
|
||||||
public static void shareFeedItemDownloadLink(Context context, FeedItem item, boolean withPosition) {
|
public static void shareFeedItemDownloadLink(Context context, FeedItem item, boolean withPosition) {
|
||||||
String text = getItemShareText(item) + " " + item.getMedia().getDownload_url();
|
String text = getItemShareText(item) + " " + item.getMedia().getDownload_url();
|
||||||
if(withPosition) {
|
if (withPosition) {
|
||||||
int pos = item.getMedia().getPosition();
|
int pos = item.getMedia().getPosition();
|
||||||
|
text += "#t=" + pos / 1000;
|
||||||
text += " [" + Converter.getDurationStringLong(pos) + "]";
|
text += " [" + Converter.getDurationStringLong(pos) + "]";
|
||||||
}
|
}
|
||||||
shareLink(context, text);
|
shareLink(context, text);
|
||||||
|
@ -80,7 +82,8 @@ public class ShareUtils {
|
||||||
i.putExtra(Intent.EXTRA_STREAM, fileUri);
|
i.putExtra(Intent.EXTRA_STREAM, fileUri);
|
||||||
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
|
||||||
List<ResolveInfo> resInfoList = context.getPackageManager().queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY);
|
List<ResolveInfo> resInfoList = context.getPackageManager()
|
||||||
|
.queryIntentActivities(i, PackageManager.MATCH_DEFAULT_ONLY);
|
||||||
for (ResolveInfo resolveInfo : resInfoList) {
|
for (ResolveInfo resolveInfo : resInfoList) {
|
||||||
String packageName = resolveInfo.activityInfo.packageName;
|
String packageName = resolveInfo.activityInfo.packageName;
|
||||||
context.grantUriPermission(packageName, fileUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
context.grantUriPermission(packageName, fileUri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
|
Loading…
Reference in New Issue