1 package com.android.contacts.quickcontact;
2 
3 import com.android.contacts.ContactSaveService;
4 import com.android.contacts.R;
5 import com.android.contacts.common.editor.SelectAccountDialogFragment;
6 import com.android.contacts.common.model.AccountTypeManager;
7 import com.android.contacts.common.model.Contact;
8 import com.android.contacts.common.model.account.AccountWithDataSet;
9 import com.android.contacts.common.util.AccountsListAdapter.AccountListFilter;
10 import com.android.contacts.quickcontact.QuickContactActivity.SelectAccountDialogFragmentListener;
11 
12 import android.app.FragmentManager;
13 import android.content.ContentValues;
14 import android.content.Context;
15 import android.content.Intent;
16 import android.provider.ContactsContract.Directory;
17 import android.widget.Toast;
18 
19 import java.util.ArrayList;
20 import java.util.List;
21 
22 /**
23  * Utility class to support adding directory contacts.
24  *
25  * This class is coupled with {@link QuickContactActivity}, but is left out of
26  * QuickContactActivity.java to avoid ballooning the size of the file.
27  */
28 public class DirectoryContactUtil {
29 
isDirectoryContact(Contact contactData)30     public static boolean isDirectoryContact(Contact contactData) {
31         // Not a directory contact? Nothing to fix here
32         if (contactData == null || !contactData.isDirectoryEntry()) return false;
33 
34         // No export support? Too bad
35         return contactData.getDirectoryExportSupport() != Directory.EXPORT_SUPPORT_NONE;
36     }
37 
createCopy( ArrayList<ContentValues> values, AccountWithDataSet account, Context context)38     public static void createCopy(
39             ArrayList<ContentValues> values, AccountWithDataSet account,
40             Context context) {
41         Toast.makeText(context, R.string.toast_making_personal_copy,
42                 Toast.LENGTH_LONG).show();
43         Intent serviceIntent = ContactSaveService.createNewRawContactIntent(
44                 context, values, account,
45                 QuickContactActivity.class, Intent.ACTION_VIEW);
46         context.startService(serviceIntent);
47     }
48 }
49