Merge "Add message text for invitation replies" into froyo

This commit is contained in:
Marc Blank 2010-03-29 12:08:14 -07:00 committed by Android (Google) Code Review
commit 31edb63c24
2 changed files with 29 additions and 41 deletions

View File

@ -43,7 +43,6 @@ import android.provider.Calendar.Attendees;
import android.provider.Calendar.Calendars;
import android.provider.Calendar.Events;
import android.provider.Calendar.EventsEntity;
import android.provider.Calendar.Reminders;
import android.text.format.Time;
import android.util.Log;
import android.util.base64.Base64;
@ -1344,16 +1343,11 @@ public class CalendarUtilities {
if (titleId != 0) {
msg.mSubject = resources.getString(titleId, title);
}
if (method.equals("REQUEST")) {
if (entityValues.containsKey(Events.ALL_DAY)) {
Integer ade = entityValues.getAsInteger(Events.ALL_DAY);
ics.writeTag("X-MICROSOFT-CDO-ALLDAYEVENT", ade == 0 ? "FALSE" : "TRUE");
}
// Build the text for the message, starting with an initial line describing the
// exception
// exception (if this is one)
StringBuilder sb = new StringBuilder();
if (isException) {
if (isException && method.equals("REQUEST")) {
// Add the line, depending on whether this is a cancellation or update
Date date = new Date(entityValues.getAsLong(Events.ORIGINAL_INSTANCE_TIME));
String dateString = DateFormat.getDateInstance().format(date);
@ -1367,33 +1361,24 @@ public class CalendarUtilities {
String text =
CalendarUtilities.buildMessageTextFromEntityValues(context, entityValues, sb);
// If we've got anything here, write it into the ics file
if (text.length() > 0) {
ics.writeTag("DESCRIPTION", text);
}
// And store the message text
msg.mText = text;
if (method.equals("REQUEST")) {
if (entityValues.containsKey(Events.ALL_DAY)) {
Integer ade = entityValues.getAsInteger(Events.ALL_DAY);
ics.writeTag("X-MICROSOFT-CDO-ALLDAYEVENT", ade == 0 ? "FALSE" : "TRUE");
}
String rrule = entityValues.getAsString(Events.RRULE);
if (rrule != null) {
ics.writeTag("RRULE", rrule);
}
// Handle associated data EXCEPT for attendees, which have to be grouped
for (NamedContentValues ncv: subValues) {
Uri ncvUri = ncv.uri;
if (ncvUri.equals(Reminders.CONTENT_URI)) {
// TODO Consider sending alarm information in the meeting request, though
// it's not obviously appropriate (i.e. telling the user what alarm to use)
// This should be for REQUEST only
// Here's what the VALARM would look like:
// BEGIN:VALARM
// ACTION:DISPLAY
// DESCRIPTION:REMINDER
// TRIGGER;RELATED=START:-PT15M
// END:VALARM
}
}
// If we decide to send alarm information in the meeting request ics file,
// handle it here by looping through the subvalues
}
// Handle attendee data here; determine "to" list and add ATTENDEE tags to ics

View File

@ -244,8 +244,11 @@ public class CalendarUtilitiesTests extends AndroidTestCase {
// Now check some of the fields of the message
assertEquals(Address.pack(new Address[] {new Address(ORGANIZER)}), msg.mTo);
String accept = getContext().getResources().getString(R.string.meeting_accepted, title);
Resources resources = getContext().getResources();
String accept = resources.getString(R.string.meeting_accepted, title);
assertEquals(accept, msg.mSubject);
assertNotNull(msg.mText);
assertTrue(msg.mText.contains(resources.getString(R.string.meeting_where, "")));
// And make sure we have an attachment
assertNotNull(msg.mAttachments);