show events in the UI

This commit is contained in:
Fred Quintana
2009-09-30 18:17:47 -07:00
parent 8ad6d524e4
commit c868acf442
5 changed files with 64 additions and 61 deletions

View File

@@ -113230,37 +113230,6 @@
>
</field>
</interface>
<class name="ContactsContract.CommonDataKinds.Birthday"
extends="java.lang.Object"
abstract="false"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
<field name="BIRTHDAY"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;data1&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="CONTENT_ITEM_TYPE"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;vnd.android.cursor.item/birthday&quot;"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class>
<class name="ContactsContract.CommonDataKinds.Email"
extends="java.lang.Object"
abstract="false"
@@ -113415,11 +113384,24 @@
deprecated="not deprecated"
visibility="public"
>
<method name="getTypeResource"
return="int"
abstract="false"
native="false"
synchronized="false"
static="true"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="type" type="java.lang.Integer">
</parameter>
</method>
<field name="CONTENT_ITEM_TYPE"
type="java.lang.String"
transient="false"
volatile="false"
value="&quot;vnd.android.cursor.item/event&quot;"
value="&quot;vnd.android.cursor.item/contact_event&quot;"
static="true"
final="true"
deprecated="not deprecated"
@@ -113448,6 +113430,17 @@
visibility="public"
>
</field>
<field name="TYPE_BIRTHDAY"
type="int"
transient="false"
volatile="false"
value="3"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TYPE_OTHER"
type="int"
transient="false"

View File

@@ -25,8 +25,8 @@ import android.provider.ContactsContract;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.Groups;
import android.provider.ContactsContract.RawContacts;
import android.provider.ContactsContract.CommonDataKinds.Birthday;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Event;
import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
import android.provider.ContactsContract.CommonDataKinds.Im;
import android.provider.ContactsContract.CommonDataKinds.Nickname;
@@ -1317,9 +1317,10 @@ public class ContactStruct {
if (!TextUtils.isEmpty(mBirthday)) {
builder = ContentProviderOperation.newInsert(Data.CONTENT_URI);
builder.withValueBackReference(Birthday.RAW_CONTACT_ID, 0);
builder.withValue(Data.MIMETYPE, Birthday.CONTENT_ITEM_TYPE);
builder.withValue(Birthday.BIRTHDAY, mBirthday);
builder.withValueBackReference(Event.RAW_CONTACT_ID, 0);
builder.withValue(Data.MIMETYPE, Event.CONTENT_ITEM_TYPE);
builder.withValue(Event.START_DATE, mBirthday);
builder.withValue(Event.TYPE, Event.TYPE_BIRTHDAY);
operationList.add(builder.build());
}

View File

@@ -30,8 +30,8 @@ import android.provider.CallLog.Calls;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
import android.provider.ContactsContract.CommonDataKinds.Birthday;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Event;
import android.provider.ContactsContract.CommonDataKinds.Im;
import android.provider.ContactsContract.CommonDataKinds.Nickname;
import android.provider.ContactsContract.CommonDataKinds.Note;
@@ -1301,12 +1301,16 @@ public class VCardComposer {
private void appendBirthday(final StringBuilder builder,
final Map<String, List<ContentValues>> contentValuesListMap) {
final List<ContentValues> 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();
}

View File

@@ -1691,26 +1691,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
* <P>Type: TEXT</P>
*/
public static final String BIRTHDAY = DATA1;
}
/**
* Common data definition for relations.
*/
@@ -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.
* <P>Type: TEXT</P>
*/
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;
}
}
}
/**

View File

@@ -1243,6 +1243,13 @@
<!-- MMS phone number type -->
<string name="phoneTypeMms">MMS</string>
<!-- Label for a birthday event -->
<string name="eventTypeBirthday">Birthday</string>
<!-- Label for an anniversary event -->
<string name="eventTypeAnniversary">Anniversary</string>
<!-- Label for other events -->
<string name="eventTypeOther">Event</string>
<!-- Custom email type -->
<string name="emailTypeCustom">Custom</string>
<!-- Home email type -->
@@ -1299,7 +1306,7 @@
<string name="orgTypeOther">Other</string>
<!-- Custom organization type -->
<string name="orgTypeCustom">Custom</string>
<!-- Attbution of a contact status update, when the time of update is unknown -->
<string name="contact_status_update_attribution">Via <xliff:g id="source" example="Google Talk">%1$s</xliff:g></string>