diff --git a/app/src/androidTest/java/at/bitfire/davdroid/resource/ContactTest.java b/app/src/androidTest/java/at/bitfire/davdroid/resource/ContactTest.java index 8fd17e8c..472c5f32 100644 --- a/app/src/androidTest/java/at/bitfire/davdroid/resource/ContactTest.java +++ b/app/src/androidTest/java/at/bitfire/davdroid/resource/ContactTest.java @@ -45,7 +45,7 @@ public class ContactTest extends InstrumentationTestCase { assertTrue(new String(c.toEntity().toByteArray()).contains("VERSION:3.0")); // now let's generate VCard 4.0 - c.setVCardVersion(VCardVersion.V4_0); + c.vCardVersion = VCardVersion.V4_0; assertEquals("text/vcard; version=4.0", c.getContentType().toString()); assertTrue(new String(c.toEntity().toByteArray()).contains("VERSION:4.0")); } @@ -53,11 +53,11 @@ public class ContactTest extends InstrumentationTestCase { public void testReferenceVCard3() throws IOException, InvalidResourceException { Contact c = parseVCF("reference-vcard3.vcf", Charset.forName(CharEncoding.UTF_8)); - assertEquals("Gümp", c.getFamilyName()); - assertEquals("Förrest", c.getGivenName()); - assertEquals("Förrest Gümp", c.getDisplayName()); - assertEquals("Bubba Gump Shrimpß Co.", c.getOrganization().getValues().get(0)); - assertEquals("Shrimp Man", c.getJobTitle()); + assertEquals("Gümp", c.familyName); + assertEquals("Förrest", c.givenName); + assertEquals("Förrest Gümp", c.displayName); + assertEquals("Bubba Gump Shrimpß Co.", c.organization.getValues().get(0)); + assertEquals("Shrimp Man", c.jobTitle); Telephone phone1 = c.getPhoneNumbers().get(0); assertEquals("(111) 555-1212", phone1.getText()); @@ -76,21 +76,21 @@ public class ContactTest extends InstrumentationTestCase { @Cleanup InputStream photoStream = assetMgr.open("davdroid-logo-192.png", AssetManager.ACCESS_STREAMING); byte[] expectedPhoto = IOUtils.toByteArray(photoStream); - assertTrue(Arrays.equals(c.getPhoto(), expectedPhoto)); + assertTrue(Arrays.equals(c.photo, expectedPhoto)); } public void testParseInvalidUnknownProperties() throws IOException { Contact c = parseVCF("invalid-unknown-properties.vcf"); - assertEquals("VCard with invalid unknown properties", c.getDisplayName()); - assertNull(c.getUnknownProperties()); + assertEquals("VCard with invalid unknown properties", c.displayName); + assertNull(c.unknownProperties); } public void testParseLatin1() throws IOException { Contact c = parseVCF("latin1.vcf", Charset.forName(CharEncoding.ISO_8859_1)); - assertEquals("Özkan Äuçek", c.getDisplayName()); - assertEquals("Özkan", c.getGivenName()); - assertEquals("Äuçek", c.getFamilyName()); - assertNull(c.getUnknownProperties()); + assertEquals("Özkan Äuçek", c.displayName); + assertEquals("Özkan", c.givenName); + assertEquals("Äuçek", c.familyName); + assertNull(c.unknownProperties); } diff --git a/app/src/androidTest/java/at/bitfire/davdroid/resource/EventTest.java b/app/src/androidTest/java/at/bitfire/davdroid/resource/EventTest.java index 9909c384..19bef967 100644 --- a/app/src/androidTest/java/at/bitfire/davdroid/resource/EventTest.java +++ b/app/src/androidTest/java/at/bitfire/davdroid/resource/EventTest.java @@ -61,8 +61,8 @@ public class EventTest extends InstrumentationTestCase { assertEquals(1, event.getExceptions().size()); Event exception = event.getExceptions().get(0); - assertEquals("20150503", exception.getRecurrenceId().getValue()); - assertEquals("Another summary for the third day", exception.getSummary()); + assertEquals("20150503", exception.recurrenceId.getValue()); + assertEquals("Another summary for the third day", exception.summary); } public void testStartEndTimes() throws IOException, ParserException, InvalidResourceException { @@ -104,7 +104,7 @@ public class EventTest extends InstrumentationTestCase { public void testUnfolding() throws IOException, InvalidResourceException { Event e = parseCalendar("two-line-description-without-crlf.ics"); - assertEquals("http://www.tgbornheim.de/index.php?sessionid=&page=&id=&sportcentergroup=&day=6", e.getDescription()); + assertEquals("http://www.tgbornheim.de/index.php?sessionid=&page=&id=&sportcentergroup=&day=6", e.description); } diff --git a/app/src/androidTest/java/at/bitfire/davdroid/resource/LocalCalendarTest.java b/app/src/androidTest/java/at/bitfire/davdroid/resource/LocalCalendarTest.java index aef23aa7..fb81ffdd 100644 --- a/app/src/androidTest/java/at/bitfire/davdroid/resource/LocalCalendarTest.java +++ b/app/src/androidTest/java/at/bitfire/davdroid/resource/LocalCalendarTest.java @@ -150,15 +150,15 @@ public class LocalCalendarTest extends InstrumentationTestCase { assertNotNull("Couldn't build and insert event", event); // compare with original event try { - assertEquals(event.getSummary(), event2.getSummary()); - assertEquals(event.getDescription(), event2.getDescription()); - assertEquals(event.getLocation(), event2.getLocation()); - assertEquals(event.getDtStart(), event2.getDtStart()); + assertEquals(event.summary, event2.summary); + assertEquals(event.description, event2.description); + assertEquals(event.location, event2.location); + assertEquals(event.dtStart, event2.dtStart); assertFalse(event2.isAllDay()); assertEquals(1, event2.getAlarms().size()); VAlarm alarm = event2.getAlarms().get(0); - assertEquals(event.getSummary(), alarm.getDescription().getValue()); // should be built from event name + assertEquals(event.summary, alarm.getDescription().getValue()); // should be built from event name assertEquals(new Dur(0, 0, -(24*60 + 60*2 + 3), 0), alarm.getTrigger().getDuration()); // calendar provider stores trigger in minutes } finally { testCalendar.delete(event); @@ -184,10 +184,10 @@ public class LocalCalendarTest extends InstrumentationTestCase { assertNotNull("Couldn't build and insert event", event); // compare with original event try { - assertEquals(event.getSummary(), event2.getSummary()); - assertEquals(event.getDescription(), event2.getDescription()); - assertEquals(event.getLocation(), event2.getLocation()); - assertEquals(event.getDtStart(), event2.getDtStart()); + assertEquals(event.summary, event2.summary); + assertEquals(event.description, event2.description); + assertEquals(event.location, event2.location); + assertEquals(event.dtStart, event2.dtStart); assertTrue(event2.isAllDay()); } finally { testCalendar.delete(event); diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ab255812..477c7fbe 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,7 +9,7 @@ phoneNumbers = new LinkedList<>(); @Getter private List emails = new LinkedList<>(); @Getter private List impps = new LinkedList<>(); diff --git a/app/src/main/java/at/bitfire/davdroid/resource/Event.java b/app/src/main/java/at/bitfire/davdroid/resource/Event.java index ab8c2e74..767c78bc 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/Event.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/Event.java @@ -66,28 +66,30 @@ import lombok.Setter; public class Event extends iCalendar { private final static String TAG = "davdroid.Event"; - @Getter @Setter protected RecurrenceId recurrenceId; + protected RecurrenceId recurrenceId; - @Getter @Setter protected String summary, location, description; - - @Getter protected DtStart dtStart; - @Getter protected DtEnd dtEnd; - @Getter @Setter protected Duration duration; - @Getter protected List rdates = new LinkedList<>(); - @Getter @Setter protected RRule rrule; - @Getter protected List exdates = new LinkedList<>(); - @Getter @Setter protected ExRule exrule; - @Getter protected List exceptions = new LinkedList<>(); - - @Getter @Setter protected Boolean forPublic; - @Getter @Setter protected Status status; + protected String summary, location, description; + + protected DtStart dtStart; + protected DtEnd dtEnd; + + // lists must not be set to null (because they're iterated using "for"), so only getters are exposed + protected Duration duration; + @Getter private List rdates = new LinkedList<>(); + protected RRule rrule; + @Getter private List exdates = new LinkedList<>(); + protected ExRule exrule; + @Getter private List exceptions = new LinkedList<>(); + + protected Boolean forPublic; + protected Status status; - @Getter @Setter protected boolean opaque; + protected boolean opaque; - @Getter @Setter protected Organizer organizer; - @Getter protected List attendees = new LinkedList<>(); + protected Organizer organizer; + @Getter private List attendees = new LinkedList<>(); - @Getter protected List alarms = new LinkedList<>(); + @Getter private List alarms = new LinkedList<>(); public Event(String name, String ETag) { diff --git a/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.java b/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.java index d7d8bb62..ff901aab 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/LocalAddressBook.java @@ -136,7 +136,7 @@ public class LocalAddressBook extends LocalCollection { public Contact newResource(long localID, String resourceName, String eTag) { Contact c = new Contact(localID, resourceName, eTag); - c.setVCardVersion(accountSettings.getAddressBookVCardVersion()); + c.vCardVersion = accountSettings.getAddressBookVCardVersion(); return c; } @@ -187,8 +187,8 @@ public class LocalAddressBook extends LocalCollection { ContentValues values = e.getEntityValues(); c.setUid(values.getAsString(entryColumnUID())); - c.setUnknownProperties(values.getAsString(COLUMN_UNKNOWN_PROPERTIES)); - c.setStarred(values.getAsInteger(RawContacts.STARRED) != 0); + c.unknownProperties = values.getAsString(COLUMN_UNKNOWN_PROPERTIES); + c.starred = values.getAsInteger(RawContacts.STARRED) != 0; List subValues = e.getSubValues(); for (Entity.NamedContentValues subValue : subValues) { @@ -247,17 +247,17 @@ public class LocalAddressBook extends LocalCollection { } private void populateStructuredName(Contact c, ContentValues row) { - c.setDisplayName(row.getAsString(StructuredName.DISPLAY_NAME)); + c.displayName = row.getAsString(StructuredName.DISPLAY_NAME); - c.setPrefix(row.getAsString(StructuredName.PREFIX)); - c.setGivenName(row.getAsString(StructuredName.GIVEN_NAME)); - c.setMiddleName(row.getAsString(StructuredName.MIDDLE_NAME)); - c.setFamilyName(row.getAsString(StructuredName.FAMILY_NAME)); - c.setSuffix(row.getAsString(StructuredName.SUFFIX)); + c.prefix = row.getAsString(StructuredName.PREFIX); + c.givenName = row.getAsString(StructuredName.GIVEN_NAME); + c.middleName = row.getAsString(StructuredName.MIDDLE_NAME); + c.familyName = row.getAsString(StructuredName.FAMILY_NAME); + c.suffix = row.getAsString(StructuredName.SUFFIX); - c.setPhoneticGivenName(row.getAsString(StructuredName.PHONETIC_GIVEN_NAME)); - c.setPhoneticMiddleName(row.getAsString(StructuredName.PHONETIC_MIDDLE_NAME)); - c.setPhoneticFamilyName(row.getAsString(StructuredName.PHONETIC_FAMILY_NAME)); + c.phoneticGivenName = row.getAsString(StructuredName.PHONETIC_GIVEN_NAME); + c.phoneticMiddleName = row.getAsString(StructuredName.PHONETIC_MIDDLE_NAME); + c.phoneticFamilyName = row.getAsString(StructuredName.PHONETIC_FAMILY_NAME); } protected void populatePhoneNumber(Contact c, ContentValues row) { @@ -364,12 +364,12 @@ public class LocalAddressBook extends LocalCollection { try { @Cleanup AssetFileDescriptor fd = providerClient.openAssetFile(photoUri, "r"); @Cleanup InputStream is = fd.createInputStream(); - c.setPhoto(IOUtils.toByteArray(is)); + c.photo = IOUtils.toByteArray(is); } catch(IOException ex) { Log.w(TAG, "Couldn't read high-res contact photo", ex); } } else - c.setPhoto(row.getAsByteArray(Photo.PHOTO)); + c.photo = row.getAsByteArray(Photo.PHOTO); } protected void populateOrganization(Contact c, ContentValues row) { @@ -384,13 +384,13 @@ public class LocalAddressBook extends LocalCollection { org.addValue(company); if (StringUtils.isNotEmpty(department)) org.addValue(department); - c.setOrganization(org); + c.organization = org; } if (StringUtils.isNotEmpty(title)) - c.setJobTitle(title); + c.jobTitle = title; if (StringUtils.isNotEmpty(role)) - c.setJobDescription(role); + c.jobDescription = role; } protected void populateIMPP(Contact c, ContentValues row) { @@ -449,11 +449,11 @@ public class LocalAddressBook extends LocalCollection { protected void populateNickname(Contact c, ContentValues row) { // TYPE (maiden name, short name, …) and LABEL are not processed here because Contacts app doesn't support it - c.setNickName(row.getAsString(Nickname.NAME)); + c.nickName = row.getAsString(Nickname.NAME); } protected void populateNote(Contact c, ContentValues row) { - c.setNote(row.getAsString(Note.NOTE)); + c.note = row.getAsString(Note.NOTE); } protected void populatePostalAddress(Contact c, ContentValues row) { @@ -539,10 +539,10 @@ public class LocalAddressBook extends LocalCollection { Date date = formatter.parse(row.getAsString(CommonDataKinds.Event.START_DATE)); switch (row.getAsInteger(CommonDataKinds.Event.TYPE)) { case CommonDataKinds.Event.TYPE_ANNIVERSARY: - c.setAnniversary(new Anniversary(date)); + c.anniversary = new Anniversary(date); break; case CommonDataKinds.Event.TYPE_BIRTHDAY: - c.setBirthDay(new Birthday(date)); + c.birthDay = new Birthday(date); break; } } catch (ParseException e) { @@ -658,8 +658,8 @@ public class LocalAddressBook extends LocalCollection { .withValue(entryColumnRemoteName(), contact.getName()) .withValue(entryColumnUID(), contact.getUid()) .withValue(entryColumnETag(), contact.getETag()) - .withValue(COLUMN_UNKNOWN_PROPERTIES, contact.getUnknownProperties()) - .withValue(RawContacts.STARRED, contact.isStarred() ? 1 : 0); + .withValue(COLUMN_UNKNOWN_PROPERTIES, contact.unknownProperties) + .withValue(RawContacts.STARRED, contact.starred ? 1 : 0); } @@ -675,19 +675,19 @@ public class LocalAddressBook extends LocalCollection { for (ezvcard.property.Email email : contact.getEmails()) queueOperation(buildEmail(newDataInsertBuilder(localID, backrefIdx), email)); - if (contact.getPhoto() != null) - queueOperation(buildPhoto(newDataInsertBuilder(localID, backrefIdx), contact.getPhoto())); + if (contact.photo != null) + queueOperation(buildPhoto(newDataInsertBuilder(localID, backrefIdx), contact.photo)); queueOperation(buildOrganization(newDataInsertBuilder(localID, backrefIdx), contact)); for (Impp impp : contact.getImpps()) queueOperation(buildIMPP(newDataInsertBuilder(localID, backrefIdx), impp)); - if (contact.getNickName() != null) - queueOperation(buildNickName(newDataInsertBuilder(localID, backrefIdx), contact.getNickName())); + if (contact.nickName != null) + queueOperation(buildNickName(newDataInsertBuilder(localID, backrefIdx), contact.nickName)); - if (contact.getNote() != null) - queueOperation(buildNote(newDataInsertBuilder(localID, backrefIdx), contact.getNote())); + if (contact.note != null) + queueOperation(buildNote(newDataInsertBuilder(localID, backrefIdx), contact.note)); for (Address address : contact.getAddresses()) queueOperation(buildAddress(newDataInsertBuilder(localID, backrefIdx), address)); @@ -698,10 +698,10 @@ public class LocalAddressBook extends LocalCollection { for (String url : contact.getURLs()) queueOperation(buildURL(newDataInsertBuilder(localID, backrefIdx), url)); - if (contact.getAnniversary() != null) - queueOperation(buildEvent(newDataInsertBuilder(localID, backrefIdx), contact.getAnniversary(), CommonDataKinds.Event.TYPE_ANNIVERSARY)); - if (contact.getBirthDay() != null) - queueOperation(buildEvent(newDataInsertBuilder(localID, backrefIdx), contact.getBirthDay(), CommonDataKinds.Event.TYPE_BIRTHDAY)); + if (contact.anniversary != null) + queueOperation(buildEvent(newDataInsertBuilder(localID, backrefIdx), contact.anniversary, CommonDataKinds.Event.TYPE_ANNIVERSARY)); + if (contact.birthDay != null) + queueOperation(buildEvent(newDataInsertBuilder(localID, backrefIdx), contact.birthDay, CommonDataKinds.Event.TYPE_BIRTHDAY)); for (Related related : contact.getRelations()) for (RelatedType type : related.getTypes()) @@ -721,15 +721,15 @@ public class LocalAddressBook extends LocalCollection { protected Builder buildStructuredName(Builder builder, Contact contact) { return builder .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE) - .withValue(StructuredName.PREFIX, contact.getPrefix()) - .withValue(StructuredName.DISPLAY_NAME, contact.getDisplayName()) - .withValue(StructuredName.GIVEN_NAME, contact.getGivenName()) - .withValue(StructuredName.MIDDLE_NAME, contact.getMiddleName()) - .withValue(StructuredName.FAMILY_NAME, contact.getFamilyName()) - .withValue(StructuredName.SUFFIX, contact.getSuffix()) - .withValue(StructuredName.PHONETIC_GIVEN_NAME, contact.getPhoneticGivenName()) - .withValue(StructuredName.PHONETIC_MIDDLE_NAME, contact.getPhoneticMiddleName()) - .withValue(StructuredName.PHONETIC_FAMILY_NAME, contact.getPhoneticFamilyName()); + .withValue(StructuredName.PREFIX, contact.prefix) + .withValue(StructuredName.DISPLAY_NAME, contact.displayName) + .withValue(StructuredName.GIVEN_NAME, contact.givenName) + .withValue(StructuredName.MIDDLE_NAME, contact.middleName) + .withValue(StructuredName.FAMILY_NAME, contact.familyName) + .withValue(StructuredName.SUFFIX, contact.suffix) + .withValue(StructuredName.PHONETIC_GIVEN_NAME, contact.phoneticGivenName) + .withValue(StructuredName.PHONETIC_MIDDLE_NAME, contact.phoneticMiddleName) + .withValue(StructuredName.PHONETIC_FAMILY_NAME, contact.phoneticFamilyName); } protected Builder buildPhoneNumber(Builder builder, Telephone number) { @@ -842,10 +842,10 @@ public class LocalAddressBook extends LocalCollection { } protected Builder buildOrganization(Builder builder, Contact contact) { - if (contact.getOrganization() == null && contact.getJobTitle() == null && contact.getJobDescription() == null) + if (contact.organization == null && contact.jobTitle == null && contact.jobDescription == null) return null; - ezvcard.property.Organization organization = contact.getOrganization(); + ezvcard.property.Organization organization = contact.organization; String company = null, department = null; if (organization != null) { Iterator org = organization.getValues().iterator(); @@ -859,8 +859,8 @@ public class LocalAddressBook extends LocalCollection { .withValue(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE) .withValue(Organization.COMPANY, company) .withValue(Organization.DEPARTMENT, department) - .withValue(Organization.TITLE, contact.getJobTitle()) - .withValue(Organization.JOB_DESCRIPTION, contact.getJobDescription()); + .withValue(Organization.TITLE, contact.jobTitle) + .withValue(Organization.JOB_DESCRIPTION, contact.jobDescription); } protected Builder buildIMPP(Builder builder, Impp impp) { diff --git a/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java b/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java index d2e723e2..56a8d426 100644 --- a/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java +++ b/app/src/main/java/at/bitfire/davdroid/resource/LocalCalendar.java @@ -78,8 +78,8 @@ import lombok.Getter; public class LocalCalendar extends LocalCollection { private static final String TAG = "davdroid.LocalCalendar"; - @Getter private String url; - @Getter private long id; + @Getter protected String url; + @Getter protected long id; protected static final String COLLECTION_COLUMN_CTAG = Calendars.CAL_SYNC1; @@ -333,9 +333,9 @@ public class LocalCalendar extends LocalCollection { protected void populateEvent(Event e, ContentValues values) { e.setUid(values.getAsString(entryColumnUID())); - e.setSummary(values.getAsString(Events.TITLE)); - e.setLocation(values.getAsString(Events.EVENT_LOCATION)); - e.setDescription(values.getAsString(Events.DESCRIPTION)); + e.summary = values.getAsString(Events.TITLE); + e.location = values.getAsString(Events.EVENT_LOCATION); + e.description = values.getAsString(Events.DESCRIPTION); final boolean allDay = values.getAsInteger(Events.ALL_DAY) != 0; final long tsStart = values.getAsLong(Events.DTSTART); @@ -360,14 +360,14 @@ public class LocalCalendar extends LocalCollection { if (tsEnd != null) e.setDtEnd(tsEnd, tzId); else if (!StringUtils.isEmpty(duration)) - e.setDuration(new Duration(new Dur(duration))); + e.duration = new Duration(new Dur(duration)); } // recurrence try { String strRRule = values.getAsString(Events.RRULE); if (!StringUtils.isEmpty(strRRule)) - e.setRrule(new RRule(strRRule)); + e.rrule = new RRule(strRRule); String strRDate = values.getAsString(Events.RDATE); if (!StringUtils.isEmpty(strRDate)) { @@ -379,7 +379,7 @@ public class LocalCalendar extends LocalCollection { if (!StringUtils.isEmpty(strExRule)) { ExRule exRule = new ExRule(); exRule.setValue(strExRule); - e.setExrule(exRule); + e.exrule = exRule; } String strExDate = values.getAsString(Events.EXDATE); @@ -406,28 +406,28 @@ public class LocalCalendar extends LocalCollection { new DateTime(originalInstanceTime); if (originalDate instanceof DateTime) ((DateTime)originalDate).setUtc(true); - e.setRecurrenceId(new RecurrenceId(originalDate)); + e.recurrenceId = new RecurrenceId(originalDate); } // status if (values.containsKey(Events.STATUS)) switch (values.getAsInteger(Events.STATUS)) { case Events.STATUS_CONFIRMED: - e.setStatus(Status.VEVENT_CONFIRMED); + e.status = Status.VEVENT_CONFIRMED; break; case Events.STATUS_TENTATIVE: - e.setStatus(Status.VEVENT_TENTATIVE); + e.status = Status.VEVENT_TENTATIVE; break; case Events.STATUS_CANCELED: - e.setStatus(Status.VEVENT_CANCELLED); + e.status = Status.VEVENT_CANCELLED; } // availability - e.setOpaque(values.getAsInteger(Events.AVAILABILITY) != Events.AVAILABILITY_FREE); + e.opaque = values.getAsInteger(Events.AVAILABILITY) != Events.AVAILABILITY_FREE; // set ORGANIZER try { - e.setOrganizer(new Organizer(new URI("mailto", values.getAsString(Events.ORGANIZER), null))); + e.organizer = new Organizer(new URI("mailto", values.getAsString(Events.ORGANIZER), null)); } catch (URISyntaxException ex) { Log.e(TAG, "Error when creating ORGANIZER mailto URI, ignoring", ex); } @@ -436,10 +436,10 @@ public class LocalCalendar extends LocalCollection { switch (values.getAsInteger(Events.ACCESS_LEVEL)) { case Events.ACCESS_CONFIDENTIAL: case Events.ACCESS_PRIVATE: - e.setForPublic(false); + e.forPublic = false; break; case Events.ACCESS_PUBLIC: - e.setForPublic(true); + e.forPublic = true; } } @@ -526,7 +526,7 @@ public class LocalCalendar extends LocalCollection { PropertyList props = alarm.getProperties(); props.add(Action.DISPLAY); - props.add(new Description(event.getSummary())); + props.add(new Description(event.summary)); event.getAlarms().add(alarm); } @@ -547,8 +547,7 @@ public class LocalCalendar extends LocalCollection { .withValue(Events.GUESTS_CAN_MODIFY, 1) .withValue(Events.GUESTS_CAN_SEE_GUESTS, 1); - final RecurrenceId recurrenceId = event.getRecurrenceId(); - if (recurrenceId == null) { + if (event.recurrenceId == null) { // this event is a "master event" (not an exception) builder .withValue(entryColumnRemoteName(), event.getName()) .withValue(entryColumnETag(), event.getETag()) @@ -563,9 +562,9 @@ public class LocalCalendar extends LocalCollection { } boolean recurring = false; - if (event.getRrule() != null) { + if (event.rrule != null) { recurring = true; - builder.withValue(Events.RRULE, event.getRrule().getValue()); + builder.withValue(Events.RRULE, event.rrule.getValue()); } if (!event.getRdates().isEmpty()) { recurring = true; @@ -575,9 +574,9 @@ public class LocalCalendar extends LocalCollection { Log.e(TAG, "Couldn't parse RDate(s)", e); } } - if (event.getExrule() != null) - builder.withValue(Events.EXRULE, event.getExrule().getValue()); - if (!event.getExdates().isEmpty()) + if (event.exrule != null) + builder.withValue(Events.EXRULE, event.exrule.getValue()); + if (!event.getExceptions().isEmpty()) try { builder.withValue(Events.EXDATE, DateUtils.recurrenceSetsToAndroidString(event.getExdates(), event.isAllDay())); } catch (ParseException e) { @@ -588,28 +587,27 @@ public class LocalCalendar extends LocalCollection { // because that's the way Android likes it (see docs) if (recurring) { // calculate DURATION from start and end date - Duration duration = new Duration(event.getDtStart().getDate(), event.getDtEnd().getDate()); + Duration duration = new Duration(event.dtStart.getDate(), event.dtEnd.getDate()); builder.withValue(Events.DURATION, duration.getValue()); } else builder .withValue(Events.DTEND, event.getDtEndInMillis()) .withValue(Events.EVENT_END_TIMEZONE, event.getDtEndTzID()); - if (event.getSummary() != null) - builder.withValue(Events.TITLE, event.getSummary()); - if (event.getLocation() != null) - builder.withValue(Events.EVENT_LOCATION, event.getLocation()); - if (event.getDescription() != null) - builder.withValue(Events.DESCRIPTION, event.getDescription()); + if (event.summary != null) + builder.withValue(Events.TITLE, event.summary); + if (event.location != null) + builder.withValue(Events.EVENT_LOCATION, event.location); + if (event.description != null) + builder.withValue(Events.DESCRIPTION, event.description); - Organizer organizer = event.getOrganizer(); - if (organizer != null) { - final URI uri = organizer.getCalAddress(); + if (event.organizer != null) { + final URI uri = event.organizer.getCalAddress(); String email = null; if (uri != null && "mailto".equalsIgnoreCase(uri.getScheme())) email = uri.getSchemeSpecificPart(); else { - iCalendar.Email emailParam = (iCalendar.Email)organizer.getParameter(iCalendar.Email.PARAMETER_NAME); + iCalendar.Email emailParam = (iCalendar.Email)event.organizer.getParameter(iCalendar.Email.PARAMETER_NAME); if (emailParam != null) email = emailParam.getValue(); else @@ -618,20 +616,20 @@ public class LocalCalendar extends LocalCollection { builder.withValue(Events.ORGANIZER, email != null ? email : uri.toString()); } - Status status = event.getStatus(); - if (status != null) { + //Status status = event.getStatus(); + if (event.status!= null) { int statusCode = Events.STATUS_TENTATIVE; - if (status == Status.VEVENT_CONFIRMED) + if (event.status == Status.VEVENT_CONFIRMED) statusCode = Events.STATUS_CONFIRMED; - else if (status == Status.VEVENT_CANCELLED) + else if (event.status == Status.VEVENT_CANCELLED) statusCode = Events.STATUS_CANCELED; builder.withValue(Events.STATUS, statusCode); } - builder.withValue(Events.AVAILABILITY, event.isOpaque() ? Events.AVAILABILITY_BUSY : Events.AVAILABILITY_FREE); + builder.withValue(Events.AVAILABILITY, event.opaque ? Events.AVAILABILITY_BUSY : Events.AVAILABILITY_FREE); - if (event.getForPublic() != null) - builder.withValue(Events.ACCESS_LEVEL, event.getForPublic() ? Events.ACCESS_PUBLIC : Events.ACCESS_PRIVATE); + if (event.forPublic != null) + builder.withValue(Events.ACCESS_LEVEL, event.forPublic ? Events.ACCESS_PUBLIC : Events.ACCESS_PRIVATE); return builder; } @@ -672,13 +670,12 @@ public class LocalCalendar extends LocalCollection { buildEntry(builder, exception, false); builder.withValue(Events.ORIGINAL_SYNC_ID, exception.getName()); - final RecurrenceId recurrenceId = exception.getRecurrenceId(); final boolean originalAllDay = master.isAllDay(); - Date date = recurrenceId.getDate(); + Date date = exception.recurrenceId.getDate(); if (originalAllDay && date instanceof DateTime) { // correct VALUE=DATE-TIME RECURRENCE-IDs to VALUE=DATE final DateFormat dateFormatDate = new SimpleDateFormat("yyyyMMdd"); - final String dateString = dateFormatDate.format(recurrenceId.getDate()); + final String dateString = dateFormatDate.format(exception.recurrenceId.getDate()); try { date = new Date(dateString); } catch (ParseException e) {