diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-10-08 10:25:11 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-10-08 10:25:11 +0200 |
commit | 7437ee12fdb152aa4e060b84ca538e00b070a2f6 (patch) | |
tree | 2207b9805fa46c1a355645fd19777ea2537e9de8 /src/main/java | |
parent | 4aa2eb0be27cfc3a35d50b5616a33f60dc414bd7 (diff) |
Prepend the subject from the intent if present
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ShareWithActivity.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java index 9a6adf10a..8b43fb7a4 100644 --- a/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShareWithActivity.java @@ -31,6 +31,8 @@ import de.pixart.messenger.xmpp.XmppConnection; import de.pixart.messenger.xmpp.jid.InvalidJidException; import de.pixart.messenger.xmpp.jid.Jid; +import static java.lang.String.format; + public class ShareWithActivity extends XmppActivity implements XmppConnectionService.OnConversationUpdate { private boolean mReturnToPrevious = false; @@ -194,6 +196,7 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer Log.d(Config.LOGTAG, "action: "+action+ ", type:"+type); share.uuid = intent.getStringExtra("uuid"); if (Intent.ACTION_SEND.equals(action)) { + final String subject = intent.getStringExtra(Intent.EXTRA_SUBJECT); final String text = intent.getStringExtra(Intent.EXTRA_TEXT); final Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM); if (type != null && uri != null && (text == null || !type.equals("text/plain"))) { @@ -202,7 +205,11 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer this.share.image = type.startsWith("image/") || isImage(uri); this.share.video = type.startsWith("video/") || isVideo(uri); } else { - this.share.text = text; + if (subject != null) { + this.share.text = format("[%s]%n%s", subject, text); + } else { + this.share.text = text; + } } } else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) { this.share.image = type != null && type.startsWith("image/"); |