mirror of
https://github.com/etesync/android
synced 2024-12-23 15:18:14 +00:00
Event invites: add timezone information to email summary.
This commit is contained in:
parent
1b980bfbf5
commit
f5d08e07bb
@ -46,6 +46,7 @@ import java.util.Calendar;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import at.bitfire.ical4android.CalendarStorageException;
|
import at.bitfire.ical4android.CalendarStorageException;
|
||||||
import at.bitfire.ical4android.Event;
|
import at.bitfire.ical4android.Event;
|
||||||
@ -221,13 +222,17 @@ public class CalendarSyncManager extends SyncManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String formatEventDates(Event event) {
|
private static String formatEventDates(Event event) {
|
||||||
|
final Locale locale = Locale.US;
|
||||||
final String dateFormatString =
|
final String dateFormatString =
|
||||||
event.isAllDay() ? "EEEE, MMM dd" : "EEEE, MMM dd @ hh:mm a";
|
event.isAllDay() ? "EEEE, MMM dd" : "EEEE, MMM dd @ hh:mm a";
|
||||||
final DateFormat dateFormat =
|
final DateFormat dateFormat =
|
||||||
new SimpleDateFormat(dateFormatString,
|
new SimpleDateFormat(dateFormatString, locale);
|
||||||
Locale.US);
|
final TimeZone timezone = event.dtStart.getTimeZone();
|
||||||
Date startDate = event.dtStart.getDate();
|
Date startDate = event.dtStart.getDate();
|
||||||
Date endDate = event.getEndDate(true).getDate();
|
Date endDate = event.getEndDate(true).getDate();
|
||||||
|
final String tzName = (timezone != null) ?
|
||||||
|
timezone.getDisplayName(timezone.inDaylightTime(startDate), TimeZone.SHORT)
|
||||||
|
: "UTC";
|
||||||
Calendar cal1 = Calendar.getInstance();
|
Calendar cal1 = Calendar.getInstance();
|
||||||
Calendar cal2 = Calendar.getInstance();
|
Calendar cal2 = Calendar.getInstance();
|
||||||
cal1.setTime(startDate);
|
cal1.setTime(startDate);
|
||||||
@ -238,10 +243,11 @@ public class CalendarSyncManager extends SyncManager {
|
|||||||
return dateFormat.format(startDate);
|
return dateFormat.format(startDate);
|
||||||
}
|
}
|
||||||
return sameDay ?
|
return sameDay ?
|
||||||
String.format("%s - %s",
|
String.format("%s - %s (%s)",
|
||||||
dateFormat.format(startDate),
|
dateFormat.format(startDate),
|
||||||
new SimpleDateFormat("hh:mm a", Locale.US).format(endDate)) :
|
new SimpleDateFormat("hh:mm a", Locale.US).format(endDate),
|
||||||
String.format("%s - %s", dateFormat.format(startDate), dateFormat.format(endDate));
|
tzName) :
|
||||||
|
String.format("%s - %s (%s)", dateFormat.format(startDate), dateFormat.format(endDate), tzName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Uri createAttachmentFromString(Context context, String name, String content) {
|
private Uri createAttachmentFromString(Context context, String name, String content) {
|
||||||
|
Loading…
Reference in New Issue
Block a user