do not include read only chats in contact chooser. fixes #3077
This commit is contained in:
parent
b9bdb3df55
commit
f434925753
|
@ -903,7 +903,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int sentMessagesCount() {
|
public int sentMessagesCount() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
synchronized (this.messages) {
|
synchronized (this.messages) {
|
||||||
for (Message message : messages) {
|
for (Message message : messages) {
|
||||||
|
|
|
@ -44,14 +44,19 @@ public class ContactChooserTargetService extends ChooserTargetService implements
|
||||||
mXmppConnectionService.populateWithOrderedConversations(conversations, false);
|
mXmppConnectionService.populateWithOrderedConversations(conversations, false);
|
||||||
final ComponentName componentName = new ComponentName(this, ShareWithActivity.class);
|
final ComponentName componentName = new ComponentName(this, ShareWithActivity.class);
|
||||||
final int pixel = (int) (48 * getResources().getDisplayMetrics().density);
|
final int pixel = (int) (48 * getResources().getDisplayMetrics().density);
|
||||||
for(int i = 0; i < Math.min(conversations.size(),MAX_TARGETS); ++i) {
|
for(Conversation conversation : conversations) {
|
||||||
final Conversation conversation = conversations.get(i);
|
if (conversation.sentMessagesCount() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
final String name = conversation.getName().toString();
|
final String name = conversation.getName().toString();
|
||||||
final Icon icon = Icon.createWithBitmap(mXmppConnectionService.getAvatarService().get(conversation, pixel));
|
final Icon icon = Icon.createWithBitmap(mXmppConnectionService.getAvatarService().get(conversation, pixel));
|
||||||
final float score = 1 - (1.0f / MAX_TARGETS) * i;
|
final float score = 1 - (1.0f / MAX_TARGETS) * chooserTargets.size();
|
||||||
final Bundle extras = new Bundle();
|
final Bundle extras = new Bundle();
|
||||||
extras.putString("uuid", conversation.getUuid());
|
extras.putString("uuid", conversation.getUuid());
|
||||||
chooserTargets.add(new ChooserTarget(name, icon, score, componentName, extras));
|
chooserTargets.add(new ChooserTarget(name, icon, score, componentName, extras));
|
||||||
|
if (chooserTargets.size() >= MAX_TARGETS) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue