simplefied some code that might have been the source for some strange bugs

This commit is contained in:
iNPUTmice 2014-09-08 20:29:57 +02:00
parent b23f8bd472
commit 1871521aed

View file

@ -142,7 +142,8 @@ public class ConversationFragment extends Fragment {
@Override
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;
}
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.getNextPresence() != null) {
message.setPresence(conversation.getNextPresence());
@ -440,15 +442,11 @@ public class ConversationFragment extends Fragment {
break;
}
}
if (this.conversation.getMessages().size() == 0) {
this.messageList.clear();
if (this.conversation.getMessages().size() == 0) {
messagesLoaded = false;
} else {
for (Message message : this.conversation.getMessages()) {
if (!this.messageList.contains(message)) {
this.messageList.add(message);
}
}
this.messageList.addAll(this.conversation.getMessages());
messagesLoaded = true;
updateStatusMessages();
}
@ -500,23 +498,15 @@ public class ConversationFragment extends Fragment {
}
protected void updateStatusMessages() {
boolean addedStatusMsg = false;
if (conversation.getMode() == Conversation.MODE_SINGLE) {
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) {
addedStatusMsg = true;
return;
} else {
if (this.messageList.get(i).getStatus() == Message.STATUS_SEND_DISPLAYED) {
this.messageList.add(i + 1,
Message.createStatusMessage(conversation));
addedStatusMsg = true;
}
return;
}
}
}