adding specified adapter for contacts and files
authorBartek Przybylski <bart.p.pl@gmail.com>
Sat, 17 Sep 2011 14:03:05 +0000 (16:03 +0200)
committerBartek Przybylski <bart.p.pl@gmail.com>
Sat, 17 Sep 2011 14:03:05 +0000 (16:03 +0200)
AndroidManifest.xml
res/xml/syncadapter.xml [deleted file]
src/eu/alefzero/owncloud/cp.java
src/eu/alefzero/owncloud/db/ProviderMeta.java

index f6f7c41..f593631 100644 (file)
                 <action android:name="android.content.SyncAdapter"/>
             </intent-filter>
             <meta-data
                 <action android:name="android.content.SyncAdapter"/>
             </intent-filter>
             <meta-data
-                android:resource="@xml/syncadapter" android:name="android.content.SyncAdapter"/>
+                android:name="android.content.SyncAdapter"
+                android:resource="@xml/syncadapter_files"/>
         </service>
         </service>
-         <provider android:name="cp" android:authorities="org.owncloud" android:enabled="true" android:syncable="true" android:exported="false" android:label="@string/sync_string_files"></provider>
+         <provider android:name="cp" android:enabled="true" android:syncable="true" android:exported="false" android:label="@string/sync_string_files" android:authorities="org.owncloud.files"></provider>
          <activity android:name=".authenticator.AuthenticatorActivity"></activity>
          <activity android:name=".authenticator.AuthenticatorActivity"></activity>
-         <provider android:label="@string/sync_string_contacts" android:name="cp2" android:syncable="true" android:authorities="org.owncloud" android:enabled="true" android:exported="false"></provider>
+         <provider android:label="@string/sync_string_contacts" android:name="cp2" android:syncable="true" android:enabled="true" android:exported="false" android:authorities="org.owncloud.contacts"></provider>
+         <service android:name=".syncadapter.ContactSyncService" android:exported="true">
+             <intent-filter>
+                 <action android:name="android.content.SyncAdapter"></action>
+             </intent-filter>
+             <meta-data android:resource="@xml/syncadapter_contacts" android:name="android.content.SyncAdapter"></meta-data>
+         </service>
     </application>
 </manifest>
\ No newline at end of file
     </application>
 </manifest>
\ No newline at end of file
diff --git a/res/xml/syncadapter.xml b/res/xml/syncadapter.xml
deleted file mode 100644 (file)
index 3285ea8..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/**
- * Copyright (c) 2010, The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
--->
-
-<!-- The attributes in this XML file provide configuration information -->
-<!-- for the SyncAdapter. -->
-
-<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
-    android:contentAuthority="org.owncloud"
-    android:accountType="owncloud"
-    android:supportsUploading="true"
-/>
index 37a3189..bb66bfc 100644 (file)
@@ -69,10 +69,10 @@ public class cp extends ContentProvider {
   private static final UriMatcher mUriMatcher;
   static {
     mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
   private static final UriMatcher mUriMatcher;
   static {
     mUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
-    mUriMatcher.addURI(ProviderMeta.AUTHORITY, "/", ROOT_DIRECTORY);
-    mUriMatcher.addURI(ProviderMeta.AUTHORITY, "file/", SINGLE_FILE);
-    mUriMatcher.addURI(ProviderMeta.AUTHORITY, "file/#", SINGLE_FILE);
-    mUriMatcher.addURI(ProviderMeta.AUTHORITY, "dir/#", DIRECTORY);
+    mUriMatcher.addURI(ProviderMeta.AUTHORITY_FILES, "/", ROOT_DIRECTORY);
+    mUriMatcher.addURI(ProviderMeta.AUTHORITY_FILES, "file/", SINGLE_FILE);
+    mUriMatcher.addURI(ProviderMeta.AUTHORITY_FILES, "file/#", SINGLE_FILE);
+    mUriMatcher.addURI(ProviderMeta.AUTHORITY_FILES, "dir/#", DIRECTORY);
   }
   
   private static final String TAG = "OC_ContentProvider";
   }
   
   private static final String TAG = "OC_ContentProvider";
index 636c699..762562d 100644 (file)
@@ -22,7 +22,7 @@ import android.provider.BaseColumns;
 
 public class ProviderMeta {
 
 
 public class ProviderMeta {
 
-  public static final String AUTHORITY = "org.owncloud";
+  public static final String AUTHORITY_FILES = "org.owncloud.files";
   public static final String DB_FILE = "owncloud.db";
   public static final String DB_NAME = "filelist";
   public static final int DB_VERSION = 1;
   public static final String DB_FILE = "owncloud.db";
   public static final String DB_NAME = "filelist";
   public static final int DB_VERSION = 1;
@@ -32,11 +32,11 @@ public class ProviderMeta {
   static public class ProviderTableMeta implements BaseColumns {
     public static final String DB_NAME = "filelist";
     public static final Uri CONTENT_URI =  
   static public class ProviderTableMeta implements BaseColumns {
     public static final String DB_NAME = "filelist";
     public static final Uri CONTENT_URI =  
-      Uri.parse("content://" + AUTHORITY + "/");
+      Uri.parse("content://" + AUTHORITY_FILES + "/");
     public static final Uri CONTENT_URI_FILE =
     public static final Uri CONTENT_URI_FILE =
-      Uri.parse("content://" + AUTHORITY + "/file");
+      Uri.parse("content://" + AUTHORITY_FILES + "/file");
     public static final Uri CONTENT_URI_DIR =
     public static final Uri CONTENT_URI_DIR =
-      Uri.parse("content://" + AUTHORITY + "/dir");
+      Uri.parse("content://" + AUTHORITY_FILES + "/dir");
 
     public static final String CONTENT_TYPE =
       "vnd.android.cursor.dir/vnd.owncloud.file";
 
     public static final String CONTENT_TYPE =
       "vnd.android.cursor.dir/vnd.owncloud.file";