update conversation in database background thread
This commit is contained in:
parent
50780debf7
commit
7226fc0010
|
@ -1610,7 +1610,7 @@ public class XmppConnectionService extends Service {
|
|||
);
|
||||
}
|
||||
}
|
||||
this.databaseBackend.updateConversation(conversation);
|
||||
updateConversation(conversation);
|
||||
this.conversations.remove(conversation);
|
||||
updateConversationUi();
|
||||
}
|
||||
|
@ -2140,7 +2140,7 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
pushBookmarks(conversation.getAccount());
|
||||
}
|
||||
databaseBackend.updateConversation(conversation);
|
||||
updateConversation(conversation);
|
||||
joinMuc(conversation);
|
||||
}
|
||||
}
|
||||
|
@ -2860,8 +2860,13 @@ public class XmppConnectionService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
public void updateConversation(Conversation conversation) {
|
||||
this.databaseBackend.updateConversation(conversation);
|
||||
public void updateConversation(final Conversation conversation) {
|
||||
mDatabaseExecutor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
databaseBackend.updateConversation(conversation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void reconnectAccount(final Account account, final boolean force, final boolean interactive) {
|
||||
|
|
|
@ -611,10 +611,8 @@ public class ConversationActivity extends XmppActivity
|
|||
@Override
|
||||
public void onClick(DialogInterface dialog,
|
||||
int which) {
|
||||
conversation
|
||||
.setNextEncryption(Message.ENCRYPTION_NONE);
|
||||
xmppConnectionService.databaseBackend
|
||||
.updateConversation(conversation);
|
||||
conversation.setNextEncryption(Message.ENCRYPTION_NONE);
|
||||
xmppConnectionService.updateConversation(conversation);
|
||||
selectPresenceToAttachFile(attachmentChoice, Message.ENCRYPTION_NONE);
|
||||
}
|
||||
});
|
||||
|
@ -888,7 +886,7 @@ public class ConversationActivity extends XmppActivity
|
|||
conversation.setNextEncryption(Message.ENCRYPTION_NONE);
|
||||
break;
|
||||
}
|
||||
xmppConnectionService.databaseBackend.updateConversation(conversation);
|
||||
xmppConnectionService.updateConversation(conversation);
|
||||
fragment.updateChatMsgHint();
|
||||
invalidateOptionsMenu();
|
||||
refreshUi();
|
||||
|
@ -947,8 +945,7 @@ public class ConversationActivity extends XmppActivity
|
|||
till = System.currentTimeMillis() + (durations[which] * 1000);
|
||||
}
|
||||
conversation.setMutedTill(till);
|
||||
ConversationActivity.this.xmppConnectionService.databaseBackend
|
||||
.updateConversation(conversation);
|
||||
ConversationActivity.this.xmppConnectionService.updateConversation(conversation);
|
||||
updateConversationList();
|
||||
ConversationActivity.this.mConversationFragment.updateMessages();
|
||||
invalidateOptionsMenu();
|
||||
|
@ -959,7 +956,7 @@ public class ConversationActivity extends XmppActivity
|
|||
|
||||
public void unmuteConversation(final Conversation conversation) {
|
||||
conversation.setMutedTill(0);
|
||||
this.xmppConnectionService.databaseBackend.updateConversation(conversation);
|
||||
this.xmppConnectionService.updateConversation(conversation);
|
||||
updateConversationList();
|
||||
ConversationActivity.this.mConversationFragment.updateMessages();
|
||||
invalidateOptionsMenu();
|
||||
|
|
|
@ -1262,8 +1262,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
|||
int which) {
|
||||
conversation
|
||||
.setNextEncryption(Message.ENCRYPTION_NONE);
|
||||
xmppService.databaseBackend
|
||||
.updateConversation(conversation);
|
||||
xmppService.updateConversation(conversation);
|
||||
message.setEncryption(Message.ENCRYPTION_NONE);
|
||||
xmppService.sendMessage(message);
|
||||
messageSent();
|
||||
|
@ -1291,8 +1290,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
|||
conversation
|
||||
.setNextEncryption(Message.ENCRYPTION_NONE);
|
||||
message.setEncryption(Message.ENCRYPTION_NONE);
|
||||
xmppService.databaseBackend
|
||||
.updateConversation(conversation);
|
||||
xmppService.updateConversation(conversation);
|
||||
xmppService.sendMessage(message);
|
||||
messageSent();
|
||||
}
|
||||
|
|
|
@ -574,7 +574,7 @@ public abstract class XmppActivity extends Activity {
|
|||
xmppConnectionService.sendPresence(account);
|
||||
if (conversation != null) {
|
||||
conversation.setNextEncryption(Message.ENCRYPTION_PGP);
|
||||
xmppConnectionService.databaseBackend.updateConversation(conversation);
|
||||
xmppConnectionService.updateConversation(conversation);
|
||||
refreshUi();
|
||||
}
|
||||
if (onSuccess != null) {
|
||||
|
|
|
@ -450,7 +450,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||
|
||||
private void loadMoreMessages(Conversation conversation) {
|
||||
conversation.setLastClearHistory(0);
|
||||
activity.xmppConnectionService.databaseBackend.updateConversation(conversation);
|
||||
activity.xmppConnectionService.updateConversation(conversation);
|
||||
conversation.setHasMessagesLeftOnServer(true);
|
||||
conversation.setFirstMamReference(null);
|
||||
long timestamp = conversation.getLastMessageTransmitted();
|
||||
|
|
Loading…
Reference in New Issue