simplefied some code that might have been the source for some strange bugs
This commit is contained in:
parent
b23f8bd472
commit
1871521aed
|
@ -142,7 +142,8 @@ public class ConversationFragment extends Fragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueEdited(String value) {
|
public void onValueEdited(String value) {
|
||||||
activity.xmppConnectionService.providePasswordForMuc(conversation,value);
|
activity.xmppConnectionService.providePasswordForMuc(
|
||||||
|
conversation, value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -188,7 +189,8 @@ public class ConversationFragment extends Fragment {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Message message = new Message(conversation, mEditMessage.getText()
|
Message message = new Message(conversation, mEditMessage.getText()
|
||||||
.toString(), conversation.getNextEncryption(activity.forceEncryption()));
|
.toString(), conversation.getNextEncryption(activity
|
||||||
|
.forceEncryption()));
|
||||||
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
||||||
if (conversation.getNextPresence() != null) {
|
if (conversation.getNextPresence() != null) {
|
||||||
message.setPresence(conversation.getNextPresence());
|
message.setPresence(conversation.getNextPresence());
|
||||||
|
@ -440,15 +442,11 @@ public class ConversationFragment extends Fragment {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.conversation.getMessages().size() == 0) {
|
|
||||||
this.messageList.clear();
|
this.messageList.clear();
|
||||||
|
if (this.conversation.getMessages().size() == 0) {
|
||||||
messagesLoaded = false;
|
messagesLoaded = false;
|
||||||
} else {
|
} else {
|
||||||
for (Message message : this.conversation.getMessages()) {
|
this.messageList.addAll(this.conversation.getMessages());
|
||||||
if (!this.messageList.contains(message)) {
|
|
||||||
this.messageList.add(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
messagesLoaded = true;
|
messagesLoaded = true;
|
||||||
updateStatusMessages();
|
updateStatusMessages();
|
||||||
}
|
}
|
||||||
|
@ -500,23 +498,15 @@ public class ConversationFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateStatusMessages() {
|
protected void updateStatusMessages() {
|
||||||
boolean addedStatusMsg = false;
|
|
||||||
if (conversation.getMode() == Conversation.MODE_SINGLE) {
|
if (conversation.getMode() == Conversation.MODE_SINGLE) {
|
||||||
for (int i = this.messageList.size() - 1; i >= 0; --i) {
|
for (int i = this.messageList.size() - 1; i >= 0; --i) {
|
||||||
if (addedStatusMsg) {
|
|
||||||
if (this.messageList.get(i).getType() == Message.TYPE_STATUS) {
|
|
||||||
this.messageList.remove(i);
|
|
||||||
--i;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (this.messageList.get(i).getStatus() == Message.STATUS_RECEIVED) {
|
if (this.messageList.get(i).getStatus() == Message.STATUS_RECEIVED) {
|
||||||
addedStatusMsg = true;
|
return;
|
||||||
} else {
|
} else {
|
||||||
if (this.messageList.get(i).getStatus() == Message.STATUS_SEND_DISPLAYED) {
|
if (this.messageList.get(i).getStatus() == Message.STATUS_SEND_DISPLAYED) {
|
||||||
this.messageList.add(i + 1,
|
this.messageList.add(i + 1,
|
||||||
Message.createStatusMessage(conversation));
|
Message.createStatusMessage(conversation));
|
||||||
addedStatusMsg = true;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue