mirror of
https://github.com/etesync/android
synced 2025-01-23 06:01:01 +00:00
Version bump to 0.7.6
* additional test * minor code optimizations
This commit is contained in:
parent
87df8f880d
commit
a3ebd72321
@ -26,7 +26,18 @@ import android.provider.CalendarContract.Reminders;
|
||||
import android.test.InstrumentationTestCase;
|
||||
import android.util.Log;
|
||||
|
||||
import net.fortuna.ical4j.model.DateList;
|
||||
import net.fortuna.ical4j.model.TimeZone;
|
||||
import net.fortuna.ical4j.model.TimeZoneRegistry;
|
||||
import net.fortuna.ical4j.model.TimeZoneRegistryFactory;
|
||||
import net.fortuna.ical4j.model.parameter.Value;
|
||||
import net.fortuna.ical4j.model.property.RDate;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.SimpleTimeZone;
|
||||
|
||||
import lombok.Cleanup;
|
||||
|
||||
@ -140,7 +151,7 @@ public class LocalCalendarTest extends InstrumentationTestCase {
|
||||
assertTrue(testCalendar.findUpdated().length == 0);
|
||||
|
||||
// insert a "new" event
|
||||
long id = insertNewEvent();
|
||||
final long id = insertNewEvent();
|
||||
try {
|
||||
// there must be one "new" event now
|
||||
assertTrue(testCalendar.findNew().length == 1);
|
||||
@ -155,4 +166,23 @@ public class LocalCalendarTest extends InstrumentationTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testRecurrenceSetsToAndroidString() throws ParseException {
|
||||
final String tzId = "Europe/Vienna";
|
||||
|
||||
// one entry without time zone
|
||||
final List<RDate> list = new ArrayList<>(2);
|
||||
list.add(new RDate(new DateList("20150101T103000,20150102T103000", Value.DATE_TIME)));
|
||||
assertEquals("20150101T103000,20150102T103000", LocalCalendar.recurrenceSetsToAndroidString(list));
|
||||
|
||||
// two entries with time zone
|
||||
list.add(new RDate(new DateList("20150103T103000,20150104T103000", Value.DATE_TIME)));
|
||||
|
||||
final TimeZoneRegistry tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry();
|
||||
final TimeZone tz = tzRegistry.getTimeZone(tzId);
|
||||
for (RDate rdate : list)
|
||||
rdate.setTimeZone(tz);
|
||||
|
||||
assertEquals(tzId + ";20150101T103000,20150102T103000,20150103T103000,20150104T103000", LocalCalendar.recurrenceSetsToAndroidString(list));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="at.bitfire.davdroid"
|
||||
android:versionCode="61" android:versionName="0.7.5"
|
||||
android:versionCode="62" android:versionName="0.7.6"
|
||||
android:installLocation="internalOnly">
|
||||
|
||||
<uses-sdk
|
||||
|
@ -9,7 +9,7 @@ package at.bitfire.davdroid;
|
||||
|
||||
public class Constants {
|
||||
public static final String
|
||||
APP_VERSION = "0.7.5",
|
||||
APP_VERSION = "0.7.6",
|
||||
ACCOUNT_TYPE = "bitfire.at.davdroid",
|
||||
WEB_URL_HELP = "https://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app",
|
||||
WEB_URL_VIEW_LOGS = "https://github.com/bitfireAT/davdroid/wiki/How-to-view-the-logs";
|
||||
|
@ -122,7 +122,7 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
public static void create(Account account, ContentResolver resolver, ServerInfo.ResourceInfo info) throws LocalStorageException {
|
||||
ContentProviderClient client = resolver.acquireContentProviderClient(CalendarContract.AUTHORITY);
|
||||
final ContentProviderClient client = resolver.acquireContentProviderClient(CalendarContract.AUTHORITY);
|
||||
if (client == null)
|
||||
throw new LocalStorageException("No Calendar Provider found (Calendar app disabled?)");
|
||||
|
||||
@ -342,12 +342,12 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
e.setLocation(values.getAsString(Events.EVENT_LOCATION));
|
||||
e.setDescription(values.getAsString(Events.DESCRIPTION));
|
||||
|
||||
boolean allDay = values.getAsBoolean(Events.ALL_DAY);
|
||||
long tsStart = values.getAsLong(Events.DTSTART);
|
||||
Long tsEnd = values.getAsLong(Events.DTEND);
|
||||
String duration = values.getAsString(Events.DURATION);
|
||||
final boolean allDay = values.getAsBoolean(Events.ALL_DAY);
|
||||
final long tsStart = values.getAsLong(Events.DTSTART);
|
||||
final String duration = values.getAsString(Events.DURATION);
|
||||
|
||||
String tzId = null;
|
||||
Long tsEnd = values.getAsLong(Events.DTEND);
|
||||
if (allDay) {
|
||||
e.setDtStart(tsStart, null);
|
||||
if (tsEnd == null) {
|
||||
@ -529,7 +529,7 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
|
||||
@Override
|
||||
protected Builder buildEntry(Builder builder, Resource resource) {
|
||||
Event event = (Event)resource;
|
||||
final Event event = (Event)resource;
|
||||
|
||||
builder = builder
|
||||
.withValue(Events.CALENDAR_ID, id)
|
||||
@ -542,7 +542,7 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
.withValue(Events.GUESTS_CAN_MODIFY, 1)
|
||||
.withValue(Events.GUESTS_CAN_SEE_GUESTS, 1);
|
||||
|
||||
RecurrenceId recurrenceId = event.getRecurrenceId();
|
||||
final RecurrenceId recurrenceId = event.getRecurrenceId();
|
||||
if (recurrenceId == null) {
|
||||
// this event is a "master event" (not an exception)
|
||||
builder = builder
|
||||
@ -618,7 +618,8 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
|
||||
@Override
|
||||
protected void addDataRows(Resource resource, long localID, int backrefIdx) {
|
||||
Event event = (Event)resource;
|
||||
final Event event = (Event)resource;
|
||||
|
||||
// add exceptions
|
||||
for (Event exception : event.getExceptions())
|
||||
pendingOperations.add(buildException(newDataInsertBuilder(Events.CONTENT_URI, Events.ORIGINAL_ID, localID, backrefIdx), event, exception).build());
|
||||
@ -632,7 +633,8 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
|
||||
@Override
|
||||
protected void removeDataRows(Resource resource) {
|
||||
Event event = (Event)resource;
|
||||
final Event event = (Event)resource;
|
||||
|
||||
// delete exceptions
|
||||
pendingOperations.add(ContentProviderOperation.newDelete(syncAdapterURI(Events.CONTENT_URI))
|
||||
.withSelection(Events.ORIGINAL_ID + "=?", new String[] { String.valueOf(event.getLocalID())}).build());
|
||||
@ -653,10 +655,10 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
// the original event is an all-day event. Workaround: determine value of ORIGINAL_ALL_DAY
|
||||
// by original event type (all-day or not) and not by whether RECURRENCE-ID is DATE or DATE-TIME.
|
||||
|
||||
RecurrenceId recurrenceId = exception.getRecurrenceId();
|
||||
Date date = recurrenceId.getDate();
|
||||
final RecurrenceId recurrenceId = exception.getRecurrenceId();
|
||||
final boolean originalAllDay = master.isAllDay();
|
||||
|
||||
boolean originalAllDay = master.isAllDay();
|
||||
Date date = recurrenceId.getDate();
|
||||
if (originalAllDay && date instanceof DateTime) {
|
||||
String value = recurrenceId.getValue();
|
||||
if (value.matches("^\\d{8}T\\d{6}$"))
|
||||
@ -676,10 +678,10 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
protected Builder buildAttendee(Builder builder, Attendee attendee) {
|
||||
Uri member = Uri.parse(attendee.getValue());
|
||||
String email = member.getSchemeSpecificPart();
|
||||
final Uri member = Uri.parse(attendee.getValue());
|
||||
final String email = member.getSchemeSpecificPart();
|
||||
|
||||
Cn cn = (Cn)attendee.getParameter(Parameter.CN);
|
||||
final Cn cn = (Cn)attendee.getParameter(Parameter.CN);
|
||||
if (cn != null)
|
||||
builder = builder.withValue(Attendees.ATTENDEE_NAME, cn.getValue());
|
||||
|
||||
@ -760,7 +762,7 @@ public class LocalCalendar extends LocalCollection<Event> {
|
||||
* @param dates one more more lists of RDATE or EXDATE
|
||||
* @return formatted string for Android calendar provider
|
||||
*/
|
||||
protected static String recurrenceSetsToAndroidString(List<? extends DateListProperty> dates) {
|
||||
static String recurrenceSetsToAndroidString(List<? extends DateListProperty> dates) {
|
||||
String tzID = null;
|
||||
List<String> strDates = new LinkedList<String>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user