diff options
Diffstat (limited to '')
-rw-r--r-- | src/main/AndroidManifest.xml | 6 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/ContactChooserTargetService.java | 14 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 4eeb4c367..9e92dd8bb 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -217,6 +217,12 @@ <intent-filter> <action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND_MULTIPLE" /> + <category android:name="android.intent.category.DEFAULT" /> + <data android:mimeType="text/plain" /> + </intent-filter> + <intent-filter> + <action android:name="android.intent.action.SEND" /> + <action android:name="android.intent.action.SEND_MULTIPLE" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="*/*" /> 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) { |