From c868acf442a69429056a574c67a5e0187e2b9536 Mon Sep 17 00:00:00 2001 From: Fred Quintana Date: Wed, 30 Sep 2009 18:17:47 -0700 Subject: [PATCH] show events in the UI --- api/current.xml | 57 +++++++++++------------- core/java/android/pim/vcard/ContactStruct.java | 9 ++-- core/java/android/pim/vcard/VCardComposer.java | 10 +++-- core/java/android/provider/ContactsContract.java | 40 ++++++++--------- core/res/res/values/strings.xml | 9 +++- 5 files changed, 64 insertions(+), 61 deletions(-) diff --git a/api/current.xml b/api/current.xml index 84d139a192b9..8493937f4403 100644 --- a/api/current.xml +++ b/api/current.xml @@ -113230,37 +113230,6 @@ > - - - - - - + + + + + + > contentValuesListMap) { final List contentValuesList = contentValuesListMap - .get(Birthday.CONTENT_ITEM_TYPE); + .get(Event.CONTENT_ITEM_TYPE); if (contentValuesList != null && contentValuesList.size() > 0) { + Integer eventType = contentValuesList.get(0).getAsInteger(Event.TYPE); + if (eventType == null || !eventType.equals(Event.TYPE_BIRTHDAY)) { + return; + } // Theoretically, there must be only one birthday for each vCard data and // we are afraid of some parse error occuring in some devices, so // we emit only one birthday entry for now. - String birthday = contentValuesList.get(0).getAsString(Birthday.BIRTHDAY); + String birthday = contentValuesList.get(0).getAsString(Event.START_DATE); if (birthday != null) { birthday = birthday.trim(); } diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 166813643b53..40a3c4f70604 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -1692,26 +1692,6 @@ public final class ContactsContract { } /** - * Common data definition for birthdays. - */ - public static final class Birthday implements DataColumnsWithJoins { - /** - * This utility class cannot be instantiated - */ - private Birthday() {} - - /** MIME type used when storing this in data table. */ - public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/birthday"; - - /** - * The birthday. This must be of the form YYYY-MM-DD or YYYY-MM-DDThh:mm:ss - * These are xs:date and xs:dateTime - *

Type: TEXT

- */ - public static final String BIRTHDAY = DATA1; - } - - /** * Common data definition for relations. */ public static final class Relation implements DataColumnsWithJoins, CommonColumns { @@ -1755,16 +1735,34 @@ public final class ContactsContract { private Event() {} /** MIME type used when storing this in data table. */ - public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/event"; + public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_event"; public static final int TYPE_ANNIVERSARY = 1; public static final int TYPE_OTHER = 2; + public static final int TYPE_BIRTHDAY = 3; /** * The event start date as the user entered it. *

Type: TEXT

*/ public static final String START_DATE = DATA; + + /** + * Return the string resource that best describes the given + * {@link #TYPE}. Will always return a valid resource. + */ + public static int getTypeResource(Integer type) { + if (type == null) { + return com.android.internal.R.string.eventTypeOther; + } + switch (type) { + case TYPE_ANNIVERSARY: + return com.android.internal.R.string.eventTypeAnniversary; + case TYPE_BIRTHDAY: return com.android.internal.R.string.eventTypeBirthday; + case TYPE_OTHER: return com.android.internal.R.string.eventTypeOther; + default: return com.android.internal.R.string.eventTypeOther; + } + } } /** diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 7191a4669037..7760db198f67 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -1243,6 +1243,13 @@ MMS + + Birthday + + Anniversary + + Event + Custom @@ -1299,7 +1306,7 @@ Other Custom - + Via %1$s -- 2.11.0