Add all-day information to invitation text
* Added two new strings
* Use four combinations depending on allday and recurring state
Bug: 5205440
Change-Id: Ieab7d6ba41fc1d0d6e74e377146b057e240d32fc
diff --git a/res/values/strings.xml b/res/values/strings.xml
index a722a88..4966e0c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -81,6 +81,20 @@
<xliff:g id="eventdate" example="Tue, Mar 10, 2010 at 2:30 pm">%s</xliff:g>
(recurring)
</string>
+ <!-- Indicate that a meeting lasts all day. This would normally be presented
+ after "When: xxx", e.g. "When: Tue, Mar 10, 2010 (all day)" -->
+ <string name="meeting_allday">
+ When:
+ <xliff:g id="eventdate" example="Tue, Mar 10, 2010 ">%s</xliff:g>
+ (all day)
+ </string>
+ <!-- Indicate that a meeting lasts all day and is recurring. This would normally be presented
+ after "When: xxx", e.g. "When: Tue, Mar 10, 2010 (all day, recurring)" -->
+ <string name="meeting_allday_recurring">
+ When:
+ <xliff:g id="eventdate" example="Tue, Mar 10, 2010 ">%s</xliff:g>
+ (all day, recurring)
+ </string>
<!-- Notification message in notifications window when calendar sync is
automatically enabled for pre-existing Exchange accounts on upgrade -->
diff --git a/src/com/android/exchange/utility/CalendarUtilities.java b/src/com/android/exchange/utility/CalendarUtilities.java
index 04f2702..fbd92e5 100644
--- a/src/com/android/exchange/utility/CalendarUtilities.java
+++ b/src/com/android/exchange/utility/CalendarUtilities.java
@@ -1467,19 +1467,32 @@
}
Resources resources = context.getResources();
Date date = new Date(entityValues.getAsLong(Events.DTSTART));
- String dateTimeString = DateFormat.getDateTimeInstance().format(date);
// TODO: Add more detail to message text
// Right now, we're using.. When: Tuesday, March 5th at 2:00pm
// What we're missing is the duration and any recurrence information. So this should be
// more like... When: Tuesdays, starting March 5th from 2:00pm - 3:00pm
// This would require code to build complex strings, and it will have to wait
// For now, we'll just use the meeting_recurring string
- if (!entityValues.containsKey(Events.ORIGINAL_SYNC_ID) &&
- entityValues.containsKey(Events.RRULE)) {
- sb.append(resources.getString(R.string.meeting_recurring, dateTimeString));
- } else {
- sb.append(resources.getString(R.string.meeting_when, dateTimeString));
+
+ boolean allDayEvent = false;
+ if (entityValues.containsKey(Events.ALL_DAY)) {
+ Integer ade = entityValues.getAsInteger(Events.ALL_DAY);
+ allDayEvent = (ade != null) && (ade == 1);
}
+ boolean recurringEvent = !entityValues.containsKey(Events.ORIGINAL_SYNC_ID) &&
+ entityValues.containsKey(Events.RRULE);
+
+ String dateTimeString;
+ int res;
+ if (allDayEvent) {
+ dateTimeString = DateFormat.getDateInstance().format(date);
+ res = recurringEvent ? R.string.meeting_allday_recurring : R.string.meeting_allday;
+ } else {
+ dateTimeString = DateFormat.getDateTimeInstance().format(date);
+ res = recurringEvent ? R.string.meeting_recurring : R.string.meeting_when;
+ }
+ sb.append(resources.getString(res, dateTimeString));
+
String location = null;
if (entityValues.containsKey(Events.EVENT_LOCATION)) {
location = entityValues.getAsString(Events.EVENT_LOCATION);