1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00

Support extras for ACTION_VIEW + mailto: URI

Support the extras documented for ACTION_SEND to be used with
ACTION_VIEW to support another app that doesn't care, namely Twitter.
This commit is contained in:
cketti 2014-01-30 02:47:10 +01:00
parent 1a16dbf295
commit b299713807

View File

@ -917,8 +917,6 @@ public class MessageCompose extends K9Activity implements OnClickListener,
final String action = intent.getAction(); final String action = intent.getAction();
if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_SENDTO.equals(action)) { if (Intent.ACTION_VIEW.equals(action) || Intent.ACTION_SENDTO.equals(action)) {
startedByExternalIntent = true;
/* /*
* Someone has clicked a mailto: link. The address is in the URI. * Someone has clicked a mailto: link. The address is in the URI.
*/ */
@ -930,21 +928,21 @@ public class MessageCompose extends K9Activity implements OnClickListener,
} }
/* /*
* Note: According to the documenation ACTION_VIEW and ACTION_SENDTO don't accept * Note: According to the documentation ACTION_VIEW and ACTION_SENDTO don't accept
* EXTRA_* parameters. * EXTRA_* parameters.
* And previously we didn't process these EXTRAs. But it looks like nobody bothers to * And previously we didn't process these EXTRAs. But it looks like nobody bothers to
* read the official documentation and just copies wrong sample code that happens to * read the official documentation and just copies wrong sample code that happens to
* work with the AOSP Email application. And because even big players get this wrong, * work with the AOSP Email application. And because even big players get this wrong,
* we're now finally giving in and read the EXTRAs for ACTION_SENDTO (below). * we're now finally giving in and read the EXTRAs for those actions (below).
*/ */
} }
if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action) || if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action) ||
Intent.ACTION_SENDTO.equals(action)) { Intent.ACTION_SENDTO.equals(action) || Intent.ACTION_VIEW.equals(action)) {
startedByExternalIntent = true; startedByExternalIntent = true;
/* /*
* Note: Here we allow a slight deviation from the documentated behavior. * Note: Here we allow a slight deviation from the documented behavior.
* EXTRA_TEXT is used as message body (if available) regardless of the MIME * EXTRA_TEXT is used as message body (if available) regardless of the MIME
* type of the intent. In addition one or multiple attachments can be added * type of the intent. In addition one or multiple attachments can be added
* using EXTRA_STREAM. * using EXTRA_STREAM.