聯繫人字段中增長生日字段

有些客戶有需求在新建/編輯聯繫人時,「添加其餘字段」列表中有生日字段html


[SOLUTION]java


請參考敝司之前的Demo Code,這是用來設置「 活動」 字段的, 「 活動」 中有「 生日」 的選項。
solution以下供參考:
android


【JB版本】app


一、在文件LocalPhoneAccountType.java的LocalPhoneAccountType()函數中,將以下語句註釋掉
的語句拿出:
ide

addDataKindEvent(context);函數


二、增長這個在addDataKindEvent函數,在LocalPhoneAccountType.java中實現
addDataKindEvent(),
其實現以下:
protected DataKind addDataKindEvent(Context context) throws
DefinitionException {
DataKind kind = addKind(new
DataKind(Event.CONTENT_ITEM_TYPE,R.string.eventLabelsGroup,150,true,
R.layout.event_field_editor_view));
kind.actionHeader = new EventActionInflater();
kind.actionBody = new SimpleInflater(Event.START_DATE);
kind.typeOverallMax = 1;
kind.typeColumn = Event.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildEventType(Event.TYPE_BIRTHDAY,false).setSpecificMax
(1));
kind.dateFormatWithYear = DateUtils.DATE_AND_TIME_FORMAT;
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new
EditField(Event.DATA,R.string.eventLabelsGroup,FLAGS_EVENT));
return kind;
}
ui


【KK版本】
修改LocalPhoneAccountType.java (alps\packages\apps\contactscommon
\src\com\mediatek\contacts\model)
spa


(1).添加
import android.provider.ContactsContract.CommonDataKinds.Event;
import com.android.contacts.common.util.DateUtils;
orm


(2).LocalPhoneAccountType的構造函數中try語句內添加
addDataKindEvent(context);
htm


(3).實現函數addDataKindEvent(Context context)protected DataKind addDataKindEvent(Context context) throwsDefinitionException {DataKind kind = addKind(newDataKind(Event.CONTENT_ITEM_TYPE,R.string.eventLabelsGroup,150,true));kind.actionHeader = new EventActionInflater();kind.actionBody = new SimpleInflater(Event.START_DATE);kind.typeOverallMax = 1;kind.typeColumn = Event.TYPE;kind.typeList = Lists.newArrayList();kind.typeList.add(buildEventType(Event.TYPE_BIRTHDAY,false).setSpecificMax(1));kind.dateFormatWithYear = DateUtils.DATE_AND_TIME_FORMAT;kind.fieldList = Lists.newArrayList();kind.fieldList.add(newEditField(Event.DATA,R.string.eventLabelsGroup,FLAGS_EVENT));return kind;}

相關文章
相關標籤/搜索