simplefied some code that might have been the source for some strange bugs
This commit is contained in:
parent
b23f8bd472
commit
1871521aed
|
@ -135,14 +135,15 @@ public class ConversationFragment extends Fragment {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
MucOptions muc = conversation.getMucOptions();
|
MucOptions muc = conversation.getMucOptions();
|
||||||
String password = muc.getPassword();
|
String password = muc.getPassword();
|
||||||
if (password==null) {
|
if (password == null) {
|
||||||
password = "";
|
password = "";
|
||||||
}
|
}
|
||||||
activity.quickPasswordEdit(password, new OnValueEdited() {
|
activity.quickPasswordEdit(password, new OnValueEdited() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueEdited(String value) {
|
public void onValueEdited(String value) {
|
||||||
activity.xmppConnectionService.providePasswordForMuc(conversation,value);
|
activity.xmppConnectionService.providePasswordForMuc(
|
||||||
|
conversation, value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -177,7 +178,7 @@ public class ConversationFragment extends Fragment {
|
||||||
private ConversationActivity activity;
|
private ConversationActivity activity;
|
||||||
|
|
||||||
private void sendMessage() {
|
private void sendMessage() {
|
||||||
if (this.conversation==null) {
|
if (this.conversation == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mEditMessage.getText().length() < 1) {
|
if (mEditMessage.getText().length() < 1) {
|
||||||
|
@ -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