// Path: src/com/deliciousdroid/Constants.java
// public class Constants {
// 
//     /**
//      * Account type string.
//      */
//     public static final String ACCOUNT_TYPE = "com.deliciousdroid";
//     
//     public static final Uri CONTENT_URI_BASE = Uri.parse("content://com.deliciousdroid");
//     
//     public static final String CONTENT_SCHEME = "content";
//     
//     public static final String EXTRA_DESCRIPTION = "com.deliciousdroid.bookmark.description";
//     public static final String EXTRA_NOTES = "com.deliciousdroid.bookmark.notes";
//     public static final String EXTRA_TAGS = "com.deliciousdroid.bookmark.tags";
//     public static final String EXTRA_PRIVATE = "com.deliciousdroid.bookmark.private";
//     public static final String EXTRA_ERROR = "com.deliciousdroid.bookmark.error";
//     public static final String EXTRA_TIME = "com.deliciousdroid.bookmark.time";
// 	public static final String EXTRA_UPDATE = "com.deliciousdroid.bookmark.update";
// 	
// 	public static final String TEXT_EXTRACTOR_URL = "http://viewtext.org/api/text?url=";
// 	
// 	public static final String SYNC_MARKER_KEY = "com.deliciousdroid.BookmarkSyncAdapter.marker";
// 	
// 	public static final int BOOKMARK_PAGE_SIZE = 500;
// 	
// 	public static final String ACTION_SEARCH_SUGGESTION = "com.deliciousdroid.intent.action.SearchSuggestion";
// 	
// 	public static final String SUGGEST_COLUMN_TEXT_2_URL = "suggest_text_2_url";
// 
//     /**
//      * Authtoken type string.
//      */
//     public static final String AUTHTOKEN_TYPE = "com.deliciousdroid";
//     
//     public static final String AUTH_PREFS_NAME = "com.deliciousdroid.auth";
//     
//     public static final String PREFS_AUTH_TYPE = "authentication_type";
//     public static final String AUTH_TYPE_DELICIOUS = "delicious";
//     
//     public static final String GPL_URL = "http://www.gnu.org/licenses/gpl-3.0.txt";
//     public static final String MANUAL_URL = "http://code.google.com/p/deliciousdroid/wiki/Manual";
//     public static final String DONATION_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ERJRC6SWL9ZC";
//     
//     public static enum BookmarkViewType {VIEW, READ, WEB};
// }


import android.provider.ContactsContract.CommonDataKinds.StructuredName;
import android.text.TextUtils;
import android.util.Log;
import com.deliciousdroid.R;
import com.deliciousdroid.Constants;
import android.content.ContentProviderOperation;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Phone;
        return new ContactOperations(context, userName, accountName,
            batchOperation);
    }

    /**
     * Returns an instance of ContactOperations for updating existing contact in
     * the platform contacts provider.
     * 
     * @param context the Authenticator Activity context
     * @param rawContactId the unique Id of the existing rawContact
     * @return instance of ContactOperations
     */
    public static ContactOperations updateExistingContact(Context context,
        long rawContactId, BatchOperation batchOperation) {
        return new ContactOperations(context, rawContactId, batchOperation);
    }

    public ContactOperations(Context context, BatchOperation batchOperation) {
        mValues = new ContentValues();
        mYield = true;
        mContext = context;
        mBatchOperation = batchOperation;
    }

    public ContactOperations(Context context, String userName, String accountName,
        BatchOperation batchOperation) {
        this(context, batchOperation);
        mBackReference = mBatchOperation.size();
        mIsNewContact = true;
        mValues.put(RawContacts.SOURCE_ID, userName);
// Path: src/com/deliciousdroid/Constants.java
// public class Constants {
// 
//     /**
//      * Account type string.
//      */
//     public static final String ACCOUNT_TYPE = "com.deliciousdroid";
//     
//     public static final Uri CONTENT_URI_BASE = Uri.parse("content://com.deliciousdroid");
//     
//     public static final String CONTENT_SCHEME = "content";
//     
//     public static final String EXTRA_DESCRIPTION = "com.deliciousdroid.bookmark.description";
//     public static final String EXTRA_NOTES = "com.deliciousdroid.bookmark.notes";
//     public static final String EXTRA_TAGS = "com.deliciousdroid.bookmark.tags";
//     public static final String EXTRA_PRIVATE = "com.deliciousdroid.bookmark.private";
//     public static final String EXTRA_ERROR = "com.deliciousdroid.bookmark.error";
//     public static final String EXTRA_TIME = "com.deliciousdroid.bookmark.time";
// 	public static final String EXTRA_UPDATE = "com.deliciousdroid.bookmark.update";
// 	
// 	public static final String TEXT_EXTRACTOR_URL = "http://viewtext.org/api/text?url=";
// 	
// 	public static final String SYNC_MARKER_KEY = "com.deliciousdroid.BookmarkSyncAdapter.marker";
// 	
// 	public static final int BOOKMARK_PAGE_SIZE = 500;
// 	
// 	public static final String ACTION_SEARCH_SUGGESTION = "com.deliciousdroid.intent.action.SearchSuggestion";
// 	
// 	public static final String SUGGEST_COLUMN_TEXT_2_URL = "suggest_text_2_url";
// 
//     /**
//      * Authtoken type string.
//      */
//     public static final String AUTHTOKEN_TYPE = "com.deliciousdroid";
//     
//     public static final String AUTH_PREFS_NAME = "com.deliciousdroid.auth";
//     
//     public static final String PREFS_AUTH_TYPE = "authentication_type";
//     public static final String AUTH_TYPE_DELICIOUS = "delicious";
//     
//     public static final String GPL_URL = "http://www.gnu.org/licenses/gpl-3.0.txt";
//     public static final String MANUAL_URL = "http://code.google.com/p/deliciousdroid/wiki/Manual";
//     public static final String DONATION_URL = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6ERJRC6SWL9ZC";
//     
//     public static enum BookmarkViewType {VIEW, READ, WEB};
// }


// Path: src/com/deliciousdroid/platform/ContactOperations.java
import android.provider.ContactsContract.CommonDataKinds.StructuredName;
import android.text.TextUtils;
import android.util.Log;
import com.deliciousdroid.R;
import com.deliciousdroid.Constants;
import android.content.ContentProviderOperation;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.RawContacts;
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Phone;

        return new ContactOperations(context, userName, accountName,
            batchOperation);
    }

    /**
     * Returns an instance of ContactOperations for updating existing contact in
     * the platform contacts provider.
     * 
     * @param context the Authenticator Activity context
     * @param rawContactId the unique Id of the existing rawContact
     * @return instance of ContactOperations
     */
    public static ContactOperations updateExistingContact(Context context,
        long rawContactId, BatchOperation batchOperation) {
        return new ContactOperations(context, rawContactId, batchOperation);
    }

    public ContactOperations(Context context, BatchOperation batchOperation) {
        mValues = new ContentValues();
        mYield = true;
        mContext = context;
        mBatchOperation = batchOperation;
    }

    public ContactOperations(Context context, String userName, String accountName,
        BatchOperation batchOperation) {
        this(context, batchOperation);
        mBackReference = mBatchOperation.size();
        mIsNewContact = true;
        mValues.put(RawContacts.SOURCE_ID, userName);
        mValues.put(RawContacts.ACCOUNT_TYPE, Constants.ACCOUNT_TYPE);