mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-04 06:20:26 +00:00
Refactoring
This commit is contained in:
parent
0f60b6b751
commit
51e0613c54
1 changed files with 12 additions and 10 deletions
|
@ -157,11 +157,19 @@ public class CalendarHelper {
|
||||||
ICalDate start = (event.getDateStart() == null ? null : event.getDateStart().getValue());
|
ICalDate start = (event.getDateStart() == null ? null : event.getDateStart().getValue());
|
||||||
ICalDate end = (event.getDateEnd() == null ? null : event.getDateEnd().getValue());
|
ICalDate end = (event.getDateEnd() == null ? null : event.getDateEnd().getValue());
|
||||||
|
|
||||||
|
// Assume one time zone
|
||||||
|
TimezoneInfo tzinfo = icalendar.getTimezoneInfo();
|
||||||
|
TimezoneAssignment tza = (tzinfo == null ? null : tzinfo.getTimezone(event.getDateStart()));
|
||||||
|
TimeZone tz = (tza == null ? null : tza.getTimeZone());
|
||||||
|
//if (tz != null && "W. Europe Standard Time".equals(tz.getID()))
|
||||||
|
// tz.setID("GMT");
|
||||||
|
String tzid = (tz == null ? TimeZone.getDefault().getID() : tz.getID());
|
||||||
|
|
||||||
String rrule = null;
|
String rrule = null;
|
||||||
RecurrenceRule recurrence = event.getRecurrenceRule();
|
RecurrenceRule recurrence = event.getRecurrenceRule();
|
||||||
if (recurrence != null) {
|
if (recurrence != null) {
|
||||||
RecurrenceRuleScribe scribe = new RecurrenceRuleScribe();
|
RecurrenceRuleScribe scribe = new RecurrenceRuleScribe();
|
||||||
WriteContext wcontext = new WriteContext(ICalVersion.V2_0, icalendar.getTimezoneInfo(), null);
|
WriteContext wcontext = new WriteContext(ICalVersion.V2_0, tzinfo, null);
|
||||||
rrule = scribe.writeText(recurrence, wcontext);
|
rrule = scribe.writeText(recurrence, wcontext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,13 +209,7 @@ public class CalendarHelper {
|
||||||
if (!TextUtils.isEmpty(organizer))
|
if (!TextUtils.isEmpty(organizer))
|
||||||
values.put(CalendarContract.Events.ORGANIZER, organizer);
|
values.put(CalendarContract.Events.ORGANIZER, organizer);
|
||||||
|
|
||||||
// Assume one time zone
|
values.put(CalendarContract.Events.EVENT_TIMEZONE, tzid);
|
||||||
TimezoneInfo tzinfo = icalendar.getTimezoneInfo();
|
|
||||||
TimezoneAssignment tza = (tzinfo == null ? null : tzinfo.getTimezone(event.getDateStart()));
|
|
||||||
TimeZone tz = (tza == null ? null : tza.getTimeZone());
|
|
||||||
values.put(CalendarContract.Events.EVENT_TIMEZONE,
|
|
||||||
tz == null ? TimeZone.getDefault().getID() : tz.getID());
|
|
||||||
|
|
||||||
values.put(CalendarContract.Events.DTSTART, start.getTime());
|
values.put(CalendarContract.Events.DTSTART, start.getTime());
|
||||||
values.put(CalendarContract.Events.DTEND, end.getTime());
|
values.put(CalendarContract.Events.DTEND, end.getTime());
|
||||||
|
|
||||||
|
@ -230,7 +232,7 @@ public class CalendarHelper {
|
||||||
" id=" + calId + ":" + eventId +
|
" id=" + calId + ":" + eventId +
|
||||||
" uid=" + uid +
|
" uid=" + uid +
|
||||||
" organizer=" + organizer +
|
" organizer=" + organizer +
|
||||||
" tz=" + (tz == null ? null : tz.getID()) +
|
" tz=" + tzid +
|
||||||
" start=" + new Date(start.getTime()) +
|
" start=" + new Date(start.getTime()) +
|
||||||
" end=" + new Date(end.getTime()) +
|
" end=" + new Date(end.getTime()) +
|
||||||
" rrule=" + rrule +
|
" rrule=" + rrule +
|
||||||
|
@ -244,7 +246,7 @@ public class CalendarHelper {
|
||||||
" id=" + calId + ":" + existId +
|
" id=" + calId + ":" + existId +
|
||||||
" uid=" + uid +
|
" uid=" + uid +
|
||||||
" organizer=" + organizer +
|
" organizer=" + organizer +
|
||||||
" tz=" + (tz == null ? null : tz.getID()) +
|
" tz=" + tzid +
|
||||||
" start=" + new Date(start.getTime()) +
|
" start=" + new Date(start.getTime()) +
|
||||||
" end=" + new Date(end.getTime()) +
|
" end=" + new Date(end.getTime()) +
|
||||||
" rrule=" + rrule +
|
" rrule=" + rrule +
|
||||||
|
|
Loading…
Reference in a new issue