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