Issue #2579: Provide share Link in episode playback screen even
when the episode has no link - Use podcast link as the fallback. Also bug fix share link with position: to include epsiode and podcast title.
This commit is contained in:
parent
9d3d92cc9d
commit
4bba6b30a1
|
@ -324,7 +324,7 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
|||
menu.findItem(R.id.visit_website_item).setVisible(hasWebsiteLink);
|
||||
|
||||
boolean isItemAndHasLink = isFeedMedia &&
|
||||
((FeedMedia) media).getItem() != null && ((FeedMedia) media).getItem().getLink() != null;
|
||||
ShareUtils.hasLinkToShare(((FeedMedia) media).getItem());
|
||||
menu.findItem(R.id.share_link_item).setVisible(isItemAndHasLink);
|
||||
menu.findItem(R.id.share_link_with_position_item).setVisible(isItemAndHasLink);
|
||||
|
||||
|
|
|
@ -50,11 +50,30 @@ public class ShareUtils {
|
|||
return item.getFeed().getTitle() + ": " + item.getTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the link for the feed item for the purpose of Share. It fallbacks to
|
||||
* use the feed's link if the named feed item has no link.
|
||||
*/
|
||||
private static String getItemShareLink(FeedItem item) {
|
||||
String link = item.getLink();
|
||||
if (link == null) {
|
||||
Feed feed = item.getFeed();
|
||||
if (feed != null) {
|
||||
link = feed.getLink();
|
||||
}
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
public static boolean hasLinkToShare(FeedItem item) {
|
||||
return ( item != null && getItemShareLink(item) != null );
|
||||
}
|
||||
|
||||
public static void shareFeedItemLink(Context context, FeedItem item, boolean withPosition) {
|
||||
String text = getItemShareText(item) + " " + item.getLink();
|
||||
String text = getItemShareText(item) + " " + getItemShareLink(item);
|
||||
if(withPosition) {
|
||||
int pos = item.getMedia().getPosition();
|
||||
text = item.getLink() + " [" + Converter.getDurationStringLong(pos) + "]";
|
||||
text += " [" + Converter.getDurationStringLong(pos) + "]";
|
||||
}
|
||||
shareLink(context, text);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue