private void handleStartSecureSession() { if (getRecipients() == null) { Toast.makeText( this, getString(R.string.ConversationActivity_invalid_recipient), Toast.LENGTH_LONG) .show(); return; } final Recipient recipient = getRecipients().getPrimaryRecipient(); String recipientName = (recipient.getName() == null ? recipient.getNumber() : recipient.getName()); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.ConversationActivity_initiate_secure_session_question); builder.setIcon(Dialogs.resolveIcon(this, R.attr.dialog_info_icon)); builder.setCancelable(true); builder.setMessage( String.format( getString(R.string.ConversationActivity_initiate_secure_session_with_s_question), recipientName)); builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { KeyExchangeInitiator.initiate(ConversationActivity.this, masterSecret, recipient, true); } }); builder.setNegativeButton(R.string.no, null); builder.show(); }
private void setRecipientTitle(Recipient recipient) { if (!recipient.isGroupRecipient()) { if (TextUtils.isEmpty(recipient.getName())) { this.title.setText(recipient.getNumber()); this.subtitle.setText(null); this.subtitle.setVisibility(View.GONE); } else { this.title.setText(recipient.getName()); this.subtitle.setText(recipient.getNumber()); this.subtitle.setVisibility(View.VISIBLE); } } else { String groupName = (!TextUtils.isEmpty(recipient.getName())) ? recipient.getName() : getContext().getString(R.string.ConversationActivity_unnamed_group); this.title.setText(groupName); this.subtitle.setText(null); this.subtitle.setVisibility(View.GONE); } }