#1198 Emailing stories

This commit is contained in:
sictiru 2021-02-21 17:29:24 -08:00
parent d20de367f1
commit dfa237e8fb
2 changed files with 11 additions and 10 deletions

View file

@ -56,7 +56,7 @@
<string name="top_level">TOP LEVEL</string>
<string name="send_brief">%1$s %2$s</string>
<string name="send_full">%1$s \n\n\"%2$s\" \n\n%3$s \n\n--\nShared with NewsBlur.com</string>
<string name="send_full">%1$s \n\%2$s \n\n%3$s \n\n—\nShared with NewsBlur.com</string>
<string name="share_comment_hint">Comment (Optional)</string>
<string name="share_newsblur">Share \"%s\" to your Blurblog?</string>
<string name="share_this">SHARE</string>

View file

@ -398,23 +398,24 @@ public class FeedUtils {
}
public static void sendStoryBrief(Story story, Context context) {
if (story == null ) { return; }
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
if (story == null) return;
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_SUBJECT, UIUtils.fromHtml(story.title).toString());
intent.putExtra(Intent.EXTRA_TEXT, String.format(context.getResources().getString(R.string.send_brief), new Object[]{UIUtils.fromHtml(story.title), story.permalink}));
intent.putExtra(Intent.EXTRA_SUBJECT, story.title);
intent.putExtra(Intent.EXTRA_TEXT, String.format(context.getResources().getString(R.string.send_brief), story.title, story.permalink));
context.startActivity(Intent.createChooser(intent, "Send using"));
}
public static void sendStoryFull(Story story, Context context) {
if (story == null ) { return; }
String body = getStoryContent(story.storyHash);
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
if (story == null) return;
String body = getStoryText(story.storyHash);
if (TextUtils.isEmpty(body)) body = getStoryContent(story.storyHash);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_SUBJECT, UIUtils.fromHtml(story.title).toString());
intent.putExtra(Intent.EXTRA_TEXT, String.format(context.getResources().getString(R.string.send_full), new Object[]{story.permalink, UIUtils.fromHtml(story.title), UIUtils.fromHtml(body)}));
intent.putExtra(Intent.EXTRA_SUBJECT, story.title);
intent.putExtra(Intent.EXTRA_TEXT, String.format(context.getResources().getString(R.string.send_full), story.title, story.permalink, UIUtils.fromHtml(body)));
context.startActivity(Intent.createChooser(intent, "Send using"));
}