1
0
mirror of https://github.com/etesync/android synced 2024-11-25 17:38:13 +00:00

Better alarm handling

* ical4android: better alarm handling
* API change: pass OutputStream instead of returning it
This commit is contained in:
Ricki Hirner 2016-05-28 16:00:23 +02:00
parent 42a261b84e
commit 5675e544b5
10 changed files with 26 additions and 21 deletions

View File

@ -15,7 +15,6 @@ import android.text.TextUtils;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.util.Arrays;
import java.util.HashSet;

View File

@ -8,8 +8,6 @@
package at.bitfire.davdroid.log;
import android.util.Log;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.lang3.time.DateFormatUtils;

View File

@ -44,7 +44,6 @@ import at.bitfire.ical4android.CalendarStorageException;
import at.bitfire.ical4android.DateUtils;
import at.bitfire.vcard4android.ContactsStorageException;
import lombok.Cleanup;
import okhttp3.HttpUrl;
public class LocalCalendar extends AndroidCalendar implements LocalCollection {

View File

@ -17,6 +17,7 @@ import org.apache.commons.codec.Charsets;
import org.apache.commons.lang3.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
@ -96,10 +97,14 @@ public class CalendarSyncManager extends SyncManager {
@Override
protected RequestBody prepareUpload(LocalResource resource) throws IOException, CalendarStorageException {
LocalEvent local = (LocalEvent)resource;
App.log.log(Level.FINE, "Preparing upload of event " + local.getFileName(), new Object[] { local.getEvent() });
App.log.log(Level.FINE, "Preparing upload of event " + local.getFileName(), local.getEvent());
ByteArrayOutputStream os = new ByteArrayOutputStream();
local.getEvent().write(os);
return RequestBody.create(
DavCalendar.MIME_ICALENDAR,
local.getEvent().toStream().toByteArray()
os.toByteArray()
);
}

View File

@ -14,12 +14,16 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.SyncResult;
import android.os.Bundle;
import android.os.Environment;
import android.provider.ContactsContract;
import org.apache.commons.codec.Charsets;
import org.apache.commons.lang3.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
@ -130,10 +134,14 @@ public class ContactsSyncManager extends SyncManager {
@Override
protected RequestBody prepareUpload(LocalResource resource) throws IOException, ContactsStorageException {
LocalContact local = (LocalContact)resource;
App.log.log(Level.FINE, "Preparing upload of contact " + local.getFileName(), new Object[] { local.getContact() });
App.log.log(Level.FINE, "Preparing upload of contact " + local.getFileName(), local.getContact());
ByteArrayOutputStream os = new ByteArrayOutputStream();
local.getContact().write(hasVCard4 ? VCardVersion.V4_0 : VCardVersion.V3_0, os);
return RequestBody.create(
hasVCard4 ? DavAddressBook.MIME_VCARD4 : DavAddressBook.MIME_VCARD3_UTF8,
local.getContact().toStream(hasVCard4 ? VCardVersion.V4_0 : VCardVersion.V3_0).toByteArray()
os.toByteArray()
);
}

View File

@ -17,6 +17,7 @@ import org.apache.commons.codec.Charsets;
import org.apache.commons.lang3.StringUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
@ -90,10 +91,14 @@ public class TasksSyncManager extends SyncManager {
@Override
protected RequestBody prepareUpload(LocalResource resource) throws IOException, CalendarStorageException {
LocalTask local = (LocalTask)resource;
App.log.log(Level.FINE, "Preparing upload of task " + local.getFileName(), new Object[] { local.getTask() });
App.log.log(Level.FINE, "Preparing upload of task " + local.getFileName(), local.getTask() );
ByteArrayOutputStream os = new ByteArrayOutputStream();
local.getTask().write(os);
return RequestBody.create(
DavCalendar.MIME_ICALENDAR,
local.getTask().toStream().toByteArray()
os.toByteArray()
);
}

View File

@ -9,16 +9,11 @@
package at.bitfire.davdroid.ui;
import android.accounts.Account;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.provider.CalendarContract;
import android.provider.ContactsContract;
import android.support.v4.app.NavUtils;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.preference.EditTextPreference;
import android.support.v7.preference.ListPreference;
@ -28,9 +23,6 @@ import android.support.v7.preference.SwitchPreferenceCompat;
import android.text.TextUtils;
import android.view.MenuItem;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import at.bitfire.davdroid.AccountSettings;

View File

@ -22,7 +22,6 @@ import android.support.v4.content.Loader;
import android.support.v7.app.AlertDialog;
import at.bitfire.davdroid.App;
import at.bitfire.davdroid.InvalidAccountException;
import at.bitfire.davdroid.R;
import at.bitfire.davdroid.ui.DebugInfoActivity;
import at.bitfire.davdroid.ui.setup.DavResourceFinder.Configuration;

@ -1 +1 @@
Subproject commit 34a0a838ed2116b8ee2b022749d710a4f3e6a04c
Subproject commit baffbc628b9ca9733c1b97671d6ae8854cd06391

@ -1 +1 @@
Subproject commit c75322ea59d8d6b204418f27e19f6604e6a4ac59
Subproject commit 33cc8fbf59a114dbcaadfa3cc0fbba5fa01589d2