diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-01-25 22:28:04 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-01-25 22:28:04 +0100 |
commit | d93d92dee3add2bf293a177fd5d8afdbd691f684 (patch) | |
tree | 01816897b2186c93dd38f0ac1c76dcb082185666 /src/main/java/de | |
parent | 83258c8a19d64fc4e451a57fc8097391b0437b75 (diff) |
make contact chooser (direct sharing) smart about sharing text in groups when http is not available
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java b/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java index e4a98d63a..006b6e918 100644 --- a/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java +++ b/src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java @@ -23,10 +23,17 @@ import de.pixart.messenger.ui.ConversationsActivity; public class ContactChooserTargetService extends ChooserTargetService implements ServiceConnection { private final Object lock = new Object(); - + private final int MAX_TARGETS = 5; private XmppConnectionService mXmppConnectionService; - private final int MAX_TARGETS = 5; + private static boolean textOnly(IntentFilter filter) { + for (int i = 0; i < filter.countDataTypes(); ++i) { + if (!"text/plain".equals(filter.getDataType(i))) { + return false; + } + } + return true; + } @Override public List<ChooserTarget> onGetChooserTargets(ComponentName targetActivityName, IntentFilter matchedFilter) { @@ -40,7 +47,8 @@ public class ContactChooserTargetService extends ChooserTargetService implements if (!mXmppConnectionService.areMessagesInitialized()) { return chooserTargets; } - mXmppConnectionService.populateWithOrderedConversations(conversations, false); + + mXmppConnectionService.populateWithOrderedConversations(conversations, textOnly(matchedFilter)); final ComponentName componentName = new ComponentName(this, ConversationsActivity.class); final int pixel = AvatarService.getSystemUiAvatarSize(this); for (Conversation conversation : conversations) { |