From 1a7ed4ed7c56bc0af70ebdaf67f71da9205f6afd Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Wed, 17 Dec 2014 07:12:38 +0100 Subject: [PATCH] properly detect images in share with --- .../eu/siacs/conversations/ui/ShareWithActivity.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java index fffcfaca9..be5eee991 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java @@ -30,6 +30,7 @@ public class ShareWithActivity extends XmppActivity { private class Share { public Uri uri; + public boolean image; public String account; public String contact; public String text; @@ -129,10 +130,10 @@ public class ShareWithActivity extends XmppActivity { @Override public void onStart() { - if (getIntent().getType() != null - && !getIntent().getType().startsWith("text/")) { - this.share.uri = (Uri) getIntent().getParcelableExtra( - Intent.EXTRA_STREAM); + final String type = getIntent().getType(); + if (type != null && !type.startsWith("text/")) { + this.share.uri = (Uri) getIntent().getParcelableExtra(Intent.EXTRA_STREAM); + this.share.image = type.startsWith("image/") || URLConnection.guessContentTypeFromName(share.uri.getPath()).startsWith("image/"); } else { this.share.text = getIntent().getStringExtra(Intent.EXTRA_TEXT); } @@ -179,8 +180,7 @@ public class ShareWithActivity extends XmppActivity { selectPresence(conversation, new OnPresenceSelected() { @Override public void onPresenceSelected() { - final String type = URLConnection.guessContentTypeFromName(share.uri.getPath()); - if (type != null && type.startsWith("image/")) { + if (share.image) { Toast.makeText(getApplicationContext(), getText(R.string.preparing_image), Toast.LENGTH_LONG).show();