1
0
mirror of https://github.com/etesync/android synced 2024-11-26 01:48:34 +00:00

Version bump to 0.5.8-alpha

* version bump
* introduction of LocalCalendarTest
* always provide DTEND and not DURATION for all-day events (compatibility)
* ez-vcard 0.9.2
This commit is contained in:
rfc2822 2014-02-08 20:12:31 +01:00
parent c7fe069b1f
commit 6c4acad758
5 changed files with 105 additions and 9 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.bitfire.davdroid"
android:versionCode="27"
android:versionName="0.5.7-alpha1" android:installLocation="internalOnly">
android:versionCode="28"
android:versionName="0.5.8" android:installLocation="internalOnly">
<uses-sdk
android:minSdkVersion="14"

View File

@ -12,7 +12,7 @@ package at.bitfire.davdroid;
public class Constants {
public static final String
APP_VERSION = "0.5.7-alpha",
APP_VERSION = "0.5.8-alpha",
ACCOUNT_TYPE = "bitfire.at.davdroid",

View File

@ -226,16 +226,26 @@ public class LocalCalendar extends LocalCollection<Event> {
String duration = cursor.getString(18);
String tzId = null;
if (!allDay) {
if (allDay) {
e.setDtStart(tsStart, null);
// provide only DTEND and not DURATION for all-day events
if (tsEnd == 0) {
Dur dur = new Dur(duration);
java.util.Date dEnd = dur.getTime(new java.util.Date(tsStart));
tsEnd = dEnd.getTime();
}
e.setDtEnd(tsEnd, null);
} else {
// use the start time zone for the end time, too
// because apps like Samsung Planner allow the user to change "the" time zone but change the start time zone only
tzId = cursor.getString(5);
}
e.setDtStart(tsStart, tzId);
if (tsEnd != 0)
e.setDtEnd(tsEnd, tzId);
else if (!StringUtils.isEmpty(duration))
e.setDuration(new Duration(new Dur(duration)));
}
// recurrence
try {

View File

@ -0,0 +1,86 @@
package at.bitfire.davdroid.resource.test;
import lombok.Cleanup;
import android.annotation.TargetApi;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.provider.CalendarContract;
import android.provider.CalendarContract.Attendees;
import android.provider.CalendarContract.Calendars;
import android.provider.CalendarContract.Events;
import android.provider.CalendarContract.Reminders;
import android.test.InstrumentationTestCase;
public class LocalCalendarTest extends InstrumentationTestCase {
private static final String calendarName = "DavdroidTest";
ContentProviderClient client;
long calendarID;
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
protected void setUp() throws Exception {
// get content resolver
ContentResolver resolver = getInstrumentation().getContext().getContentResolver();
client = resolver.acquireContentProviderClient(CalendarContract.AUTHORITY);
@Cleanup Cursor cursor = client.query(Calendars.CONTENT_URI,
new String[] { Calendars._ID },
Calendars.ACCOUNT_TYPE + "=? AND " + Calendars.NAME + "=?",
new String[] { CalendarContract.ACCOUNT_TYPE_LOCAL, calendarName },
null);
if (cursor.moveToNext()) {
// found local test calendar
calendarID = cursor.getLong(0);
} else {
// no local test calendar found, create
ContentValues values = new ContentValues();
values.put(Calendars.ACCOUNT_NAME, calendarName);
values.put(Calendars.ACCOUNT_TYPE, CalendarContract.ACCOUNT_TYPE_LOCAL);
values.put(Calendars.NAME, calendarName);
values.put(Calendars.CALENDAR_DISPLAY_NAME, calendarName);
values.put(Calendars.CALENDAR_ACCESS_LEVEL, Calendars.CAL_ACCESS_OWNER);
values.put(Calendars.ALLOWED_REMINDERS, Reminders.METHOD_ALERT);
values.put(Calendars.SYNC_EVENTS, 0);
values.put(Calendars.VISIBLE, 1);
if (android.os.Build.VERSION.SDK_INT >= 15) {
values.put(Calendars.ALLOWED_AVAILABILITY, Events.AVAILABILITY_BUSY + "," + Events.AVAILABILITY_FREE + "," + Events.AVAILABILITY_TENTATIVE);
values.put(Calendars.ALLOWED_ATTENDEE_TYPES, Attendees.TYPE_NONE + "," + Attendees.TYPE_OPTIONAL + "," + Attendees.TYPE_REQUIRED + "," + Attendees.TYPE_RESOURCE);
}
Uri calendarURI = client.insert(calendarsURI(), values);
calendarID = ContentUris.parseId(calendarURI);
}
}
protected void tearDown() throws Exception {
Uri uri = ContentUris.withAppendedId(calendarsURI(), calendarID);
client.delete(uri, null, null);
}
// tests
public void testNothing() {
assert(true);
}
// helpers
protected Uri calendarsURI() {
return Calendars.CONTENT_URI.buildUpon()
.appendQueryParameter(Calendars.ACCOUNT_NAME, calendarName)
.appendQueryParameter(Calendars.ACCOUNT_TYPE, CalendarContract.ACCOUNT_TYPE_LOCAL)
.appendQueryParameter(CalendarContract.CALLER_IS_SYNCADAPTER, "true").
build();
}
}