X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/a4ba6170ea7696e085b07adfef73eeb8b77cb8e2..ec19a11a385ff21d3e85a94e618d48d8be9ef20d:/src/com/owncloud/android/syncadapter/ContactSyncAdapter.java?ds=sidebyside diff --git a/src/com/owncloud/android/syncadapter/ContactSyncAdapter.java b/src/com/owncloud/android/syncadapter/ContactSyncAdapter.java index 2508dcd6..3ba1676a 100644 --- a/src/com/owncloud/android/syncadapter/ContactSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/ContactSyncAdapter.java @@ -1,16 +1,32 @@ +/* ownCloud Android client application + * Copyright (C) 2012 Bartek Przybylski + * Copyright (C) 2012-2013 ownCloud Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + package com.owncloud.android.syncadapter; import java.io.FileInputStream; import java.io.IOException; -import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPut; import org.apache.http.entity.ByteArrayEntity; -import com.owncloud.android.AccountUtils; -import com.owncloud.android.authenticator.AccountAuthenticator; -import com.owncloud.android.db.ProviderMeta; -import com.owncloud.android.db.ProviderMeta.ProviderTableMeta; +import com.owncloud.android.authentication.AccountUtils; +import com.owncloud.android.lib.common.accounts.AccountUtils.Constants; + import android.accounts.Account; import android.accounts.AccountManager; @@ -24,7 +40,6 @@ import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.ContactsContract; -import android.util.Log; public class ContactSyncAdapter extends AbstractOwnCloudSyncAdapter { private String mAddrBookUri; @@ -38,7 +53,7 @@ public class ContactSyncAdapter extends AbstractOwnCloudSyncAdapter { public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) { setAccount(account); - setContentProvider(provider); + setContentProviderClient(provider); Cursor c = getLocalContacts(false); if (c.moveToFirst()) { do { @@ -53,7 +68,7 @@ public class ContactSyncAdapter extends AbstractOwnCloudSyncAdapter { byte[] b = new byte[f.available()]; f.read(b); query.setEntity(new ByteArrayEntity(b)); - HttpResponse response = fireRawRequest(query); + fireRawRequest(query); } catch (IOException e) { e.printStackTrace(); return; @@ -75,8 +90,9 @@ public class ContactSyncAdapter extends AbstractOwnCloudSyncAdapter { return mAddrBookUri; AccountManager am = getAccountManager(); + @SuppressWarnings("deprecation") String uri = am.getUserData(getAccount(), - AccountAuthenticator.KEY_OC_URL).replace( + Constants.KEY_OC_URL).replace( AccountUtils.WEBDAV_PATH_2_0, AccountUtils.CARDDAV_PATH_2_0); uri += "/addressbooks/" + getAccount().name.substring(0,