made lock button reflect encryption status of the next messages instead of the last
This commit is contained in:
parent
58bc4cba06
commit
558d065d48
|
@ -374,8 +374,7 @@ public class ConversationActivity extends XmppActivity
|
||||||
} else {
|
} else {
|
||||||
menuAdd.setVisible(!isConversationsOverviewHideable());
|
menuAdd.setVisible(!isConversationsOverviewHideable());
|
||||||
if (this.getSelectedConversation() != null) {
|
if (this.getSelectedConversation() != null) {
|
||||||
if (this.getSelectedConversation().getLatestMessage()
|
if (this.getSelectedConversation().getNextEncryption(forceEncryption()) != Message.ENCRYPTION_NONE) {
|
||||||
.getEncryption() != Message.ENCRYPTION_NONE) {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
menuSecure.setIcon(R.drawable.ic_lock_white_24dp);
|
menuSecure.setIcon(R.drawable.ic_lock_white_24dp);
|
||||||
} else {
|
} else {
|
||||||
|
@ -740,14 +739,11 @@ public class ConversationActivity extends XmppActivity
|
||||||
break;
|
break;
|
||||||
case R.id.encryption_choice_pgp:
|
case R.id.encryption_choice_pgp:
|
||||||
if (hasPgp()) {
|
if (hasPgp()) {
|
||||||
if (conversation.getAccount().getKeys()
|
if (conversation.getAccount().getKeys().has("pgp_signature")) {
|
||||||
.has("pgp_signature")) {
|
conversation.setNextEncryption(Message.ENCRYPTION_PGP);
|
||||||
conversation
|
|
||||||
.setNextEncryption(Message.ENCRYPTION_PGP);
|
|
||||||
item.setChecked(true);
|
item.setChecked(true);
|
||||||
} else {
|
} else {
|
||||||
announcePgp(conversation.getAccount(),
|
announcePgp(conversation.getAccount(),conversation);
|
||||||
conversation);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showInstallPgpDialog();
|
showInstallPgpDialog();
|
||||||
|
@ -757,16 +753,16 @@ public class ConversationActivity extends XmppActivity
|
||||||
conversation.setNextEncryption(Message.ENCRYPTION_NONE);
|
conversation.setNextEncryption(Message.ENCRYPTION_NONE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
xmppConnectionService.databaseBackend
|
xmppConnectionService.databaseBackend.updateConversation(conversation);
|
||||||
.updateConversation(conversation);
|
|
||||||
fragment.updateChatMsgHint();
|
fragment.updateChatMsgHint();
|
||||||
|
invalidateOptionsMenu();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popup.inflate(R.menu.encryption_choices);
|
popup.inflate(R.menu.encryption_choices);
|
||||||
MenuItem otr = popup.getMenu().findItem(R.id.encryption_choice_otr);
|
MenuItem otr = popup.getMenu().findItem(R.id.encryption_choice_otr);
|
||||||
MenuItem none = popup.getMenu().findItem(
|
MenuItem none = popup.getMenu().findItem(R.id.encryption_choice_none);
|
||||||
R.id.encryption_choice_none);
|
MenuItem pgp = popup.getMenu().findItem(R.id.encryption_choice_pgp);
|
||||||
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
if (conversation.getMode() == Conversation.MODE_MULTI) {
|
||||||
otr.setEnabled(false);
|
otr.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -782,12 +778,10 @@ public class ConversationActivity extends XmppActivity
|
||||||
otr.setChecked(true);
|
otr.setChecked(true);
|
||||||
break;
|
break;
|
||||||
case Message.ENCRYPTION_PGP:
|
case Message.ENCRYPTION_PGP:
|
||||||
popup.getMenu().findItem(R.id.encryption_choice_pgp)
|
pgp.setChecked(true);
|
||||||
.setChecked(true);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
popup.getMenu().findItem(R.id.encryption_choice_none)
|
none.setChecked(true);
|
||||||
.setChecked(true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
popup.show();
|
popup.show();
|
||||||
|
|
Loading…
Reference in a new issue