diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-05-08 14:23:09 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-05-08 14:23:09 +0200 |
commit | 0ed29c1c77c065d73af5c9f1d7769c6c1a1a9c6f (patch) | |
tree | 534e7c11e6ce408efed04764861796d7f84e45b3 /src/eu/siacs/conversations/ui/ConversationFragment.java | |
parent | dc73a25ae4c0729052f858af830707411463e43f (diff) |
more informative dialog if contact doesn't announce public key
Diffstat (limited to '')
-rw-r--r-- | src/eu/siacs/conversations/ui/ConversationFragment.java | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/eu/siacs/conversations/ui/ConversationFragment.java b/src/eu/siacs/conversations/ui/ConversationFragment.java index 33aa5b5cb..e370deb0c 100644 --- a/src/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/eu/siacs/conversations/ui/ConversationFragment.java @@ -718,29 +718,32 @@ public class ConversationFragment extends Fragment { }); } else { - AlertDialog.Builder builder = new AlertDialog.Builder( - getActivity()); - builder.setTitle("No openPGP key found"); - builder.setIconAttribute(android.R.attr.alertDialogIcon); - builder.setMessage("There is no openPGP key associated with this contact"); - builder.setNegativeButton("Cancel", null); - builder.setPositiveButton("Send plain text", - new DialogInterface.OnClickListener() { + showNoPGPKeyDialog(new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, - int which) { - conversation - .setNextEncryption(Message.ENCRYPTION_NONE); - message.setEncryption(Message.ENCRYPTION_NONE); - xmppService.sendMessage(message, null); - chatMsg.setText(""); - } - }); - builder.create().show(); + @Override + public void onClick(DialogInterface dialog, + int which) { + conversation + .setNextEncryption(Message.ENCRYPTION_NONE); + message.setEncryption(Message.ENCRYPTION_NONE); + xmppService.sendMessage(message, null); + chatMsg.setText(""); + } + }); } } } + + public void showNoPGPKeyDialog(DialogInterface.OnClickListener listener) { + AlertDialog.Builder builder = new AlertDialog.Builder( + getActivity()); + builder.setTitle(getString(R.string.no_pgp_key)); + builder.setIconAttribute(android.R.attr.alertDialogIcon); + builder.setMessage(getText(R.string.contact_has_no_pgp_key)); + builder.setNegativeButton(getString(R.string.cancel), null); + builder.setPositiveButton(getString(R.string.send_unencrypted),listener); + builder.create().show(); + } protected void sendOtrMessage(final Message message) { ConversationActivity activity = (ConversationActivity) getActivity(); |