当前位置: 首页>>代码示例>>Java>>正文


Java Email类代码示例

本文整理汇总了Java中android.provider.ContactsContract.CommonDataKinds.Email的典型用法代码示例。如果您正苦于以下问题:Java Email类的具体用法?Java Email怎么用?Java Email使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Email类属于android.provider.ContactsContract.CommonDataKinds包,在下文中一共展示了Email类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addEvent

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
public ContactOperations addEvent(String event, int type, String label,
		boolean isPrimary, boolean isSuperPrimary) {
	mValues.clear();
	if (!TextUtils.isEmpty(event)) {
		mValues.put(Event.START_DATE, event);
		mValues.put(Event.TYPE, type);
		mValues.put(Event.MIMETYPE, Event.CONTENT_ITEM_TYPE);
		if (!TextUtils.isEmpty(label)) {
			mValues.put(Event.LABEL, label);
		}
		if (isSuperPrimary) {
			mValues.put(Email.IS_SUPER_PRIMARY, 1);
		}
		if (isPrimary) {
			mValues.put(Email.IS_PRIMARY, 1);
		}

		addInsertOp();
	}
	return this;
}
 
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:22,代码来源:ContactOperations.java

示例2: onClick

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
@Override
public void onClick(View v) {
    // If contact has been assigned, extras should no longer be null, but do a null check
    // anyway just in case assignContactFromPhone or Email was called with a null bundle or
    // wasn't assigned previously.
    final Bundle extras = (this.extras == null) ? new Bundle() : this.extras;
    if (contactUri != null) {
        QuickContact.showQuickContact(getContext(), ContactBadge.this, contactUri,
                QuickContact.MODE_LARGE, null);
    } else if (contactEmail != null) {
        extras.putString(EXTRA_URI_CONTENT, contactEmail);
        queryHandler.startQuery(TOKEN_EMAIL_LOOKUP_AND_TRIGGER, extras,
                Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(contactEmail)),
                EMAIL_LOOKUP_PROJECTION, null, null, null);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:17,代码来源:ContactBadge.java

示例3: fillContactDataFromLookupKey

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
private void fillContactDataFromLookupKey(Uri lookupKeyUri, List<Recipient> recipients,
        Map<String, Recipient> recipientMap) {
    // We could use the contact id from the URI directly, but getting it from the lookup key is safer
    Uri contactContentUri = Contacts.lookupContact(contentResolver, lookupKeyUri);
    if (contactContentUri == null) {
        return;
    }

    String contactIdStr = getContactIdFromContactUri(contactContentUri);

    Cursor cursor = contentResolver.query(
            ContactsContract.CommonDataKinds.Email.CONTENT_URI,
            PROJECTION, ContactsContract.CommonDataKinds.Email.CONTACT_ID + "=?",
            new String[] { contactIdStr }, null);

    if (cursor == null) {
        return;
    }

    fillContactDataFromCursor(cursor, recipients, recipientMap);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:22,代码来源:RecipientLoader.java

示例4: fillContactDataFromNameAndEmail

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
private boolean fillContactDataFromNameAndEmail(String query, List<Recipient> recipients,
        Map<String, Recipient> recipientMap) {
    query = "%" + query + "%";

    Uri queryUri = Email.CONTENT_URI;

    String selection = Contacts.DISPLAY_NAME_PRIMARY + " LIKE ? " +
            " OR (" + Email.ADDRESS + " LIKE ? AND " + Data.MIMETYPE + " = '" + Email.CONTENT_ITEM_TYPE + "')";
    String[] selectionArgs = { query, query };
    Cursor cursor = contentResolver.query(queryUri, PROJECTION, selection, selectionArgs, SORT_ORDER);

    if (cursor == null) {
        return false;
    }

    fillContactDataFromCursor(cursor, recipients, recipientMap);

    return true;

}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:21,代码来源:RecipientLoader.java

示例5: onClick

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
@Override
public void onClick(View v) {
    // If contact has been assigned, mExtras should no longer be null, but do a null check
    // anyway just in case assignContactFromPhone or Email was called with a null bundle or
    // wasn't assigned previously.
    final Bundle extras = (mExtras == null) ? new Bundle() : mExtras;
    if (mContactUri != null) {
        QuickContact.showQuickContact(getContext(), ContactBadge.this, mContactUri, QuickContact.MODE_LARGE, mExcludeMimes);
    } else if (mContactEmail != null && mQueryHandler != null) {
        extras.putString(Constants.EXTRA_URI_CONTENT, mContactEmail);
        mQueryHandler.startQuery(Constants.TOKEN_EMAIL_LOOKUP_AND_TRIGGER, extras,
                Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(mContactEmail)),
                EMAIL_LOOKUP_PROJECTION, null, null, null, mContactQueryHandlerCallback);
    } else if (mContactPhone != null && mQueryHandler != null) {
        extras.putString(Constants.EXTRA_URI_CONTENT, mContactPhone);
        mQueryHandler.startQuery(Constants.TOKEN_PHONE_LOOKUP_AND_TRIGGER, extras,
                Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, mContactPhone),
                PHONE_LOOKUP_PROJECTION, null, null, null, mContactQueryHandlerCallback);
    } else {
        // If a contact hasn't been assigned, don't react to click.
        return;
    }
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:24,代码来源:ContactBadge.java

示例6: getContactType

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
/**
 * Converts a string from the W3C Contact API to it's Android int value.
 * @param string
 * @return Android int value
 */
private int getContactType(String string) {
    int type = CommonDataKinds.Email.TYPE_OTHER;
    if (string != null) {

        String lowerType = string.toLowerCase(Locale.getDefault());

        if ("home".equals(lowerType)) {
            return CommonDataKinds.Email.TYPE_HOME;
        }
        else if ("work".equals(lowerType)) {
            return CommonDataKinds.Email.TYPE_WORK;
        }
        else if ("other".equals(lowerType)) {
            return CommonDataKinds.Email.TYPE_OTHER;
        }
        else if ("mobile".equals(lowerType)) {
            return CommonDataKinds.Email.TYPE_MOBILE;
        }
        return CommonDataKinds.Email.TYPE_CUSTOM;
    }
    return type;
}
 
开发者ID:rodrigonsh,项目名称:alerta-fraude,代码行数:28,代码来源:ContactAccessorSdk5.java

示例7: fillContactDataFromLookupKey

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
private void fillContactDataFromLookupKey(Uri lookupKeyUri, List<Recipient> recipients,
        Map<String, Recipient> recipientMap) {
    // We could use the contact id from the URI directly, but getting it from the lookup key is safer
    Uri contactContentUri = Contacts.lookupContact(getContext().getContentResolver(), lookupKeyUri);
    if (contactContentUri == null) {
        return;
    }

    String contactIdStr = getContactIdFromContactUri(contactContentUri);

    Cursor cursor = getContext().getContentResolver().query(
            ContactsContract.CommonDataKinds.Email.CONTENT_URI,
            PROJECTION, ContactsContract.CommonDataKinds.Email.CONTACT_ID + "=?",
            new String[] { contactIdStr }, null);

    if (cursor == null) {
        return;
    }

    fillContactDataFromCursor(cursor, recipients, recipientMap);
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:22,代码来源:RecipientLoader.java

示例8: fillContactDataFromQuery

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
private void fillContactDataFromQuery(String query, List<Recipient> recipients,
        Map<String, Recipient> recipientMap) {

    ContentResolver contentResolver = getContext().getContentResolver();

    query = "%" + query + "%";
    Uri queryUri = ContactsContract.CommonDataKinds.Email.CONTENT_URI;
    String selection = Contacts.DISPLAY_NAME_PRIMARY + " LIKE ? " +
            " OR (" + Email.ADDRESS + " LIKE ? AND " + Data.MIMETYPE + " = '" + Email.CONTENT_ITEM_TYPE + "')";
    String[] selectionArgs = { query, query };
    Cursor cursor = contentResolver.query(queryUri, PROJECTION, selection, selectionArgs, SORT_ORDER);

    if (cursor == null) {
        return;
    }

    fillContactDataFromCursor(cursor, recipients, recipientMap);

    if (observerContact != null) {
        observerContact = new ForceLoadContentObserver();
        contentResolver.registerContentObserver(queryUri, false, observerContact);
    }
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:24,代码来源:RecipientLoader.java

示例9: getAllContactsEmailAddressesInfo

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
@Override
public AddressBookEmailBuilder getAllContactsEmailAddressesInfo(Activity activity) {
    String[] PROJECTION = new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Email.DATA }; 
    Cursor c = activity.managedQuery(Email.CONTENT_URI, PROJECTION, null, null, null);

    // We give a list of emails: [email protected],[email protected],[email protected]
    // We get back only a list of emails of users that exist on the system ([email protected])
    // Iterate over all those returned users, on each iteration, remove from our hashmap.
    // Can now use the left over hashmap, which is still in correct order to display invites.
    AddressBookEmailBuilder bld = new AddressBookEmailBuilder();
    if (c.moveToFirst()) {
        bld.addContact(c.getString(1), c.getString(2));
        while (c.moveToNext()) {
            bld.addContact(c.getString(1), c.getString(2));
        }
    }
    c.close();
    
    return bld;
}
 
开发者ID:Kamshak,项目名称:foursquared,代码行数:21,代码来源:AddressBookUtils5.java

示例10: p

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
private final Cursor p()
{
  localhqr = new hqr(this.r);
  Uri localUri = Uri.withAppendedPath(ContactsContract.CommonDataKinds.Email.CONTENT_FILTER_URI, Uri.encode(this.s));
  Cursor localCursor = this.l.getContentResolver().query(localUri, v, null, null, null);
  if (localCursor == null) {
    return localhqr;
  }
  try
  {
    while (localCursor.moveToNext()) {
      if (!TextUtils.isEmpty(localCursor.getString(2))) {
        localhqr.a(b(localCursor));
      }
    }
    return localhqr;
  }
  finally
  {
    localCursor.close();
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:23,代码来源:bwi.java

示例11: testAppendNameProperties_email

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
@Test
public void testAppendNameProperties_email() {
    final VCardBuilder builder = new VCardBuilder(VCardConfig.VCARD_TYPE_V30_GENERIC,
            VCardConfig.DEFAULT_EXPORT_CHARSET);
    final ContentValues cv = new ContentValues();
    final List<ContentValues> group = new ArrayList<>();

    cv.put(ContactsContract.Data.MIMETYPE, Email.CONTENT_ITEM_TYPE);
    cv.put(Email.IS_PRIMARY, 0);
    cv.put(Email.DATA1, "[email protected]");

    group.add(cv);

    final String card = builder.appendEmails(group).toString();

    assertEquals(EMAIL_CARD_1, card);
}
 
开发者ID:crashlytics,项目名称:digits-android,代码行数:18,代码来源:VCardBuilderTest.java

示例12: testAppendNameProperties_htcOneDifferentOutput

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
@Test
public void testAppendNameProperties_htcOneDifferentOutput() {
    final VCardBuilder builder = new VCardBuilder(VCardConfig.VCARD_TYPE_V30_GENERIC,
            VCardConfig.DEFAULT_EXPORT_CHARSET);
    final ContentValues cv = new ContentValues();
    final List<ContentValues> group = new ArrayList<>();

    cv.put(ContactsContract.Data.MIMETYPE, Email.CONTENT_ITEM_TYPE);
    cv.put(Email.DATA, "[email protected]");
    cv.put(Email.TYPE, 3);
    cv.put(Email.LABEL, "");
    cv.put(Email.IS_PRIMARY, 1);

    group.add(cv);

    final String card = builder.appendEmails(group).toString();

    assertEquals(EMAIL_CARD_2, card);
}
 
开发者ID:crashlytics,项目名称:digits-android,代码行数:20,代码来源:VCardBuilderTest.java

示例13: testAppendNameProperties_phone

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
@Test
public void testAppendNameProperties_phone() {
    final VCardBuilder builder = new VCardBuilder(VCardConfig.VCARD_TYPE_V30_GENERIC,
            VCardConfig.DEFAULT_EXPORT_CHARSET);
    final ContentValues cv = new ContentValues();
    final List<ContentValues> group = new ArrayList<>();

    cv.put(ContactsContract.Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE);
    cv.put(Email.IS_PRIMARY, 0);
    cv.put(Email.DATA1, "(123) 123-4567");

    group.add(cv);

    final String card = builder.appendPhones(group, null).toString();

    assertEquals(PHONE_CARD, card);
}
 
开发者ID:crashlytics,项目名称:digits-android,代码行数:18,代码来源:VCardBuilderTest.java

示例14: testAppendNameProperties_name

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
@Test
public void testAppendNameProperties_name() {
    final VCardBuilder builder = new VCardBuilder(VCardConfig.VCARD_TYPE_V30_GENERIC,
            VCardConfig.DEFAULT_EXPORT_CHARSET);
    final ContentValues cv = new ContentValues();
    final List<ContentValues> group = new ArrayList<>();

    cv.put(ContactsContract.Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE);
    cv.put(Email.DATA1, "Spruce Grouse");
    cv.put(Email.DATA2, "Spruce");
    cv.put(Email.DATA3, "Grouse");

    group.add(cv);

    final String card = builder.appendNameProperties(group).toString();

    assertEquals(NAME_CARD, card);
}
 
开发者ID:crashlytics,项目名称:digits-android,代码行数:19,代码来源:VCardBuilderTest.java

示例15: getEamilByContactId

import android.provider.ContactsContract.CommonDataKinds.Email; //导入依赖的package包/类
/**
 * @param contentResolver
 * @param contactId
 */
private static String getEamilByContactId(ContentResolver contentResolver,
		String contactId) {
	Cursor emailCursor = null;
	String email = null;
	try {
		emailCursor = contentResolver
				.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,
						new String[] { ContactsContract.CommonDataKinds.Email.DATA },
						ContactsContract.CommonDataKinds.Email.CONTACT_ID
								+ "=?", new String[] { contactId }, null);
		if (emailCursor.moveToFirst()) {
			email = emailCursor
					.getString(emailCursor
							.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
		}
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		if (emailCursor != null) {
			emailCursor.close();
		}
	}
	return email;
}
 
开发者ID:panhainan,项目名称:contact,代码行数:29,代码来源:PeopleDao.java


注:本文中的android.provider.ContactsContract.CommonDataKinds.Email类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。