com.fsck.k9.mail.Address.toString()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中com.fsck.k9.mail.Address.toString()方法的一些代码示例,展示了Address.toString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Address.toString()方法的具体详情如下:
包路径:com.fsck.k9.mail.Address
类名称:Address
方法名:toString

Address.toString介绍

暂无

代码示例

代码示例来源:origin: k9mail/k-9

@NonNull
private Bundle prepareIntentExtras(Recipient recipient) {
  Address address = recipient.address;
  Bundle extras = new Bundle();
  extras.putStringArray(Intent.EXTRA_EMAIL, new String[] { address.toString() });
  extras.putStringArray(Intent.EXTRA_CC, new String[0]);
  extras.putStringArray(Intent.EXTRA_BCC, new String[0]);
  return extras;
}

代码示例来源:origin: k9mail/k-9

private void onAddAddressesToClipboard(Address[] addresses) {
  String addressList = Address.toString(addresses);
  ClipboardManager clipboardManager = ClipboardManager.getInstance(mContext);
  clipboardManager.setText("addresses", addressList);
  Toast.makeText(mContext, createMessage(addresses.length), Toast.LENGTH_LONG).show();
}

代码示例来源:origin: k9mail/k-9

/**
 * Start the activity to add information to an existing contact or add a
 * new one.
 *
 * @param email An {@link Address} instance containing the email address
 *              of the entity you want to add to the contacts. Optionally
 *              the instance also contains the (display) name of that
 *              entity.
 */
public void createContact(final Address email) {
  final Uri contactUri = Uri.fromParts("mailto", email.getAddress(), null);
  final Intent contactIntent = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT);
  contactIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  contactIntent.setData(contactUri);
  // Pass along full email string for possible create dialog
  contactIntent.putExtra(ContactsContract.Intents.EXTRA_CREATE_DESCRIPTION,
      email.toString());
  // Only provide personal name hint if we have one
  final String senderPersonal = email.getPersonal();
  if (senderPersonal != null) {
    contactIntent.putExtra(ContactsContract.Intents.Insert.NAME, senderPersonal);
  }
  mContext.startActivity(contactIntent);
  clearCache();
}

代码示例来源:origin: k9mail/k-9

text.append(resourceProvider.messageHeaderFrom());
text.append(' ');
text.append(Address.toString(from));
text.append("\r\n");
text.append(resourceProvider.messageHeaderTo());
text.append(' ');
text.append(Address.toString(to));
text.append("\r\n");
text.append(resourceProvider.messageHeaderCc());
text.append(' ');
text.append(Address.toString(cc));
text.append("\r\n");

代码示例来源:origin: k9mail/k-9

public void addBccAddresses(Address... bccRecipients) {
  if (bccRecipients.length > 0) {
    addRecipientsFromAddresses(RecipientType.BCC, bccRecipients);
    String bccAddress = account.getAlwaysBcc();
    // If the auto-bcc is the only entry in the BCC list, don't show the Bcc fields.
    boolean alreadyVisible = recipientMvpView.isBccVisible();
    boolean singleBccRecipientFromAccount =
        bccRecipients.length == 1 && bccRecipients[0].toString().equals(bccAddress);
    recipientMvpView.setBccVisibility(alreadyVisible || !singleBccRecipientFromAccount);
    updateRecipientExpanderVisibility();
  }
}

代码示例来源:origin: k9mail/k-9

String[] senders = new String[from.length];
for (int i = 0; i < from.length; i++) {
  senders[i] = from[i].toString();
String[] recipientsTo = new String[to.length];
for (int i = 0; i < to.length; i++) {
  recipientsTo[i] = to[i].toString();
String[] recipientsCc = new String[cc.length];
for (int i = 0; i < cc.length; i++) {
  recipientsCc[i] = cc[i].toString();

代码示例来源:origin: k9mail/k-9

String fromAddress = Address.toString(originalMessage.getFrom());
if (quoteStyle == QuoteStyle.PREFIX) {
  StringBuilder header = new StringBuilder(QuoteHelper.QUOTE_BUFFER_LENGTH);
        .append(HtmlConverter.textToHtmlFragment(Address.toString(originalMessage.getRecipients(RecipientType.TO))))
        .append("<br>\r\n");
        .append(HtmlConverter.textToHtmlFragment(Address.toString(originalMessage.getRecipients(RecipientType.CC))))
        .append("<br>\r\n");

代码示例来源:origin: k9mail/k-9

private void setupQueryCryptoProvider(String queriedAddress, Address... contactAddresses) {
  MatrixCursor cursor = new MatrixCursor(PROJECTION_CRYPTO_ADDRESSES);
  for (Address contactAddress : contactAddresses) {
    cursor.addRow(new String[] { queriedAddress, contactAddress.toString() });
  }
  when(contentResolver
      .query(eq(Uri.parse("content://" + CRYPTO_PROVIDER + ".provider.exported/autocrypt_status")),
          aryEq(PROJECTION_CRYPTO_ADDRESSES), nullable(String.class),
          aryEq(new String[] { queriedAddress }),
          nullable(String.class))).thenReturn(cursor);
}

代码示例来源:origin: k9mail/k-9

if (from != null && from.length > 0) {
  addTableRow(html, resourceProvider.messageHeaderFrom(),
      Address.toString(from));
if (to != null && to.length > 0) {
  addTableRow(html, resourceProvider.messageHeaderTo(),
      Address.toString(to));
if (cc != null && cc.length > 0) {
  addTableRow(html, resourceProvider.messageHeaderCc(),
      Address.toString(cc));

代码示例来源:origin: jberkel/sms-backup-plus

@Test public void shouldGetAddressMissingNumber_Number() throws Exception {
  PersonRecord record = new PersonRecord(1, "John Appleseed", "john@appleseed.com", null);
  assertThat(record.getAddress(NUMBER).toString()).isEqualTo(
      "Unknown <john@appleseed.com>");
}

代码示例来源:origin: jberkel/sms-backup-plus

@Test public void shouldQuoteLocalPart_Name() throws Exception {
  PersonRecord record = new PersonRecord(1, null, null, "name with space");
  assertThat(record.getAddress(NAME).toString()).isEqualTo(
      "name with space <\"name with space\"@unknown.email>");
}

代码示例来源:origin: jberkel/sms-backup-plus

private void assertMessage(Message message) {
  assertThat(message).isNotNull();
  assertThat(message.getSubject()).isEqualTo("Call with Test Testor");
  assertThat(message.getFrom()[0].toString()).isEqualTo("Test Testor <unknown.number@unknown.email>");
  assertThat(message.getRecipients(Message.RecipientType.TO)[0]).isEqualTo(me);
}

代码示例来源:origin: jberkel/sms-backup-plus

@Test public void shouldGetAddressName() throws Exception {
  PersonRecord record = new PersonRecord(1, "John Appleseed", "john@appleseed.com", "+141543432");
  assertThat(record.getAddress(NAME).toString()).isEqualTo(
      "John Appleseed <john@appleseed.com>");
}

代码示例来源:origin: jberkel/sms-backup-plus

@Test public void shouldGetAddressMissingNumber_NameAndNumber() throws Exception {
  PersonRecord record = new PersonRecord(1, "John Appleseed", "john@appleseed.com", null);
  assertThat(record.getAddress(NAME_AND_NUMBER).toString()).isEqualTo(
      "\"John Appleseed (Unknown)\" <john@appleseed.com>");
}

代码示例来源:origin: jberkel/sms-backup-plus

@Test public void shouldGetAddressMissingNumber_Name() throws Exception {
  PersonRecord record = new PersonRecord(1, "John Appleseed", "john@appleseed.com", null);
  assertThat(record.getAddress(NAME).toString()).isEqualTo(
      "John Appleseed <john@appleseed.com>");
}

代码示例来源:origin: jberkel/sms-backup-plus

@Test public void shouldGetAddressMissingEmail_Number() throws Exception {
  PersonRecord record = new PersonRecord(1, "John Appleseed", null, "+141543432");
  assertThat(record.getAddress(NUMBER).toString()).isEqualTo(
      "+141543432 <+141543432@unknown.email>");
}

代码示例来源:origin: jberkel/sms-backup-plus

@Test public void shouldQuoteLocalPart_Number() throws Exception {
    PersonRecord record = new PersonRecord(1, null, null, "name with space");
    assertThat(record.getAddress(NUMBER).toString()).isEqualTo(
        "name with space <\"name with space\"@unknown.email>");
  }
}

代码示例来源:origin: jberkel/sms-backup-plus

@Test public void shouldGenerateCorrectToHeader() throws Exception {
  PersonRecord record = new PersonRecord(1, "Test Testor", "test@test.com", "1234");
  Message msg = generator.messageForDataType(mockMessage("1234", record), DataType.SMS);
  assertThat(msg).isNotNull();
  assertThat(msg.getRecipients(Message.RecipientType.TO)[0].toString())
      .isEqualTo("Test Testor <test@test.com>");
}

代码示例来源:origin: jberkel/sms-backup-plus

@Test public void testShouldGenerateMessageForCallLogIncomingUnknown() throws Exception {
  PersonRecord record = new PersonRecord(0, null, null, "-1");
  Message msg = generator.messageForDataType(mockCalllogMessage("", INCOMING_TYPE, record), CALLLOG);
  assertThat(msg).isNotNull();
  assertThat(msg.getSubject()).isEqualTo("Call with Unknown");
  assertThat(msg.getFrom()[0].toString()).isEqualTo("Unknown <unknown.number@unknown.email>");
  assertThat(msg.getRecipients(Message.RecipientType.TO)[0]).isEqualTo(me);
}

代码示例来源:origin: jberkel/sms-backup-plus

@Test public void testShouldGenerateMessageForCallLogOutgoing() throws Exception {
  PersonRecord record = new PersonRecord(-1, "Test Testor", null, null);
  Message msg = generator.messageForDataType(mockCalllogMessage("1234", OUTGOING_TYPE, record), CALLLOG);
  assertThat(msg).isNotNull();
  assertThat(msg.getSubject()).isEqualTo("Call with Test Testor");
  assertThat(msg.getFrom()[0]).isEqualTo(me);
  assertThat(msg.getRecipients(Message.RecipientType.TO)[0].toString()).isEqualTo("Test Testor <unknown.number@unknown.email>");
}

相关文章