diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-03-16 18:09:19 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-03-16 18:09:19 +0100 |
commit | b17ca3543fdfd5a0265e0f64ee24a4ecd7b70741 (patch) | |
tree | cca9506d0ba36de7b396e33683fa42dd67489295 /src/main/java/eu/siacs/conversations | |
parent | 48be5af55ff22c666a57fe2c2de10a147b6f7958 (diff) |
made it possible to share text files
Diffstat (limited to 'src/main/java/eu/siacs/conversations')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java index a710a558..4ec43c27 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java @@ -181,23 +181,24 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer return; } final String type = intent.getType(); - Log.d(Config.LOGTAG, "action: "+intent.getAction()+ ", type:"+type); + final String action = intent.getAction(); + Log.d(Config.LOGTAG, "action: "+action+ ", type:"+type); share.uuid = intent.getStringExtra("uuid"); - if (Intent.ACTION_SEND.equals(intent.getAction())) { - final Uri uri = getIntent().getParcelableExtra(Intent.EXTRA_STREAM); - if (type != null && uri != null && !type.equalsIgnoreCase("text/plain")) { + if (Intent.ACTION_SEND.equals(action)) { + final String text = intent.getStringExtra(Intent.EXTRA_TEXT); + final Uri uri = intent.getParcelableExtra(Intent.EXTRA_STREAM); + if (type != null && uri != null && text == null) { this.share.uris.clear(); this.share.uris.add(uri); this.share.image = type.startsWith("image/") || isImage(uri); } else { - this.share.text = getIntent().getStringExtra(Intent.EXTRA_TEXT); + this.share.text = text; } - } else if (Intent.ACTION_SEND_MULTIPLE.equals(intent.getAction())) { + } else if (Intent.ACTION_SEND_MULTIPLE.equals(action)) { this.share.image = type != null && type.startsWith("image/"); if (!this.share.image) { return; } - this.share.uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); } if (xmppConnectionServiceBound) { |