diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-12-17 07:12:38 +0100 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-12-17 07:12:38 +0100 |
commit | 1a7ed4ed7c56bc0af70ebdaf67f71da9205f6afd (patch) | |
tree | c6681a13109ac169fcfe89dc7cb2a9ee1b8749ac /src/main/java/eu | |
parent | fd4cf499a2edd517b356d421c23b15c2b5173dde (diff) |
properly detect images in share with
Diffstat (limited to 'src/main/java/eu')
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java | 12 |
1 files 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 fffcfaca..be5eee99 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(); |