EditAccountActivity.java

  1package eu.siacs.conversations.ui;
  2
  3import android.app.AlertDialog.Builder;
  4import android.app.PendingIntent;
  5import android.content.DialogInterface;
  6import android.content.Intent;
  7import android.os.Bundle;
  8import android.text.Editable;
  9import android.text.TextUtils;
 10import android.text.TextWatcher;
 11import android.view.Menu;
 12import android.view.MenuItem;
 13import android.view.View;
 14import android.view.View.OnClickListener;
 15import android.widget.AutoCompleteTextView;
 16import android.widget.Button;
 17import android.widget.CheckBox;
 18import android.widget.CompoundButton;
 19import android.widget.CompoundButton.OnCheckedChangeListener;
 20import android.widget.EditText;
 21import android.widget.ImageButton;
 22import android.widget.ImageView;
 23import android.widget.LinearLayout;
 24import android.widget.RelativeLayout;
 25import android.widget.TableLayout;
 26import android.widget.TextView;
 27import android.widget.Toast;
 28
 29import java.util.Set;
 30
 31import eu.siacs.conversations.R;
 32import eu.siacs.conversations.entities.Account;
 33import eu.siacs.conversations.services.XmppConnectionService.OnAccountUpdate;
 34import eu.siacs.conversations.ui.adapter.KnownHostsAdapter;
 35import eu.siacs.conversations.utils.CryptoHelper;
 36import eu.siacs.conversations.utils.UIHelper;
 37import eu.siacs.conversations.xmpp.XmppConnection.Features;
 38import eu.siacs.conversations.xmpp.jid.InvalidJidException;
 39import eu.siacs.conversations.xmpp.jid.Jid;
 40import eu.siacs.conversations.xmpp.pep.Avatar;
 41
 42public class EditAccountActivity extends XmppActivity implements OnAccountUpdate{
 43
 44	private AutoCompleteTextView mAccountJid;
 45	private EditText mPassword;
 46	private EditText mPasswordConfirm;
 47	private CheckBox mRegisterNew;
 48	private Button mCancelButton;
 49	private Button mSaveButton;
 50	private TableLayout mMoreTable;
 51
 52	private LinearLayout mStats;
 53	private TextView mServerInfoSm;
 54	private TextView mServerInfoRosterVersion;
 55	private TextView mServerInfoCarbons;
 56	private TextView mServerInfoMam;
 57	private TextView mServerInfoCSI;
 58	private TextView mServerInfoBlocking;
 59	private TextView mServerInfoPep;
 60	private TextView mSessionEst;
 61	private TextView mOtrFingerprint;
 62	private TextView mAxolotlFingerprint;
 63	private TextView mAxolotlDevicelist;
 64	private ImageView mAvatar;
 65	private RelativeLayout mOtrFingerprintBox;
 66	private RelativeLayout mAxolotlFingerprintBox;
 67	private RelativeLayout mAxolotlDevicelistBox;
 68	private ImageButton mOtrFingerprintToClipboardButton;
 69	private ImageButton mAxolotlFingerprintToClipboardButton;
 70	private ImageButton mWipeAxolotlPepButton;
 71	private ImageButton mRegenerateAxolotlKeyButton;
 72
 73	private Jid jidToEdit;
 74	private Account mAccount;
 75
 76	private boolean mFetchingAvatar = false;
 77
 78	private final OnClickListener mSaveButtonClickListener = new OnClickListener() {
 79
 80		@Override
 81		public void onClick(final View v) {
 82			if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED && !accountInfoEdited()) {
 83				mAccount.setOption(Account.OPTION_DISABLED, false);
 84				xmppConnectionService.updateAccount(mAccount);
 85				return;
 86			}
 87			final boolean registerNewAccount = mRegisterNew.isChecked();
 88			final Jid jid;
 89			try {
 90				jid = Jid.fromString(mAccountJid.getText().toString());
 91			} catch (final InvalidJidException e) {
 92				mAccountJid.setError(getString(R.string.invalid_jid));
 93				mAccountJid.requestFocus();
 94				return;
 95			}
 96			if (jid.isDomainJid()) {
 97				mAccountJid.setError(getString(R.string.invalid_jid));
 98				mAccountJid.requestFocus();
 99				return;
100			}
101			final String password = mPassword.getText().toString();
102			final String passwordConfirm = mPasswordConfirm.getText().toString();
103			if (registerNewAccount) {
104				if (!password.equals(passwordConfirm)) {
105					mPasswordConfirm.setError(getString(R.string.passwords_do_not_match));
106					mPasswordConfirm.requestFocus();
107					return;
108				}
109			}
110			if (mAccount != null) {
111				try {
112					mAccount.setUsername(jid.hasLocalpart() ? jid.getLocalpart() : "");
113					mAccount.setServer(jid.getDomainpart());
114				} catch (final InvalidJidException ignored) {
115					return;
116				}
117				mAccountJid.setError(null);
118				mPasswordConfirm.setError(null);
119				mAccount.setPassword(password);
120				mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount);
121				xmppConnectionService.updateAccount(mAccount);
122			} else {
123				try {
124					if (xmppConnectionService.findAccountByJid(Jid.fromString(mAccountJid.getText().toString())) != null) {
125						mAccountJid.setError(getString(R.string.account_already_exists));
126						mAccountJid.requestFocus();
127						return;
128					}
129				} catch (final InvalidJidException e) {
130					return;
131				}
132				mAccount = new Account(jid.toBareJid(), password);
133				mAccount.setOption(Account.OPTION_USETLS, true);
134				mAccount.setOption(Account.OPTION_USECOMPRESSION, true);
135				mAccount.setOption(Account.OPTION_REGISTER, registerNewAccount);
136				xmppConnectionService.createAccount(mAccount);
137			}
138			if (jidToEdit != null && !mAccount.isOptionSet(Account.OPTION_DISABLED)) {
139				finish();
140			} else {
141				updateSaveButton();
142				updateAccountInformation(true);
143			}
144
145		}
146	};
147	private final OnClickListener mCancelButtonClickListener = new OnClickListener() {
148
149		@Override
150		public void onClick(final View v) {
151			finish();
152		}
153	};
154	@Override
155	public void onAccountUpdate() {
156		runOnUiThread(new Runnable() {
157
158			@Override
159			public void run() {
160				invalidateOptionsMenu();
161				if (mAccount != null
162						&& mAccount.getStatus() != Account.State.ONLINE
163						&& mFetchingAvatar) {
164					startActivity(new Intent(getApplicationContext(),
165								ManageAccountActivity.class));
166					finish();
167				} else if (jidToEdit == null && mAccount != null
168						&& mAccount.getStatus() == Account.State.ONLINE) {
169					if (!mFetchingAvatar) {
170						mFetchingAvatar = true;
171						xmppConnectionService.checkForAvatar(mAccount,
172								mAvatarFetchCallback);
173					}
174				} else {
175					updateSaveButton();
176				}
177				if (mAccount != null) {
178					updateAccountInformation(false);
179				}
180			}
181		});
182	}
183	private final UiCallback<Avatar> mAvatarFetchCallback = new UiCallback<Avatar>() {
184
185		@Override
186		public void userInputRequried(final PendingIntent pi, final Avatar avatar) {
187			finishInitialSetup(avatar);
188		}
189
190		@Override
191		public void success(final Avatar avatar) {
192			finishInitialSetup(avatar);
193		}
194
195		@Override
196		public void error(final int errorCode, final Avatar avatar) {
197			finishInitialSetup(avatar);
198		}
199	};
200	private final TextWatcher mTextWatcher = new TextWatcher() {
201
202		@Override
203		public void onTextChanged(final CharSequence s, final int start, final int before, final int count) {
204			updateSaveButton();
205		}
206
207		@Override
208		public void beforeTextChanged(final CharSequence s, final int start, final int count, final int after) {
209		}
210
211		@Override
212		public void afterTextChanged(final Editable s) {
213
214		}
215	};
216
217	private final OnClickListener mAvatarClickListener = new OnClickListener() {
218		@Override
219		public void onClick(final View view) {
220			if (mAccount != null) {
221				final Intent intent = new Intent(getApplicationContext(),
222						PublishProfilePictureActivity.class);
223				intent.putExtra("account", mAccount.getJid().toBareJid().toString());
224				startActivity(intent);
225			}
226		}
227	};
228
229	protected void finishInitialSetup(final Avatar avatar) {
230		runOnUiThread(new Runnable() {
231
232			@Override
233			public void run() {
234				final Intent intent;
235				if (avatar != null) {
236					intent = new Intent(getApplicationContext(),
237							StartConversationActivity.class);
238					if (xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1) {
239						intent.putExtra("init", true);
240					}
241				} else {
242					intent = new Intent(getApplicationContext(),
243							PublishProfilePictureActivity.class);
244					intent.putExtra("account", mAccount.getJid().toBareJid().toString());
245					intent.putExtra("setup", true);
246				}
247				startActivity(intent);
248				finish();
249			}
250		});
251	}
252
253	protected void updateSaveButton() {
254		if (accountInfoEdited() && jidToEdit != null) {
255			this.mSaveButton.setText(R.string.save);
256			this.mSaveButton.setEnabled(true);
257			this.mSaveButton.setTextColor(getPrimaryTextColor());
258		} else if (mAccount != null && (mAccount.getStatus() == Account.State.CONNECTING || mFetchingAvatar)) {
259			this.mSaveButton.setEnabled(false);
260			this.mSaveButton.setTextColor(getSecondaryTextColor());
261			this.mSaveButton.setText(R.string.account_status_connecting);
262		} else if (mAccount != null && mAccount.getStatus() == Account.State.DISABLED) {
263			this.mSaveButton.setEnabled(true);
264			this.mSaveButton.setTextColor(getPrimaryTextColor());
265			this.mSaveButton.setText(R.string.enable);
266		} else {
267			this.mSaveButton.setEnabled(true);
268			this.mSaveButton.setTextColor(getPrimaryTextColor());
269			if (jidToEdit != null) {
270				if (mAccount != null && mAccount.isOnlineAndConnected()) {
271					this.mSaveButton.setText(R.string.save);
272					if (!accountInfoEdited()) {
273						this.mSaveButton.setEnabled(false);
274						this.mSaveButton.setTextColor(getSecondaryTextColor());
275					}
276				} else {
277					this.mSaveButton.setText(R.string.connect);
278				}
279			} else {
280				this.mSaveButton.setText(R.string.next);
281			}
282		}
283	}
284
285	protected boolean accountInfoEdited() {
286		return this.mAccount != null && (!this.mAccount.getJid().toBareJid().toString().equals(
287					this.mAccountJid.getText().toString())
288			|| !this.mAccount.getPassword().equals(
289						this.mPassword.getText().toString()));
290	}
291
292	@Override
293	protected String getShareableUri() {
294		if (mAccount!=null) {
295			return mAccount.getShareableUri();
296		} else {
297			return "";
298		}
299	}
300
301	@Override
302	protected void onCreate(final Bundle savedInstanceState) {
303		super.onCreate(savedInstanceState);
304		setContentView(R.layout.activity_edit_account);
305		this.mAccountJid = (AutoCompleteTextView) findViewById(R.id.account_jid);
306		this.mAccountJid.addTextChangedListener(this.mTextWatcher);
307		this.mPassword = (EditText) findViewById(R.id.account_password);
308		this.mPassword.addTextChangedListener(this.mTextWatcher);
309		this.mPasswordConfirm = (EditText) findViewById(R.id.account_password_confirm);
310		this.mAvatar = (ImageView) findViewById(R.id.avater);
311		this.mAvatar.setOnClickListener(this.mAvatarClickListener);
312		this.mRegisterNew = (CheckBox) findViewById(R.id.account_register_new);
313		this.mStats = (LinearLayout) findViewById(R.id.stats);
314		this.mSessionEst = (TextView) findViewById(R.id.session_est);
315		this.mServerInfoRosterVersion = (TextView) findViewById(R.id.server_info_roster_version);
316		this.mServerInfoCarbons = (TextView) findViewById(R.id.server_info_carbons);
317		this.mServerInfoMam = (TextView) findViewById(R.id.server_info_mam);
318		this.mServerInfoCSI = (TextView) findViewById(R.id.server_info_csi);
319		this.mServerInfoBlocking = (TextView) findViewById(R.id.server_info_blocking);
320		this.mServerInfoSm = (TextView) findViewById(R.id.server_info_sm);
321		this.mServerInfoPep = (TextView) findViewById(R.id.server_info_pep);
322		this.mOtrFingerprint = (TextView) findViewById(R.id.otr_fingerprint);
323		this.mOtrFingerprintBox = (RelativeLayout) findViewById(R.id.otr_fingerprint_box);
324		this.mOtrFingerprintToClipboardButton = (ImageButton) findViewById(R.id.action_copy_to_clipboard);
325		this.mAxolotlFingerprint = (TextView) findViewById(R.id.axolotl_fingerprint);
326		this.mAxolotlFingerprintBox = (RelativeLayout) findViewById(R.id.axolotl_fingerprint_box);
327		this.mAxolotlFingerprintToClipboardButton = (ImageButton) findViewById(R.id.action_copy_to_clipboard);
328		this.mRegenerateAxolotlKeyButton = (ImageButton) findViewById(R.id.action_regenerate_axolotl_key);
329		this.mAxolotlDevicelist = (TextView) findViewById(R.id.axolotl_devicelist);
330		this.mAxolotlDevicelistBox = (RelativeLayout) findViewById(R.id.axolotl_devices_box);
331		this.mWipeAxolotlPepButton = (ImageButton) findViewById(R.id.action_wipe_axolotl_pep);
332		this.mSaveButton = (Button) findViewById(R.id.save_button);
333		this.mCancelButton = (Button) findViewById(R.id.cancel_button);
334		this.mSaveButton.setOnClickListener(this.mSaveButtonClickListener);
335		this.mCancelButton.setOnClickListener(this.mCancelButtonClickListener);
336		this.mMoreTable = (TableLayout) findViewById(R.id.server_info_more);
337		final OnCheckedChangeListener OnCheckedShowConfirmPassword = new OnCheckedChangeListener() {
338			@Override
339			public void onCheckedChanged(final CompoundButton buttonView,
340					final boolean isChecked) {
341				if (isChecked) {
342					mPasswordConfirm.setVisibility(View.VISIBLE);
343				} else {
344					mPasswordConfirm.setVisibility(View.GONE);
345				}
346				updateSaveButton();
347			}
348		};
349		this.mRegisterNew.setOnCheckedChangeListener(OnCheckedShowConfirmPassword);
350	}
351
352	@Override
353	public boolean onCreateOptionsMenu(final Menu menu) {
354		super.onCreateOptionsMenu(menu);
355		getMenuInflater().inflate(R.menu.editaccount, menu);
356		final MenuItem showQrCode = menu.findItem(R.id.action_show_qr_code);
357		final MenuItem showBlocklist = menu.findItem(R.id.action_show_block_list);
358		final MenuItem showMoreInfo = menu.findItem(R.id.action_server_info_show_more);
359		final MenuItem changePassword = menu.findItem(R.id.action_change_password_on_server);
360		if (mAccount != null && mAccount.isOnlineAndConnected()) {
361			if (!mAccount.getXmppConnection().getFeatures().blocking()) {
362				showBlocklist.setVisible(false);
363			}
364			if (!mAccount.getXmppConnection().getFeatures().register()) {
365				changePassword.setVisible(false);
366			}
367		} else {
368			showQrCode.setVisible(false);
369			showBlocklist.setVisible(false);
370			showMoreInfo.setVisible(false);
371			changePassword.setVisible(false);
372		}
373		return true;
374	}
375
376	@Override
377	protected void onStart() {
378		super.onStart();
379		if (getIntent() != null) {
380			try {
381				this.jidToEdit = Jid.fromString(getIntent().getStringExtra("jid"));
382			} catch (final InvalidJidException | NullPointerException ignored) {
383				this.jidToEdit = null;
384			}
385			if (this.jidToEdit != null) {
386				this.mRegisterNew.setVisibility(View.GONE);
387				if (getActionBar() != null) {
388					getActionBar().setTitle(getString(R.string.account_details));
389				}
390			} else {
391				this.mAvatar.setVisibility(View.GONE);
392				if (getActionBar() != null) {
393					getActionBar().setTitle(R.string.action_add_account);
394				}
395			}
396		}
397	}
398
399	@Override
400	protected void onBackendConnected() {
401		final KnownHostsAdapter mKnownHostsAdapter = new KnownHostsAdapter(this,
402				android.R.layout.simple_list_item_1,
403				xmppConnectionService.getKnownHosts());
404		if (this.jidToEdit != null) {
405			this.mAccount = xmppConnectionService.findAccountByJid(jidToEdit);
406			updateAccountInformation(true);
407		} else if (this.xmppConnectionService.getAccounts().size() == 0) {
408			if (getActionBar() != null) {
409				getActionBar().setDisplayHomeAsUpEnabled(false);
410				getActionBar().setDisplayShowHomeEnabled(false);
411				getActionBar().setHomeButtonEnabled(false);
412			}
413			this.mCancelButton.setEnabled(false);
414			this.mCancelButton.setTextColor(getSecondaryTextColor());
415		}
416		this.mAccountJid.setAdapter(mKnownHostsAdapter);
417		updateSaveButton();
418	}
419
420	@Override
421	public boolean onOptionsItemSelected(final MenuItem item) {
422		switch (item.getItemId()) {
423			case R.id.action_show_block_list:
424				final Intent showBlocklistIntent = new Intent(this, BlocklistActivity.class);
425				showBlocklistIntent.putExtra("account", mAccount.getJid().toString());
426				startActivity(showBlocklistIntent);
427				break;
428			case R.id.action_server_info_show_more:
429				mMoreTable.setVisibility(item.isChecked() ? View.GONE : View.VISIBLE);
430				item.setChecked(!item.isChecked());
431				break;
432			case R.id.action_change_password_on_server:
433				final Intent changePasswordIntent = new Intent(this, ChangePasswordActivity.class);
434				changePasswordIntent.putExtra("account", mAccount.getJid().toString());
435				startActivity(changePasswordIntent);
436				break;
437		}
438		return super.onOptionsItemSelected(item);
439	}
440
441	private void updateAccountInformation(boolean init) {
442		if (init) {
443			this.mAccountJid.setText(this.mAccount.getJid().toBareJid().toString());
444			this.mPassword.setText(this.mAccount.getPassword());
445		}
446		if (this.jidToEdit != null) {
447			this.mAvatar.setVisibility(View.VISIBLE);
448			this.mAvatar.setImageBitmap(avatarService().get(this.mAccount, getPixel(72)));
449		}
450		if (this.mAccount.isOptionSet(Account.OPTION_REGISTER)) {
451			this.mRegisterNew.setVisibility(View.VISIBLE);
452			this.mRegisterNew.setChecked(true);
453			this.mPasswordConfirm.setText(this.mAccount.getPassword());
454		} else {
455			this.mRegisterNew.setVisibility(View.GONE);
456			this.mRegisterNew.setChecked(false);
457		}
458		if (this.mAccount.isOnlineAndConnected() && !this.mFetchingAvatar) {
459			this.mStats.setVisibility(View.VISIBLE);
460			this.mSessionEst.setText(UIHelper.readableTimeDifferenceFull(this, this.mAccount.getXmppConnection()
461						.getLastSessionEstablished()));
462			Features features = this.mAccount.getXmppConnection().getFeatures();
463			if (features.rosterVersioning()) {
464				this.mServerInfoRosterVersion.setText(R.string.server_info_available);
465			} else {
466				this.mServerInfoRosterVersion.setText(R.string.server_info_unavailable);
467			}
468			if (features.carbons()) {
469				this.mServerInfoCarbons.setText(R.string.server_info_available);
470			} else {
471				this.mServerInfoCarbons
472					.setText(R.string.server_info_unavailable);
473			}
474			if (features.mam()) {
475				this.mServerInfoMam.setText(R.string.server_info_available);
476			} else {
477				this.mServerInfoMam.setText(R.string.server_info_unavailable);
478			}
479			if (features.csi()) {
480				this.mServerInfoCSI.setText(R.string.server_info_available);
481			} else {
482				this.mServerInfoCSI.setText(R.string.server_info_unavailable);
483			}
484			if (features.blocking()) {
485				this.mServerInfoBlocking.setText(R.string.server_info_available);
486			} else {
487				this.mServerInfoBlocking.setText(R.string.server_info_unavailable);
488			}
489			if (features.sm()) {
490				this.mServerInfoSm.setText(R.string.server_info_available);
491			} else {
492				this.mServerInfoSm.setText(R.string.server_info_unavailable);
493			}
494			if (features.pep()) {
495				this.mServerInfoPep.setText(R.string.server_info_available);
496			} else {
497				this.mServerInfoPep.setText(R.string.server_info_unavailable);
498			}
499			final String otrFingerprint = this.mAccount.getOtrFingerprint();
500			if (otrFingerprint != null) {
501				this.mOtrFingerprintBox.setVisibility(View.VISIBLE);
502				this.mOtrFingerprint.setText(CryptoHelper.prettifyFingerprint(otrFingerprint));
503				this.mOtrFingerprintToClipboardButton
504					.setVisibility(View.VISIBLE);
505				this.mOtrFingerprintToClipboardButton
506					.setOnClickListener(new View.OnClickListener() {
507
508						@Override
509						public void onClick(final View v) {
510
511							if (copyTextToClipboard(otrFingerprint, R.string.otr_fingerprint)) {
512								Toast.makeText(
513										EditAccountActivity.this,
514										R.string.toast_message_otr_fingerprint,
515										Toast.LENGTH_SHORT).show();
516							}
517						}
518					});
519			} else {
520				this.mOtrFingerprintBox.setVisibility(View.GONE);
521			}
522			final Set<Integer> ownDevices = this.mAccount.getAxolotlService().getOwnDeviceIds();
523			if (ownDevices != null && !ownDevices.isEmpty()) {
524				this.mAxolotlDevicelistBox.setVisibility(View.VISIBLE);
525				this.mAxolotlDevicelist.setText(TextUtils.join(", ", ownDevices));
526				this.mWipeAxolotlPepButton
527						.setVisibility(View.VISIBLE);
528				this.mWipeAxolotlPepButton
529						.setOnClickListener(new View.OnClickListener() {
530							@Override
531							public void onClick(final View v) {
532								showWipePepDialog();
533							}
534						});
535			} else {
536				this.mAxolotlDevicelistBox.setVisibility(View.GONE);
537			}
538			final String axolotlFingerprint = this.mAccount.getAxolotlService().getOwnPublicKey().getFingerprint();
539			if (axolotlFingerprint != null) {
540				this.mAxolotlFingerprintBox.setVisibility(View.VISIBLE);
541				this.mAxolotlFingerprint.setText(CryptoHelper.prettifyFingerprint(axolotlFingerprint));
542				this.mAxolotlFingerprintToClipboardButton
543						.setVisibility(View.VISIBLE);
544				this.mAxolotlFingerprintToClipboardButton
545						.setOnClickListener(new View.OnClickListener() {
546
547							@Override
548							public void onClick(final View v) {
549
550								if (copyTextToClipboard(axolotlFingerprint, R.string.axolotl_fingerprint)) {
551									Toast.makeText(
552											EditAccountActivity.this,
553											R.string.toast_message_axolotl_fingerprint,
554											Toast.LENGTH_SHORT).show();
555								}
556							}
557						});
558				this.mRegenerateAxolotlKeyButton
559						.setVisibility(View.VISIBLE);
560				this.mRegenerateAxolotlKeyButton
561						.setOnClickListener(new View.OnClickListener() {
562
563							@Override
564							public void onClick(final View v) {
565								showRegenerateAxolotlKeyDialog();
566							}
567						});
568			} else {
569				this.mAxolotlFingerprintBox.setVisibility(View.GONE);
570			}
571		} else {
572			if (this.mAccount.errorStatus()) {
573				this.mAccountJid.setError(getString(this.mAccount.getStatus().getReadableId()));
574				if (init || !accountInfoEdited()) {
575					this.mAccountJid.requestFocus();
576				}
577			} else {
578				this.mAccountJid.setError(null);
579			}
580			this.mStats.setVisibility(View.GONE);
581		}
582	}
583
584	public void showRegenerateAxolotlKeyDialog() {
585		Builder builder = new Builder(this);
586		builder.setTitle("Regenerate Key");
587		builder.setIconAttribute(android.R.attr.alertDialogIcon);
588		builder.setMessage("Are you sure you want to regenerate your Identity Key? (This will also wipe all established sessions and contact Identity Keys)");
589		builder.setNegativeButton(getString(R.string.cancel), null);
590		builder.setPositiveButton("Yes",
591				new DialogInterface.OnClickListener() {
592					@Override
593					public void onClick(DialogInterface dialog, int which) {
594						mAccount.getAxolotlService().regenerateKeys();
595					}
596				});
597		builder.create().show();
598	}
599
600	public void showWipePepDialog() {
601		Builder builder = new Builder(this);
602		builder.setTitle("Wipe PEP");
603		builder.setIconAttribute(android.R.attr.alertDialogIcon);
604		builder.setMessage("Are you sure you want to wipe all other devices from the PEP device ID list?");
605		builder.setNegativeButton(getString(R.string.cancel), null);
606		builder.setPositiveButton("Yes",
607				new DialogInterface.OnClickListener() {
608					@Override
609					public void onClick(DialogInterface dialog, int which) {
610						mAccount.getAxolotlService().wipeOtherPepDevices();
611					}
612				});
613		builder.create().show();
614	}
615}