本文整理汇总了Java中android.provider.ContactsContract.CommonDataKinds.Organization类的典型用法代码示例。如果您正苦于以下问题:Java Organization类的具体用法?Java Organization怎么用?Java Organization使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Organization类属于android.provider.ContactsContract.CommonDataKinds包,在下文中一共展示了Organization类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOrgType
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
/**
* getPhoneType converts an Android phone type into a string
* @param type
* @return phone type as string.
*/
private String getOrgType(int type) {
String stringType;
switch (type) {
case CommonDataKinds.Organization.TYPE_CUSTOM:
stringType = "custom";
break;
case CommonDataKinds.Organization.TYPE_WORK:
stringType = "work";
break;
case CommonDataKinds.Organization.TYPE_OTHER:
default:
stringType = "other";
break;
}
return stringType;
}
示例2: initColumnNameConstantsMap
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的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.Organization; //导入依赖的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: updateOrganization
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
public ContactOperations updateOrganization(String data, int type,
String label, String title, String department,
String jobDescription, boolean isPrimary, boolean isSuperPrimary,
Uri uri) {
mValues.clear();
mValues.put(Organization.COMPANY, data);
mValues.put(Organization.LABEL, label);
mValues.put(Organization.TYPE, type);
mValues.put(Organization.TITLE, title);
mValues.put(Organization.DEPARTMENT, department);
mValues.put(Organization.JOB_DESCRIPTION, jobDescription);
mValues.put(Organization.IS_PRIMARY, isPrimary ? 1 : 0);
mValues.put(Organization.IS_SUPER_PRIMARY, isSuperPrimary ? 1 : 0);
addUpdateOp(uri);
return this;
}
示例5: populateOrganization
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
protected void populateOrganization(Contact c) throws RemoteException {
@Cleanup Cursor cursor = providerClient.query(dataURI(),
new String[] { Organization.COMPANY, Organization.DEPARTMENT, Organization.TITLE, Organization.JOB_DESCRIPTION },
Organization.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=?",
new String[] { String.valueOf(c.getLocalID()), Organization.CONTENT_ITEM_TYPE }, null);
if (cursor != null && cursor.moveToNext()) {
String company = cursor.getString(0),
department = cursor.getString(1),
title = cursor.getString(2),
role = cursor.getString(3);
if (!StringUtils.isEmpty(company) || !StringUtils.isEmpty(department)) {
ezvcard.property.Organization org = new ezvcard.property.Organization();
if (!StringUtils.isEmpty(company))
org.addValue(company);
if (!StringUtils.isEmpty(department))
org.addValue(department);
c.setOrganization(org);
}
if (!StringUtils.isEmpty(title))
c.setJobTitle(title);
if (!StringUtils.isEmpty(role))
c.setJobDescription(role);
}
}
示例6: buildOrganization
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
protected Builder buildOrganization(Builder builder, Contact contact) {
if (contact.getOrganization() == null && contact.getJobTitle() == null && contact.getJobDescription() == null)
return null;
ezvcard.property.Organization organization = contact.getOrganization();
String company = null, department = null;
if (organization != null) {
Iterator<String> org = organization.getValues().iterator();
if (org.hasNext())
company = org.next();
if (org.hasNext())
department = org.next();
}
return builder
.withValue(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE)
.withValue(Organization.COMPANY, company)
.withValue(Organization.DEPARTMENT, department)
.withValue(Organization.TITLE, contact.getJobTitle())
.withValue(Organization.JOB_DESCRIPTION, contact.getJobDescription());
}
示例7: addOrg
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
@Override
public boolean addOrg(ContactStruct contact, Cursor orgs, boolean removeMatches) {
boolean ret = false;
String title = orgs.getString(orgs.getColumnIndexOrThrow(Organization.TITLE));
String company = orgs.getString(orgs.getColumnIndexOrThrow(Organization.COMPANY));
int type = orgs.getInt(orgs.getColumnIndexOrThrow(Organization.TYPE));
boolean primary = (orgs.getInt(orgs.getColumnIndexOrThrow(Organization.IS_PRIMARY)) != 0);
if (!TextUtils.isEmpty(company) && isOrgNew(contact, company, title, removeMatches)) {
contact.addOrganization(type, company, title, primary);
if (primary) {
contact.title = title;
contact.company = company;
ret = true;
}
}
return ret;
}
示例8: updateOrg
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
private boolean updateOrg(OrganizationData org, String rawContactId, Context ctx) {
// seek for raw contact + company + title = same
String[] proj = new String[] {
Organization.RAW_CONTACT_ID, Data.MIMETYPE, Organization.COMPANY,
Organization.TITLE
};
String where = Organization.RAW_CONTACT_ID + "=? AND " + Data.MIMETYPE + "=? AND ("
+ Organization.COMPANY + "=? OR " + Organization.TITLE + "=?)";
String[] args = new String[] {
rawContactId, Organization.CONTENT_ITEM_TYPE, org.companyName, org.positionName
};
ContentValues values = valuesOrg(org);
values.put(Organization.RAW_CONTACT_ID, rawContactId);
return updateDataRow(ctx, proj, where, args, values);
}
示例9: insertOrganization
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
/**
* Add an organization to a list of database actions to be performed
*
* @param ops the list of database actions
* @param org the item to be inserted
*/
private void insertOrganization(ArrayList<ContentProviderOperation> ops,
JSONObject org) {
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
.withValue(ContactsContract.Data.MIMETYPE, CommonDataKinds.Organization.CONTENT_ITEM_TYPE)
.withValue(CommonDataKinds.Organization.TYPE, getOrgType(getJsonString(org, "type")))
.withValue(CommonDataKinds.Organization.DEPARTMENT, getJsonString(org, "department"))
.withValue(CommonDataKinds.Organization.COMPANY, getJsonString(org, "name"))
.withValue(CommonDataKinds.Organization.TITLE, getJsonString(org, "title"))
.withValue(CommonDataKinds.Organization.LABEL, getJsonString(org, "type"))
.build());
}
示例10: getOrganizationByContactId
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
/**
* @param contentResolver
* @param contactId
*/
private static List<String> getOrganizationByContactId(
ContentResolver contentResolver, String contactId) {
List<String> list = new ArrayList<String>(2);
Cursor organizationCursor = null;
String company = "";
String position = "";
try {
organizationCursor = contentResolver
.query(ContactsContract.Data.CONTENT_URI,
null,
ContactsContract.Data.CONTACT_ID + " = ? AND "
+ ContactsContract.Data.MIMETYPE + " = ?",
new String[] {
contactId,
ContactsContract.CommonDataKinds.Organization.CONTENT_ITEM_TYPE },
null);
if (organizationCursor.moveToFirst()) {
company = organizationCursor
.getString(organizationCursor
.getColumnIndex(ContactsContract.CommonDataKinds.Organization.DATA1));
position = organizationCursor
.getString(organizationCursor
.getColumnIndex(ContactsContract.CommonDataKinds.Organization.DATA4));
}
list.add(company);
list.add(position);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (organizationCursor != null) {
organizationCursor.close();
}
}
return list;
}
示例11: getOrganizationDataAsJSONObject
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
private void getOrganizationDataAsJSONObject(Cursor cursor, JSONArray organizations,
JSONArray jobTitles) throws JSONException {
int organizationColumnIndex = cursor.getColumnIndex(Organization.COMPANY);
int titleColumnIndex = cursor.getColumnIndex(Organization.TITLE);
if (!cursor.isNull(organizationColumnIndex)) {
organizations.put(cursor.getString(organizationColumnIndex));
}
if (!cursor.isNull(titleColumnIndex)) {
jobTitles.put(cursor.getString(titleColumnIndex));
}
}
示例12: addOrganization
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
public ContactOperations addOrganization(String data, int type,
String label, boolean isPrimary, boolean isSuperPrimary,
String title, String department, String jobDescription) {
mValues.clear();
if (!TextUtils.isEmpty(data)) {
mValues.put(Organization.DATA, data);
mValues.put(Organization.TYPE, type);
mValues.put(Organization.MIMETYPE, Organization.CONTENT_ITEM_TYPE);
if (!TextUtils.isEmpty(label)) {
mValues.put(Organization.LABEL, label);
}
if (!TextUtils.isEmpty(title)) {
mValues.put(Organization.TITLE, title);
}
if (isSuperPrimary) {
mValues.put(Email.IS_SUPER_PRIMARY, 1);
}
if (isPrimary) {
mValues.put(Email.IS_PRIMARY, 1);
}
mValues.put(Organization.DEPARTMENT, department);
if (!TextUtils.isEmpty(jobDescription)) {
mValues.put(Organization.JOB_DESCRIPTION, jobDescription);
}
addInsertOp();
}
return this;
}
示例13: getAndroidOrganizationType
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
public static int getAndroidOrganizationType(OrganizationType type) {
switch (type) {
case TYPE_CUSTOM:
return Organization.TYPE_CUSTOM;
case TYPE_OTHER:
return Organization.TYPE_OTHER;
case TYPE_WORK:
return Organization.TYPE_WORK;
default:
return Organization.TYPE_OTHER;
}
}
示例14: getOrganizationType
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
public static OrganizationType getOrganizationType(int androidType) {
switch (androidType) {
case Organization.TYPE_CUSTOM:
return OrganizationType.TYPE_CUSTOM;
case Organization.TYPE_OTHER:
return OrganizationType.TYPE_OTHER;
case Organization.TYPE_WORK:
return OrganizationType.TYPE_WORK;
default:
return OrganizationType.TYPE_OTHER;
}
}
示例15: getProjOrg
import android.provider.ContactsContract.CommonDataKinds.Organization; //导入依赖的package包/类
@Override
public String[] getProjOrg() {
return new String[] {
Organization.MIMETYPE, Organization.TITLE, Organization.COMPANY, Organization.TYPE,
Organization.IS_PRIMARY, Organization.LABEL
};
}