本文整理汇总了Java中android.provider.ContactsContract.CommonDataKinds.Website类的典型用法代码示例。如果您正苦于以下问题:Java Website类的具体用法?Java Website怎么用?Java Website使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Website类属于android.provider.ContactsContract.CommonDataKinds包,在下文中一共展示了Website类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getType
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
private String getType(Integer type, String label) {
if (type == null) {
throw new InvalidCursorTypeException();
}
switch (type) {
case Website.TYPE_BLOG:
return "Blog";
case Website.TYPE_FTP:
return "FTP";
case Website.TYPE_PROFILE:
return "Profile";
case Website.TYPE_HOME:
return "Home";
case Website.TYPE_HOMEPAGE:
return "Home Page";
case Website.TYPE_WORK:
return "Work";
case Website.TYPE_OTHER:
return "Other";
case Website.TYPE_CUSTOM:
default:
return label;
}
}
示例2: initColumnNameConstantsMap
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
private void initColumnNameConstantsMap() {
if (mColumnNameConstantsMap != null) {
return;
}
mColumnNameConstantsMap = new HashMap<String, String>();
mColumnNameConstantsMap.put("name", StructuredName.DISPLAY_NAME);
mColumnNameConstantsMap.put("givenname", StructuredName.GIVEN_NAME);
mColumnNameConstantsMap.put("familyname", StructuredName.FAMILY_NAME);
mColumnNameConstantsMap.put("honorificprefix", StructuredName.PREFIX);
mColumnNameConstantsMap.put("honorificsuffix", StructuredName.SUFFIX);
mColumnNameConstantsMap.put("additionalname", CUSTOM_DATA_COLUMN);
mColumnNameConstantsMap.put("nickname", Nickname.NAME);
mColumnNameConstantsMap.put("adr", StructuredPostal.STREET);
mColumnNameConstantsMap.put("email", Email.ADDRESS);
mColumnNameConstantsMap.put("url", Website.URL);
mColumnNameConstantsMap.put("category", GroupMembership.GROUP_ROW_ID);
mColumnNameConstantsMap.put("tel", Phone.NUMBER);
mColumnNameConstantsMap.put("org", Organization.COMPANY);
mColumnNameConstantsMap.put("jobTitle", Organization.TITLE);
mColumnNameConstantsMap.put("note", Note.NOTE);
mColumnNameConstantsMap.put("impp", Im.DATA);
mColumnNameConstantsMap.put("sex", CUSTOM_DATA_COLUMN);
mColumnNameConstantsMap.put("genderidentity", CUSTOM_DATA_COLUMN);
mColumnNameConstantsMap.put("key", CUSTOM_DATA_COLUMN);
}
示例3: initMimeTypeConstantsMap
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
private void initMimeTypeConstantsMap() {
if (mMimeTypeConstantsMap != null) {
return;
}
mMimeTypeConstantsMap = new HashMap<String, String>();
mMimeTypeConstantsMap.put("name", StructuredName.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("givenname", StructuredName.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("familyname", StructuredName.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("honorificprefix", StructuredName.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("honorificsuffix", StructuredName.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("additionalname", MIMETYPE_ADDITIONAL_NAME);
mMimeTypeConstantsMap.put("nickname", Nickname.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("email", Email.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("url", Website.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("category", GroupMembership.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("tel", Phone.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("org", Organization.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("jobTitle", Organization.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("note", Note.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("impp", Im.CONTENT_ITEM_TYPE);
mMimeTypeConstantsMap.put("sex", MIMETYPE_SEX);
mMimeTypeConstantsMap.put("genderidentity", MIMETYPE_GENDER_IDENTITY);
mMimeTypeConstantsMap.put("key", MIMETYPE_KEY);
}
示例4: addWebsite
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
public ContactOperations addWebsite(String website, int type, String label,
boolean isPrimary, boolean isSuperPrimary) {
mValues.clear();
if (!TextUtils.isEmpty(website)) {
mValues.put(Website.URL, website);
mValues.put(Website.TYPE, type);
mValues.put(Website.MIMETYPE, Website.CONTENT_ITEM_TYPE);
if (!TextUtils.isEmpty(label)) {
mValues.put(Website.LABEL, label);
}
if (isSuperPrimary) {
mValues.put(Email.IS_SUPER_PRIMARY, 1);
}
if (isPrimary) {
mValues.put(Email.IS_PRIMARY, 1);
}
addInsertOp();
}
return this;
}
示例5: getAndroidWebsiteType
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
public static int getAndroidWebsiteType(WebsiteType type) {
switch (type) {
case TYPE_CUSTOM:
return Website.TYPE_CUSTOM;
case TYPE_HOME:
return Website.TYPE_HOME;
case TYPE_HOMEPAGE:
return Website.TYPE_HOMEPAGE;
case TYPE_OTHER:
return Website.TYPE_OTHER;
case TYPE_WORK:
return Website.TYPE_WORK;
case TYPE_BLOG:
return Website.TYPE_BLOG;
case TYPE_FTP:
return Website.TYPE_FTP;
case TYPE_PROFILE:
return Website.TYPE_PROFILE;
default:
return Website.TYPE_OTHER;
}
}
示例6: getWebsiteType
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
public static WebsiteType getWebsiteType(int androidType) {
switch (androidType) {
case Website.TYPE_CUSTOM:
return WebsiteType.TYPE_CUSTOM;
case Website.TYPE_OTHER:
return WebsiteType.TYPE_OTHER;
case Website.TYPE_HOME:
return WebsiteType.TYPE_HOME;
case Website.TYPE_WORK:
return WebsiteType.TYPE_WORK;
case Website.TYPE_BLOG:
return WebsiteType.TYPE_BLOG;
case Website.TYPE_FTP:
return WebsiteType.TYPE_FTP;
case Website.TYPE_HOMEPAGE:
return WebsiteType.TYPE_HOMEPAGE;
case Website.TYPE_PROFILE:
return WebsiteType.TYPE_PROFILE;
default:
return WebsiteType.TYPE_OTHER;
}
}
示例7: updateUrl
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
private boolean updateUrl(ContactMethod cmethod, String rawContactId, Context ctx) {
// seek for raw contact + url = same
String[] proj = new String[] {
Website.RAW_CONTACT_ID, Data.MIMETYPE, Website.DATA
};
String where = Website.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=? AND "
+ Website.DATA + "=?";
String[] args = new String[] {
rawContactId, Website.CONTENT_ITEM_TYPE, cmethod.data
};
ContentValues values = valuesUrl(cmethod);
values.put(Website.RAW_CONTACT_ID, rawContactId);
return updateDataRow(ctx, proj, where, args, values);
}
示例8: insertWebsite
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
/**
* Add a website to a list of database actions to be performed
*
* @param ops the list of database actions
* @param website the item to be inserted
*/
private void insertWebsite(ArrayList<ContentProviderOperation> ops,
JSONObject website) {
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
.withValue(ContactsContract.Data.MIMETYPE, CommonDataKinds.Website.CONTENT_ITEM_TYPE)
.withValue(CommonDataKinds.Website.DATA, getJsonString(website, "value"))
.withValue(CommonDataKinds.Website.TYPE, getContactType(getJsonString(website, "type")))
.withValue(CommonDataKinds.Website.LABEL, getJsonString(website, "type"))
.build());
}
示例9: getWebsitesValues
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
private void getWebsitesValues(final JSONArray websites, List<ContentValues> newContactValues) throws JSONException {
if (websites == null) {
return;
}
for (int i = 0; i < websites.length(); i++) {
JSONObject website = websites.getJSONObject(i);
JSONArray websiteTypes = website.optJSONArray("type");
if (websiteTypes != null && websiteTypes.length() > 0) {
for (int j = 0; j < websiteTypes.length(); j++) {
// Translate the website type string to an integer constant
// provided by the ContactsContract API
final String type = websiteTypes.getString(j);
final int typeConstant = getWebsiteType(type);
newContactValues.add(createContentValues(Website.CONTENT_ITEM_TYPE,
website.optString("value"),
typeConstant, type,
website.optBoolean("pref")));
}
} else {
newContactValues.add(createContentValues(Website.CONTENT_ITEM_TYPE,
website.optString("value"),
-1, null, website.optBoolean("pref")));
}
}
}
示例10: initWebsiteTypesMap
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
private void initWebsiteTypesMap() {
if (mWebsiteTypesMap != null) {
return;
}
mWebsiteTypesMap = new HashMap<String, Integer>();
mWebsiteTypesMap.put("homepage", Website.TYPE_HOMEPAGE);
mWebsiteTypesMap.put("blog", Website.TYPE_BLOG);
mWebsiteTypesMap.put("profile", Website.TYPE_PROFILE);
mWebsiteTypesMap.put("home", Website.TYPE_HOME);
mWebsiteTypesMap.put("work", Website.TYPE_WORK);
mWebsiteTypesMap.put("ftp", Website.TYPE_FTP);
}
示例11: updateWebsite
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
/**
* Updates contact's website
*
* @param email
* email id of the sample SyncAdapter user
* @param uri
* Uri for the existing raw contact to be updated
* @return instance of ContactOperations
*/
public ContactOperations updateWebsite(String website, String label,
boolean isPrimary, boolean isSuperPrimary, Uri uri) {
mValues.clear();
mValues.put(Website.DATA, website);
mValues.put(Website.LABEL, label);
mValues.put(Website.IS_PRIMARY, isPrimary ? 1 : 0);
mValues.put(Website.IS_SUPER_PRIMARY, isSuperPrimary ? 1 : 0);
addUpdateOp(uri);
return this;
}
示例12: populateURLs
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
protected void populateURLs(Contact c) throws RemoteException {
@Cleanup Cursor cursor = providerClient.query(dataURI(), new String[] { Website.URL },
Website.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=?",
new String[] { String.valueOf(c.getLocalID()), Website.CONTENT_ITEM_TYPE }, null);
while (cursor != null && cursor.moveToNext())
c.getURLs().add(cursor.getString(0));
}
示例13: addUrl
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
@Override
public boolean addUrl(ContactStruct contact, Cursor urls, Context ctx, boolean removeMatches) {
String url = urls.getString(urls.getColumnIndexOrThrow(Website.URL));
String label = urls.getString(urls.getColumnIndexOrThrow(Website.LABEL));
int type = urls.getInt(urls.getColumnIndexOrThrow(Website.TYPE));
boolean primary = (urls.getInt(urls.getColumnIndexOrThrow(Website.IS_PRIMARY)) != 0);
if (!TextUtils.isEmpty(url) && isUrlNew(contact, url, type, removeMatches)) {
contact.addContactmethod(Contacts.KIND_URL,
(type > ContactMethodsColumns.TYPE_OTHER ? ContactMethodsColumns.TYPE_OTHER
: type), url, label, primary);
return true;
}
return false;
}
示例14: valuesUrl
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
private ContentValues valuesUrl(ContactMethod url) {
ContentValues val = new ContentValues();
val.put(Data.MIMETYPE, Website.CONTENT_ITEM_TYPE);
if (url.label != null)
val.put(Website.LABEL, url.label);
val.put(Website.IS_PRIMARY, url.isPrimary ? 1 : 0);
if (url.data != null)
val.put(Website.DATA, url.data);
val.put(Website.TYPE, url.type);
return val;
}
示例15: addContact
import android.provider.ContactsContract.CommonDataKinds.Website; //导入依赖的package包/类
private static void addContact(Collection<ContentProviderOperation> ops, int rawContactID, Contact contact, boolean work) {
if (contact != null) {
// Add work telefon number
if (contact.getTelefon() != null) {
ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
.withValueBackReference(Data.RAW_CONTACT_ID, rawContactID)
.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
.withValue(Phone.NUMBER, contact.getTelefon())
.withValue(Phone.TYPE, work ? Phone.TYPE_WORK : Phone.TYPE_HOME)
.build());
}
// Add work mobile number
if (contact.getMobilephone() != null) {
ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
.withValueBackReference(Data.RAW_CONTACT_ID, rawContactID)
.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
.withValue(Phone.NUMBER, contact.getMobilephone())
.withValue(Phone.TYPE, work ? Phone.TYPE_WORK_MOBILE : Phone.TYPE_MOBILE)
.build());
}
// Add work fax number
if (contact.getFax() != null) {
ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
.withValueBackReference(Data.RAW_CONTACT_ID, rawContactID)
.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
.withValue(Phone.NUMBER, contact.getFax())
.withValue(Phone.TYPE, work ? Phone.TYPE_FAX_WORK : Phone.TYPE_FAX_HOME)
.build());
}
// Add website
if (contact.getHomepage() != null) {
ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
.withValueBackReference(Data.RAW_CONTACT_ID, rawContactID)
.withValue(Data.MIMETYPE, Website.CONTENT_ITEM_TYPE)
.withValue(Website.URL, contact.getHomepage())
.withValue(Website.TYPE, work ? Website.TYPE_WORK : Website.TYPE_HOME)
.build());
}
}
}