• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Event类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addEvent

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的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: addBirthday

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
public static void addBirthday(long rawContactId, String birthday){
	String where = ContactsContract.Data.RAW_CONTACT_ID + " = '" + rawContactId 
			+ "' AND " + ContactsContract.Data.MIMETYPE + " = '" + ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE
			+ "' AND " + ContactsContract.CommonDataKinds.Event.TYPE + " = '" + ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY + "'";
	Cursor cursor = ContactsSyncAdapterService.mContentResolver.query(ContactsContract.Data.CONTENT_URI, null, where, null, null);
	int count = cursor.getCount();
	cursor.close();
	if (count <= 0){
		ContentValues contentValues = new ContentValues();
		contentValues.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE);
		contentValues.put(ContactsContract.Data.RAW_CONTACT_ID, rawContactId);
		contentValues.put(ContactsContract.CommonDataKinds.Event.TYPE, ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY);
		contentValues.put(ContactsContract.CommonDataKinds.Event.START_DATE, birthday);
		
		try {
			ContactsSyncAdapterService.mContentResolver.insert(ContactsContract.Data.CONTENT_URI, contentValues);
		//	mContentResolver.applyBatch(ContactsContract.AUTHORITY,	operationList);
		} catch (Exception e) {
			e.printStackTrace();
			//Log.e("ERROR:" , e.^);
		}
	}
}
 
开发者ID:mots,项目名称:haxsync,代码行数:24,代码来源:ContactUtil.java


示例3: addSingleValueProperty

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
/**
 * 为存在单值的域添加属性
 *
 * @param contactPropMap
 *            包含联系人信息的 map
 * @param logicField
 *            域名称
 * @param ops
 *            ContentProviderOperation
 */
private void addSingleValueProperty(Map<String, Object> contactPropMap,
        String logicField, ArrayList<ContentProviderOperation> ops) {
    String fieldValue = (String) contactPropMap.get(logicField);
    if (XStringUtils.isEmptyString(fieldValue)) {
        return;
    }

    ContentProviderOperation.Builder builder = ContentProviderOperation
            .newInsert(ContactsContract.Data.CONTENT_URI)
            .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
            .withValue(ContactsContract.Data.MIMETYPE,
                    LOGIC_FIELD_TO_CONTENT_TYPE_MAP.get(logicField));

    if (logicField == LOGIC_FIELD_BIRTHDAY) {
        builder.withValue(ContactsContract.CommonDataKinds.Event.TYPE,
                ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY);
    }
    builder.withValue(LOGIC_FIELD_TO_NATIVE_FIELD_MAP.get(logicField),
            fieldValue);
    ops.add(builder.build());
}
 
开发者ID:polyvi,项目名称:openxface-android,代码行数:32,代码来源:XContactAccessorAPILevel5Impl.java


示例4: getEventType

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
private String getEventType(Integer type, String label) {
    if (type == null) {
        throw new InvalidCursorTypeException();
    }
    switch (type) {
        case Event.TYPE_ANNIVERSARY:
            return "anniversary";
        case Event.TYPE_OTHER:
            return "other";
        case Event.TYPE_CUSTOM:
            return label;
        default:
            return "other";
    }
}
 
开发者ID:wix,项目名称:react-native-paged-contacts,代码行数:16,代码来源:Date.java


示例5: getEventValues

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
private void getEventValues(final String event, final int type, List<ContentValues> newContactValues) {
    if (event == null || event.length() < 11) {
        return;
    }

    ContentValues contentValues = new ContentValues();
    contentValues.put(Data.MIMETYPE, Event.CONTENT_ITEM_TYPE);
    contentValues.put(Event.START_DATE, event.substring(0, 10));
    contentValues.put(Event.TYPE, type);
    newContactValues.add(contentValues);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:12,代码来源:ContactService.java


示例6: updateEvent

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
public ContactOperations updateEvent(String event, String label,
		boolean isPrimary, boolean isSuperPrimary, Uri uri) {
	mValues.clear();
	mValues.put(Event.START_DATE, event);
	mValues.put(Event.LABEL, label);
	mValues.put(Event.IS_PRIMARY, isPrimary ? 1 : 0);
	mValues.put(Event.IS_SUPER_PRIMARY, isSuperPrimary ? 1 : 0);
	addUpdateOp(uri);
	return this;
}
 
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:11,代码来源:ContactOperations.java


示例7: getAndroidEventType

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
public static int getAndroidEventType(EventType type) {
	switch (type) {
	case TYPE_CUSTOM:
		return Event.TYPE_CUSTOM;
	case TYPE_ANNIVERSARY:
		return Event.TYPE_ANNIVERSARY;
	case TYPE_BIRTHDAY:
		return Event.TYPE_BIRTHDAY;
	case TYPE_OTHER:
		return Event.TYPE_OTHER;
	default:
		return Event.TYPE_OTHER;
	}
}
 
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:15,代码来源:ContactManager.java


示例8: getEventType

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
public static EventType getEventType(int androidType) {
	switch (androidType) {
	case Event.TYPE_CUSTOM:
		return EventType.TYPE_CUSTOM;
	case Event.TYPE_OTHER:
		return EventType.TYPE_OTHER;
	case Event.TYPE_ANNIVERSARY:
		return EventType.TYPE_ANNIVERSARY;
	case Event.TYPE_BIRTHDAY:
		return EventType.TYPE_BIRTHDAY;
	default:
		return EventType.TYPE_OTHER;
	}
}
 
开发者ID:mgrieder,项目名称:ntsync-android,代码行数:15,代码来源:ContactManager.java


示例9: cursorToHashMap

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
@Override
public void cursorToHashMap(Map<String, Object> contactsMap, Cursor c) {
    // 获取当前行的 mimetype用于比较
    String mimetype = c.getString(c
            .getColumnIndex(ContactsContract.Data.MIMETYPE));

    if (StructuredName.CONTENT_ITEM_TYPE.equals(mimetype)) {
        contactsMap.put(LOGIC_FIELD_DISPLAYNAME,
                c.getString(c.getColumnIndex(StructuredName.DISPLAY_NAME)));
        nameQuery(contactsMap, c);
    } else if (Event.CONTENT_ITEM_TYPE.equals(mimetype)) {
        if (Event.TYPE_BIRTHDAY == c.getInt(c.getColumnIndex(Event.TYPE))) {
            contactsMap.put(LOGIC_FIELD_BIRTHDAY,
                    c.getString(c.getColumnIndex(Event.START_DATE)));
        }
    } else if (Nickname.CONTENT_ITEM_TYPE.equals(mimetype)) {
        contactsMap.put(LOGIC_FIELD_NICKNAME,
                c.getString(c.getColumnIndex(Nickname.NAME)));
    } else if (Note.CONTENT_ITEM_TYPE.equals(mimetype)) {
        contactsMap.put(LOGIC_FIELD_NOTE,
                c.getString(c.getColumnIndex(Note.NOTE)));
    } else {
        String logicField = LOGIC_FIELD_TO_CONTENT_TYPE_MAP
                .getKeyByValue(mimetype);
        if (LOGIC_CONTACT_MULTIPLE_VALUE_FIELDS.contains(logicField)) {
            multipleValueFieldQuery(contactsMap, c, logicField);
        }
    }
}
 
开发者ID:polyvi,项目名称:openxface-android,代码行数:30,代码来源:XContactAccessorAPILevel5Impl.java


示例10: fillFromCursor

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
private void fillFromCursor() {
    final Integer type = getInt(Event.TYPE);
    startDate = getString(Event.START_DATE);
    final String label = getString(Event.LABEL);
    this.type = getEventType(type, label);
}
 
开发者ID:wix,项目名称:react-native-paged-contacts,代码行数:7,代码来源:Date.java


示例11: removeBirthdays

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
public static void removeBirthdays(Context c, long rawContactId){
	String where = ContactsContract.Data.RAW_CONTACT_ID + " = '" + rawContactId 
			+ "' AND " + ContactsContract.Data.MIMETYPE + " = '" + ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE
			+ "' AND " + ContactsContract.CommonDataKinds.Event.TYPE + " = '" + ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY + "'";
	c.getContentResolver().delete(ContactsContract.Data.CONTENT_URI, where, null);
}
 
开发者ID:mots,项目名称:haxsync,代码行数:7,代码来源:ContactUtil.java


示例12: modifySingleValueProperty

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
/**
 * 为存在单值的域修改属性
 *
 * @param newContactMap
 *            包含新的要更新的联系人信息
 * @param oldContactMap
 *            android系统中保持的旧的联系人信息
 * @param fieldName
 *            域名
 * @param id
 *            此联系人的 id
 * @param rawId
 *            此联系人的 rawId
 * @param ops
 *            ContentProviderOperation
 */
private void modifySingleValueProperty(Map<String, Object> newContactMap,
        Map<String, Object> oldContactMap, String fieldName, String id,
        int rawId, ArrayList<ContentProviderOperation> ops) {
    Object propValue = newContactMap.get(fieldName);

    ContentProviderOperation.Builder builder = null;
    String contentItemType = LOGIC_FIELD_TO_CONTENT_TYPE_MAP.get(fieldName);
    String nativeFieldName = LOGIC_FIELD_TO_NATIVE_FIELD_MAP.get(fieldName);

    Object oldPropValue = oldContactMap.get(fieldName);
    if (null == oldPropValue && null == propValue) {
        return;
    }

    if (null == oldPropValue && null != propValue) {
        // insert a new property
        builder = ContentProviderOperation
                .newInsert(ContactsContract.Data.CONTENT_URI)
                .withValue(ContactsContract.Data.RAW_CONTACT_ID, rawId)
                .withValue(ContactsContract.Data.MIMETYPE, contentItemType);

        if (fieldName == LOGIC_FIELD_BIRTHDAY) {
            builder.withValue(Event.TYPE, Event.TYPE_BIRTHDAY);
        }
        builder.withValue(nativeFieldName, propValue);
    } else if (null != oldPropValue && null == propValue) {
        // delete property
        builder = ContentProviderOperation.newDelete(
                ContactsContract.Data.CONTENT_URI).withSelection(
                ContactsContract.Data.RAW_CONTACT_ID + "=? AND "
                        + ContactsContract.Data.MIMETYPE + "=?",
                new String[] { String.valueOf(rawId), contentItemType });
    } else {
        // update an existing property
        builder = ContentProviderOperation
                .newUpdate(ContactsContract.Data.CONTENT_URI);

        if (fieldName == LOGIC_FIELD_BIRTHDAY) {
            builder = builder.withSelection(
                    ContactsContract.Data.CONTACT_ID + "=? AND "
                            + ContactsContract.Data.MIMETYPE + "=? AND "
                            + Event.TYPE + "=?",
                    new String[] { id, contentItemType,
                            String.valueOf(Event.TYPE_BIRTHDAY) });
            builder.withValue(Event.TYPE, Event.TYPE_BIRTHDAY).withValue(
                    nativeFieldName, propValue);
        } else {
            builder = builder.withSelection(
                    ContactsContract.Data.CONTACT_ID + "=? AND "
                            + ContactsContract.Data.MIMETYPE + "=?",
                    new String[] { id, contentItemType }).withValue(
                    nativeFieldName, propValue);
        }

    }
    ops.add(builder.build());
}
 
开发者ID:polyvi,项目名称:openxface-android,代码行数:74,代码来源:XContactAccessorAPILevel5Impl.java


示例13: getContactValues

import android.provider.ContactsContract.CommonDataKinds.Event; //导入依赖的package包/类
private List<ContentValues> getContactValues(final JSONObject contactProperties) throws JSONException {
    List<ContentValues> contactValues = new ArrayList<ContentValues>();

    // Add the contact to the default group so it is shown in other apps
    // like the Contacts or People app
    ContentValues defaultGroupValues = new ContentValues();
    defaultGroupValues.put(Data.MIMETYPE, GroupMembership.CONTENT_ITEM_TYPE);
    defaultGroupValues.put(GroupMembership.GROUP_ROW_ID, mGroupId);
    contactValues.add(defaultGroupValues);

    // Create all the values that will be inserted into the new contact
    getNameValues(contactProperties.optJSONArray("name"),
                  contactProperties.optJSONArray("givenName"),
                  contactProperties.optJSONArray("familyName"),
                  contactProperties.optJSONArray("honorificPrefix"),
                  contactProperties.optJSONArray("honorificSuffix"),
                  contactValues);

    getGenericValues(MIMETYPE_ADDITIONAL_NAME, CUSTOM_DATA_COLUMN,
                     contactProperties.optJSONArray("additionalName"), contactValues);

    getNicknamesValues(contactProperties.optJSONArray("nickname"), contactValues);

    getAddressesValues(contactProperties.optJSONArray("adr"), contactValues);

    getPhonesValues(contactProperties.optJSONArray("tel"), contactValues);

    getEmailsValues(contactProperties.optJSONArray("email"), contactValues);

    //getPhotosValues(contactProperties.optJSONArray("photo"), contactValues);

    getGenericValues(Organization.CONTENT_ITEM_TYPE, Organization.COMPANY,
                     contactProperties.optJSONArray("org"), contactValues);

    getGenericValues(Organization.CONTENT_ITEM_TYPE, Organization.TITLE,
                     contactProperties.optJSONArray("jobTitle"), contactValues);

    getNotesValues(contactProperties.optJSONArray("note"), contactValues);

    getWebsitesValues(contactProperties.optJSONArray("url"), contactValues);

    getImsValues(contactProperties.optJSONArray("impp"), contactValues);

    getCategoriesValues(contactProperties.optJSONArray("category"), contactValues);

    getEventValues(contactProperties.optString("bday"), Event.TYPE_BIRTHDAY, contactValues);

    getEventValues(contactProperties.optString("anniversary"), Event.TYPE_ANNIVERSARY, contactValues);

    getCustomMimetypeValues(contactProperties.optString("sex"), MIMETYPE_SEX, contactValues);

    getCustomMimetypeValues(contactProperties.optString("genderIdentity"), MIMETYPE_GENDER_IDENTITY, contactValues);

    getGenericValues(MIMETYPE_KEY, CUSTOM_DATA_COLUMN, contactProperties.optJSONArray("key"),
                     contactValues);

    return contactValues;
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:59,代码来源:ContactService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DateTickUnitType类代码示例发布时间:2022-05-22
下一篇:
Java OneToMany类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap