Renamed Sources to AccountTypes
Change-Id: I088c7d9cd66fd4d38e93bc97a6644247f72037ef
diff --git a/src/com/android/contacts/AttachImage.java b/src/com/android/contacts/AttachImage.java
index 6970842..ba1892a 100644
--- a/src/com/android/contacts/AttachImage.java
+++ b/src/com/android/contacts/AttachImage.java
@@ -36,8 +36,8 @@
import android.provider.ContactsContract.CommonDataKinds.Photo;
import android.widget.Toast;
-import com.android.contacts.model.ExchangeSource;
-import com.android.contacts.model.GoogleSource;
+import com.android.contacts.model.ExchangeAccountType;
+import com.android.contacts.model.GoogleAccountType;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
@@ -189,8 +189,8 @@
operations.add(ContentProviderOperation.newAssertQuery(rawContactDataUri)
.withSelection(Photo.MIMETYPE + "=? AND "
+ RawContacts.ACCOUNT_TYPE + " IN (?,?)",
- new String[] {Photo.CONTENT_ITEM_TYPE, GoogleSource.ACCOUNT_TYPE,
- ExchangeSource.ACCOUNT_TYPE})
+ new String[] {Photo.CONTENT_ITEM_TYPE, GoogleAccountType.ACCOUNT_TYPE,
+ ExchangeAccountType.ACCOUNT_TYPE})
.withExpectedCount(0).build());
}
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index 4e5a20a..fd9eb58 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -16,7 +16,7 @@
package com.android.contacts;
-import com.android.contacts.model.ContactsSource;
+import com.android.contacts.model.BaseAccountType;
import com.android.contacts.util.Constants;
import android.content.ContentResolver;
@@ -459,10 +459,10 @@
* Utility for creating a standard tab indicator view.
*
* @param parent The parent ViewGroup to attach the new view to.
- * @param source The {@link ContactsSource} to build the tab view from.
+ * @param source The {@link BaseAccountType} to build the tab view from.
* @return The tab indicator View.
*/
- public static View createTabIndicatorView(ViewGroup parent, ContactsSource source) {
+ public static View createTabIndicatorView(ViewGroup parent, BaseAccountType source) {
Drawable icon = null;
if (source != null) {
icon = source.getDisplayIcon(parent.getContext());
diff --git a/src/com/android/contacts/SplitAggregateView.java b/src/com/android/contacts/SplitAggregateView.java
index b85a4ab..a7a56b2 100644
--- a/src/com/android/contacts/SplitAggregateView.java
+++ b/src/com/android/contacts/SplitAggregateView.java
@@ -16,8 +16,8 @@
package com.android.contacts;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountTypes;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -73,7 +73,7 @@
private final Uri mAggregateUri;
private OnContactSelectedListener mListener;
- private Sources mSources;
+ private AccountTypes mSources;
/**
* Listener interface that gets the contact ID of the user-selected contact.
@@ -90,7 +90,7 @@
mAggregateUri = aggregateUri;
- mSources = Sources.getInstance(context);
+ mSources = AccountTypes.getInstance(context);
final List<RawContactInfo> list = loadData();
@@ -247,8 +247,8 @@
cache.additionalData.setText(info.getAdditionalData());
Drawable icon = null;
- ContactsSource source = mSources.getInflatedSource(info.accountType,
- ContactsSource.LEVEL_SUMMARY);
+ BaseAccountType source = mSources.getInflatedSource(info.accountType,
+ BaseAccountType.LEVEL_SUMMARY);
if (source != null) {
icon = source.getDisplayIcon(getContext());
}
diff --git a/src/com/android/contacts/interactions/ContactDeletionInteraction.java b/src/com/android/contacts/interactions/ContactDeletionInteraction.java
index 5746efc..76ca76e 100644
--- a/src/com/android/contacts/interactions/ContactDeletionInteraction.java
+++ b/src/com/android/contacts/interactions/ContactDeletionInteraction.java
@@ -17,8 +17,8 @@
package com.android.contacts.interactions;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountTypes;
import android.app.Activity;
import android.app.AlertDialog;
@@ -110,13 +110,13 @@
int writableSourcesCnt = 0;
int readOnlySourcesCnt = 0;
- Sources sources = getSources();
+ AccountTypes sources = getSources();
try {
while (cursor.moveToNext()) {
final long rawContactId = cursor.getLong(0);
final String accountType = cursor.getString(1);
- ContactsSource contactsSource = sources.getInflatedSource(accountType,
- ContactsSource.LEVEL_SUMMARY);
+ BaseAccountType contactsSource = sources.getInflatedSource(accountType,
+ BaseAccountType.LEVEL_SUMMARY);
boolean readonly = contactsSource != null && contactsSource.readOnly;
if (readonly) {
readOnlySourcesCnt ++;
@@ -190,8 +190,8 @@
}
/* Visible for testing */
- Sources getSources() {
- return Sources.getInstance(mContext);
+ AccountTypes getSources() {
+ return AccountTypes.getInstance(mContext);
}
/* Visible for testing */
diff --git a/src/com/android/contacts/interactions/ImportExportInteraction.java b/src/com/android/contacts/interactions/ImportExportInteraction.java
index f8ffb52..1055672 100644
--- a/src/com/android/contacts/interactions/ImportExportInteraction.java
+++ b/src/com/android/contacts/interactions/ImportExportInteraction.java
@@ -17,7 +17,7 @@
package com.android.contacts.interactions;
import com.android.contacts.R;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.AccountTypes;
import com.android.contacts.util.AccountSelectionUtil;
import com.android.contacts.vcard.ExportVCardActivity;
@@ -199,7 +199,7 @@
// - more than one accounts -> ask the user
// - just one account -> use the account without asking the user
// - no account -> use phone-local storage without asking the user
- final Sources sources = Sources.getInstance(mContext);
+ final AccountTypes sources = AccountTypes.getInstance(mContext);
final List<Account> accountList = sources.getAccounts(true);
final int size = accountList.size();
if (size > 1) {
diff --git a/src/com/android/contacts/interactions/PhoneNumberInteraction.java b/src/com/android/contacts/interactions/PhoneNumberInteraction.java
index 5cf289e..ac3c3c8 100644
--- a/src/com/android/contacts/interactions/PhoneNumberInteraction.java
+++ b/src/com/android/contacts/interactions/PhoneNumberInteraction.java
@@ -19,10 +19,10 @@
import com.android.contacts.Collapser;
import com.android.contacts.Collapser.Collapsible;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.StringInflater;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.StringInflater;
+import com.android.contacts.model.AccountTypes;
import android.app.Activity;
import android.app.AlertDialog;
@@ -128,11 +128,11 @@
* A list adapter that populates the list of contact's phone numbers.
*/
private class PhoneItemAdapter extends ArrayAdapter<PhoneItem> {
- private final Sources mSources;
+ private final AccountTypes mSources;
public PhoneItemAdapter(Context context) {
super(context, R.layout.phone_disambig_item, android.R.id.text2);
- mSources = Sources.getInstance(context);
+ mSources = AccountTypes.getInstance(context);
}
@Override
@@ -140,8 +140,8 @@
View view = super.getView(position, convertView, parent);
PhoneItem item = getItem(position);
- ContactsSource source = mSources.getInflatedSource(item.accountType,
- ContactsSource.LEVEL_SUMMARY);
+ BaseAccountType source = mSources.getInflatedSource(item.accountType,
+ BaseAccountType.LEVEL_SUMMARY);
// Obtain a string representation of the phone type specific to the
// ContactSource associated with that phone number
diff --git a/src/com/android/contacts/list/ContactListFilterLoader.java b/src/com/android/contacts/list/ContactListFilterLoader.java
index 3bd334f..ae791ab 100644
--- a/src/com/android/contacts/list/ContactListFilterLoader.java
+++ b/src/com/android/contacts/list/ContactListFilterLoader.java
@@ -16,8 +16,8 @@
package com.android.contacts.list;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountTypes;
import android.accounts.Account;
import android.content.AsyncTaskLoader;
@@ -65,11 +65,11 @@
ArrayList<ContactListFilter> results = new ArrayList<ContactListFilter>();
Context context = getContext();
- final Sources sources = Sources.getInstance(context);
+ final AccountTypes sources = AccountTypes.getInstance(context);
ArrayList<Account> accounts = sources.getAccounts(false);
for (Account account : accounts) {
- ContactsSource source = sources.getInflatedSource(
- account.type, ContactsSource.LEVEL_SUMMARY);
+ BaseAccountType source = sources.getInflatedSource(
+ account.type, BaseAccountType.LEVEL_SUMMARY);
Drawable icon = source != null ? source.getDisplayIcon(getContext()) : null;
results.add(new ContactListFilter(account.type, account.name, icon, account.name));
}
diff --git a/src/com/android/contacts/list/CustomContactListFilterActivity.java b/src/com/android/contacts/list/CustomContactListFilterActivity.java
index 7e31c53..6221d08 100644
--- a/src/com/android/contacts/list/CustomContactListFilterActivity.java
+++ b/src/com/android/contacts/list/CustomContactListFilterActivity.java
@@ -18,10 +18,10 @@
import com.android.contacts.ContactsSearchManager;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
+import com.android.contacts.model.BaseAccountType;
import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.model.GoogleSource;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.GoogleAccountType;
+import com.android.contacts.model.AccountTypes;
import com.android.contacts.preference.ContactsPreferences;
import com.android.contacts.util.EmptyService;
import com.android.contacts.util.LocalizedNameResolver;
@@ -156,7 +156,7 @@
/**
* Background operation to build set of {@link AccountDisplay} for each
- * {@link Sources#getAccounts(boolean)} that provides groups.
+ * {@link AccountTypes#getAccounts(boolean)} that provides groups.
*/
private static class QueryGroupsTask extends
WeakAsyncTask<Void, Void, AccountSet, CustomContactListFilterActivity> {
@@ -168,7 +168,7 @@
protected AccountSet doInBackground(CustomContactListFilterActivity target,
Void... params) {
final Context context = target;
- final Sources sources = Sources.getInstance(context);
+ final AccountTypes sources = AccountTypes.getInstance(context);
final ContentResolver resolver = context.getContentResolver();
// Inflate groups entry for each account
@@ -501,7 +501,7 @@
protected static class DisplayAdapter extends BaseExpandableListAdapter {
private Context mContext;
private LayoutInflater mInflater;
- private Sources mSources;
+ private AccountTypes mSources;
private AccountSet mAccounts;
private boolean mChildWithPhones = false;
@@ -509,7 +509,7 @@
public DisplayAdapter(Context context) {
mContext = context;
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mSources = Sources.getInstance(context);
+ mSources = AccountTypes.getInstance(context);
}
public void setAccounts(AccountSet accounts) {
@@ -569,8 +569,8 @@
final AccountDisplay account = (AccountDisplay)this.getGroup(groupPosition);
- final ContactsSource source = mSources.getInflatedSource(account.mType,
- ContactsSource.LEVEL_SUMMARY);
+ final BaseAccountType source = mSources.getInflatedSource(account.mType,
+ BaseAccountType.LEVEL_SUMMARY);
text1.setText(account.mName);
text2.setText(source.getDisplayLabel(mContext));
@@ -709,7 +709,7 @@
protected int getSyncMode(AccountDisplay account) {
// TODO: read sync mode through <sync-adapter> definition
- if (GoogleSource.ACCOUNT_TYPE.equals(account.mType)) {
+ if (GoogleAccountType.ACCOUNT_TYPE.equals(account.mType)) {
return SYNC_MODE_EVERYTHING;
} else {
return SYNC_MODE_UNSUPPORTED;
diff --git a/src/com/android/contacts/model/Sources.java b/src/com/android/contacts/model/AccountTypes.java
similarity index 80%
rename from src/com/android/contacts/model/Sources.java
rename to src/com/android/contacts/model/AccountTypes.java
index 44631e8..acf9569 100644
--- a/src/com/android/contacts/model/Sources.java
+++ b/src/com/android/contacts/model/AccountTypes.java
@@ -16,7 +16,7 @@
package com.android.contacts.model;
-import com.android.contacts.model.ContactsSource.DataKind;
+import com.android.contacts.model.BaseAccountType.DataKind;
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
import com.google.android.collect.Sets;
@@ -44,32 +44,32 @@
import java.util.HashSet;
/**
- * Singleton holder for all parsed {@link ContactsSource} available on the
+ * Singleton holder for all parsed {@link BaseAccountType} available on the
* system, typically filled through {@link PackageManager} queries.
*/
-public class Sources extends BroadcastReceiver implements OnAccountsUpdateListener {
- private static final String TAG = "Sources";
+public class AccountTypes extends BroadcastReceiver implements OnAccountsUpdateListener {
+ private static final String TAG = "AccountTypes";
private Context mContext;
private Context mApplicationContext;
private AccountManager mAccountManager;
- private ContactsSource mFallbackSource = null;
+ private BaseAccountType mFallbackSource = null;
- private HashMap<String, ContactsSource> mSources = Maps.newHashMap();
+ private HashMap<String, BaseAccountType> mSources = Maps.newHashMap();
private HashSet<String> mKnownPackages = Sets.newHashSet();
- private static SoftReference<Sources> sInstance = null;
+ private static SoftReference<AccountTypes> sInstance = null;
/**
- * Requests the singleton instance of {@link Sources} with data bound from
+ * Requests the singleton instance of {@link AccountTypes} with data bound from
* the available authenticators. This method can safely be called from the UI thread.
*/
- public static synchronized Sources getInstance(Context context) {
- Sources sources = sInstance == null ? null : sInstance.get();
+ public static synchronized AccountTypes getInstance(Context context) {
+ AccountTypes sources = sInstance == null ? null : sInstance.get();
if (sources == null) {
- sources = new Sources(context);
- sInstance = new SoftReference<Sources>(sources);
+ sources = new AccountTypes(context);
+ sInstance = new SoftReference<AccountTypes>(sources);
}
return sources;
}
@@ -77,13 +77,13 @@
/**
* Internal constructor that only performs initial parsing.
*/
- private Sources(Context context) {
+ private AccountTypes(Context context) {
mContext = context;
mApplicationContext = context.getApplicationContext();
mAccountManager = AccountManager.get(mApplicationContext);
// Create fallback contacts source for on-phone contacts
- mFallbackSource = new FallbackSource();
+ mFallbackSource = new FallbackAccountType();
queryAccounts();
@@ -107,13 +107,13 @@
}
/** @hide exposed for unit tests */
- public Sources(ContactsSource... sources) {
- for (ContactsSource source : sources) {
+ public AccountTypes(BaseAccountType... sources) {
+ for (BaseAccountType source : sources) {
addSource(source);
}
}
- protected void addSource(ContactsSource source) {
+ protected void addSource(BaseAccountType source) {
mSources.put(source.accountType, source);
mKnownPackages.add(source.resPackageName);
}
@@ -155,7 +155,7 @@
}
protected void invalidateCache(String packageName) {
- for (ContactsSource source : mSources.values()) {
+ for (BaseAccountType source : mSources.values()) {
if (TextUtils.equals(packageName, source.resPackageName)) {
// Invalidate any cache for the changed package
source.invalidateCache();
@@ -165,7 +165,7 @@
protected void invalidateAllCache() {
mFallbackSource.invalidateCache();
- for (ContactsSource source : mSources.values()) {
+ for (BaseAccountType source : mSources.values()) {
source.invalidateCache();
}
}
@@ -201,16 +201,16 @@
final String accountType = sync.accountType;
final AuthenticatorDescription auth = findAuthenticator(auths, accountType);
- ContactsSource source;
- if (GoogleSource.ACCOUNT_TYPE.equals(accountType)) {
- source = new GoogleSource(auth.packageName);
- } else if (ExchangeSource.ACCOUNT_TYPE.equals(accountType)) {
- source = new ExchangeSource(auth.packageName);
+ BaseAccountType source;
+ if (GoogleAccountType.ACCOUNT_TYPE.equals(accountType)) {
+ source = new GoogleAccountType(auth.packageName);
+ } else if (ExchangeAccountType.ACCOUNT_TYPE.equals(accountType)) {
+ source = new ExchangeAccountType(auth.packageName);
} else {
// TODO: use syncadapter package instead, since it provides resources
Log.d(TAG, "Creating external source for type=" + accountType
+ ", packageName=" + auth.packageName);
- source = new ExternalSource(auth.packageName);
+ source = new ExternalAccountType(auth.packageName);
source.readOnly = !sync.supportsUploading();
}
@@ -240,7 +240,7 @@
}
/**
- * Return list of all known, writable {@link ContactsSource}. Sources
+ * Return list of all known, writable {@link BaseAccountType}. AccountTypes
* returned may require inflation before they can be used.
*/
public ArrayList<Account> getAccounts(boolean writableOnly) {
@@ -250,10 +250,11 @@
for (Account account : accounts) {
// Ensure we have details loaded for each account
- final ContactsSource source = getInflatedSource(account.type,
- ContactsSource.LEVEL_SUMMARY);
- final boolean hasContacts = source != null;
- final boolean matchesWritable = (!writableOnly || (writableOnly && !source.readOnly));
+ final BaseAccountType accountType = getInflatedSource(account.type,
+ BaseAccountType.LEVEL_SUMMARY);
+ final boolean hasContacts = accountType != null;
+ final boolean matchesWritable =
+ (!writableOnly || (writableOnly && !accountType.readOnly));
if (hasContacts && matchesWritable) {
matching.add(account);
}
@@ -263,7 +264,7 @@
/**
* Find the best {@link DataKind} matching the requested
- * {@link ContactsSource#accountType} and {@link DataKind#mimeType}. If no
+ * {@link BaseAccountType#accountType} and {@link DataKind#mimeType}. If no
* direct match found, we try searching {@link #mFallbackSource}.
* When fourceRefresh is set to true, cache is refreshed and inflation of each
* EditField will occur.
@@ -273,7 +274,7 @@
DataKind kind = null;
// Try finding source and kind matching request
- final ContactsSource source = mSources.get(accountType);
+ final BaseAccountType source = mSources.get(accountType);
if (source != null) {
source.ensureInflated(context, inflateLevel);
kind = source.getKindForMimetype(mimeType);
@@ -293,11 +294,11 @@
}
/**
- * Return {@link ContactsSource} for the given account type.
+ * Return {@link BaseAccountType} for the given account type.
*/
- public ContactsSource getInflatedSource(String accountType, int inflateLevel) {
+ public BaseAccountType getInflatedSource(String accountType, int inflateLevel) {
// Try finding specific source, otherwise use fallback
- ContactsSource source = mSources.get(accountType);
+ BaseAccountType source = mSources.get(accountType);
if (source == null) source = mFallbackSource;
if (source.isInflated(inflateLevel)) {
diff --git a/src/com/android/contacts/model/ContactsSource.java b/src/com/android/contacts/model/BaseAccountType.java
similarity index 97%
rename from src/com/android/contacts/model/ContactsSource.java
rename to src/com/android/contacts/model/BaseAccountType.java
index b417224..174195e 100644
--- a/src/com/android/contacts/model/ContactsSource.java
+++ b/src/com/android/contacts/model/BaseAccountType.java
@@ -46,7 +46,7 @@
* <p>
* In the future this may be inflated from XML defined by a data source.
*/
-public abstract class ContactsSource {
+public abstract class BaseAccountType {
/**
* The {@link RawContacts#ACCOUNT_TYPE} these constraints apply to.
*/
@@ -91,7 +91,7 @@
}
/**
- * Ensure that this {@link ContactsSource} has been inflated to the
+ * Ensure that this {@link BaseAccountType} has been inflated to the
* requested level.
*/
public synchronized void ensureInflated(Context context, int inflateLevel) {
@@ -107,7 +107,7 @@
protected abstract void inflate(Context context, int inflateLevel);
/**
- * Invalidate any cache for this {@link ContactsSource}, removing all
+ * Invalidate any cache for this {@link BaseAccountType}, removing all
* inflated data. Calling {@link #ensureInflated(Context, int)} will
* populate again from scratch.
*/
@@ -165,7 +165,7 @@
/**
* Find the {@link DataKind} for a specific MIME-type, if it's handled by
* this data source. If you may need a fallback {@link DataKind}, use
- * {@link Sources#getKindOrFallback(String, String, Context, int)}.
+ * {@link AccountTypes#getKindOrFallback(String, String, Context, int)}.
*/
public DataKind getKindForMimetype(String mimeType) {
return this.mMimeKinds.get(mimeType);
diff --git a/src/com/android/contacts/model/EntityModifier.java b/src/com/android/contacts/model/EntityModifier.java
index 7a19bf8..c6c97cb 100644
--- a/src/com/android/contacts/model/EntityModifier.java
+++ b/src/com/android/contacts/model/EntityModifier.java
@@ -17,9 +17,9 @@
package com.android.contacts.model;
import com.android.contacts.ContactsUtils;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.EditField;
-import com.android.contacts.model.ContactsSource.EditType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.EditField;
+import com.android.contacts.model.BaseAccountType.EditType;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.google.android.collect.Lists;
@@ -50,7 +50,7 @@
/**
* Helper methods for modifying an {@link EntityDelta}, such as inserting
- * new rows, or enforcing {@link ContactsSource}.
+ * new rows, or enforcing {@link BaseAccountType}.
*/
public class EntityModifier {
private static final String TAG = "EntityModifier";
@@ -58,7 +58,7 @@
/**
* For the given {@link EntityDelta}, determine if the given
* {@link DataKind} could be inserted under specific
- * {@link ContactsSource}.
+ * {@link BaseAccountType}.
*/
public static boolean canInsert(EntityDelta state, DataKind kind) {
// Insert possible when have valid types and under overall maximum
@@ -81,7 +81,7 @@
* Ensure that at least one of the given {@link DataKind} exists in the
* given {@link EntityDelta} state, and try creating one if none exist.
*/
- public static void ensureKindExists(EntityDelta state, ContactsSource source, String mimeType) {
+ public static void ensureKindExists(EntityDelta state, BaseAccountType source, String mimeType) {
final DataKind kind = source.getKindForMimetype(mimeType);
final boolean hasChild = state.getMimeEntriesCount(mimeType, true) > 0;
@@ -97,7 +97,7 @@
/**
* For the given {@link EntityDelta} and {@link DataKind}, return the
* list possible {@link EditType} options available based on
- * {@link ContactsSource}.
+ * {@link BaseAccountType}.
*/
public static ArrayList<EditType> getValidTypes(EntityDelta state, DataKind kind) {
return getValidTypes(state, kind, null, true, null);
@@ -106,7 +106,7 @@
/**
* For the given {@link EntityDelta} and {@link DataKind}, return the
* list possible {@link EditType} options available based on
- * {@link ContactsSource}.
+ * {@link BaseAccountType}.
*
* @param forceInclude Always include this {@link EditType} in the returned
* list, even when an otherwise-invalid choice. This is useful
@@ -120,7 +120,7 @@
/**
* For the given {@link EntityDelta} and {@link DataKind}, return the
* list possible {@link EditType} options available based on
- * {@link ContactsSource}.
+ * {@link BaseAccountType}.
*
* @param forceInclude Always include this {@link EditType} in the returned
* list, even when an otherwise-invalid choice. This is useful
@@ -348,26 +348,26 @@
/**
* Processing to trim any empty {@link ValuesDelta} and {@link EntityDelta}
- * from the given {@link EntityDeltaList}, assuming the given {@link Sources}
+ * from the given {@link EntityDeltaList}, assuming the given {@link AccountTypes}
* dictates the structure for various fields. This method ignores rows not
- * described by the {@link ContactsSource}.
+ * described by the {@link BaseAccountType}.
*/
- public static void trimEmpty(EntityDeltaList set, Sources sources) {
+ public static void trimEmpty(EntityDeltaList set, AccountTypes sources) {
for (EntityDelta state : set) {
final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final ContactsSource source = sources.getInflatedSource(accountType,
- ContactsSource.LEVEL_MIMETYPES);
+ final BaseAccountType source = sources.getInflatedSource(accountType,
+ BaseAccountType.LEVEL_MIMETYPES);
trimEmpty(state, source);
}
}
/**
* Processing to trim any empty {@link ValuesDelta} rows from the given
- * {@link EntityDelta}, assuming the given {@link ContactsSource} dictates
+ * {@link EntityDelta}, assuming the given {@link BaseAccountType} dictates
* the structure for various fields. This method ignores rows not described
- * by the {@link ContactsSource}.
+ * by the {@link BaseAccountType}.
*/
- public static void trimEmpty(EntityDelta state, ContactsSource source) {
+ public static void trimEmpty(EntityDelta state, BaseAccountType source) {
boolean hasValues = false;
// Walk through entries for each well-known kind
@@ -385,7 +385,7 @@
}
// Test and remove this row if empty and it isn't a photo from google
- final boolean isGoogleSource = TextUtils.equals(GoogleSource.ACCOUNT_TYPE,
+ final boolean isGoogleSource = TextUtils.equals(GoogleAccountType.ACCOUNT_TYPE,
state.getValues().getAsString(RawContacts.ACCOUNT_TYPE));
final boolean isPhoto = TextUtils.equals(Photo.CONTENT_ITEM_TYPE, kind.mimeType);
final boolean isGooglePhoto = isPhoto && isGoogleSource;
@@ -429,7 +429,7 @@
* Parse the given {@link Bundle} into the given {@link EntityDelta} state,
* assuming the extras defined through {@link Intents}.
*/
- public static void parseExtras(Context context, ContactsSource source, EntityDelta state,
+ public static void parseExtras(Context context, BaseAccountType source, EntityDelta state,
Bundle extras) {
if (extras == null || extras.size() == 0) {
// Bail early if no useful data
diff --git a/src/com/android/contacts/model/ExchangeSource.java b/src/com/android/contacts/model/ExchangeAccountType.java
similarity index 89%
rename from src/com/android/contacts/model/ExchangeSource.java
rename to src/com/android/contacts/model/ExchangeAccountType.java
index 6f91840..a78354a 100644
--- a/src/com/android/contacts/model/ExchangeSource.java
+++ b/src/com/android/contacts/model/ExchangeAccountType.java
@@ -34,11 +34,11 @@
import java.util.Locale;
-public class ExchangeSource extends FallbackSource {
+public class ExchangeAccountType extends FallbackAccountType {
public static final String ACCOUNT_TYPE = "com.android.exchange";
- public ExchangeSource(String resPackageName) {
+ public ExchangeAccountType(String resPackageName) {
this.accountType = ACCOUNT_TYPE;
this.resPackageName = null;
this.summaryResPackageName = resPackageName;
@@ -65,9 +65,9 @@
@Override
protected DataKind inflateStructuredName(Context context, int inflateLevel) {
- final DataKind kind = super.inflateStructuredName(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateStructuredName(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
boolean displayOrderPrimary =
context.getResources().getBoolean(R.bool.config_editor_field_order_primary);
kind.typeOverallMax = 1;
@@ -109,9 +109,9 @@
@Override
protected DataKind inflateNickname(Context context, int inflateLevel) {
- final DataKind kind = super.inflateNickname(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateNickname(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.isList = false;
kind.fieldList = Lists.newArrayList();
@@ -124,9 +124,9 @@
@Override
protected DataKind inflatePhone(Context context, int inflateLevel) {
- final DataKind kind = super.inflatePhone(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflatePhone(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Phone.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildPhoneType(Phone.TYPE_HOME).setSpecificMax(2));
@@ -156,9 +156,9 @@
@Override
protected DataKind inflateEmail(Context context, int inflateLevel) {
- final DataKind kind = super.inflateEmail(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateEmail(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.typeOverallMax = 3;
kind.fieldList = Lists.newArrayList();
@@ -170,9 +170,9 @@
@Override
protected DataKind inflateStructuredPostal(Context context, int inflateLevel) {
- final DataKind kind = super.inflateStructuredPostal(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateStructuredPostal(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
final boolean useJapaneseOrder =
Locale.JAPANESE.getLanguage().equals(Locale.getDefault().getLanguage());
kind.typeColumn = StructuredPostal.TYPE;
@@ -212,9 +212,9 @@
@Override
protected DataKind inflateIm(Context context, int inflateLevel) {
- final DataKind kind = super.inflateIm(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateIm(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.typeOverallMax = 3;
// NOTE: even though a traditional "type" exists, for editing
@@ -245,9 +245,9 @@
@Override
protected DataKind inflateOrganization(Context context, int inflateLevel) {
- final DataKind kind = super.inflateOrganization(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateOrganization(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.isList = false;
kind.typeColumn = Organization.TYPE;
kind.typeList = Lists.newArrayList();
@@ -268,9 +268,9 @@
@Override
protected DataKind inflatePhoto(Context context, int inflateLevel) {
- final DataKind kind = super.inflatePhoto(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflatePhoto(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.typeOverallMax = 1;
kind.fieldList = Lists.newArrayList();
@@ -282,9 +282,9 @@
@Override
protected DataKind inflateNote(Context context, int inflateLevel) {
- final DataKind kind = super.inflateNote(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateNote(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
}
@@ -294,9 +294,9 @@
@Override
protected DataKind inflateWebsite(Context context, int inflateLevel) {
- final DataKind kind = super.inflateWebsite(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateWebsite(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.isList = false;
kind.fieldList = Lists.newArrayList();
diff --git a/src/com/android/contacts/model/ExternalSource.java b/src/com/android/contacts/model/ExternalAccountType.java
similarity index 92%
rename from src/com/android/contacts/model/ExternalSource.java
rename to src/com/android/contacts/model/ExternalAccountType.java
index aa9d888..7393c51 100644
--- a/src/com/android/contacts/model/ExternalSource.java
+++ b/src/com/android/contacts/model/ExternalAccountType.java
@@ -71,22 +71,22 @@
* <p>
* In the future this may be inflated from XML defined by a data source.
*/
-public class ExternalSource extends FallbackSource {
+public class ExternalAccountType extends FallbackAccountType {
private static final String ACTION_SYNC_ADAPTER = "android.content.SyncAdapter";
private static final String METADATA_CONTACTS = "android.provider.CONTACTS_STRUCTURE";
private interface InflateTags {
- final String CONTACTS_SOURCE = "ContactsSource";
+ final String CONTACTS_SOURCE = "BaseAccountType";
final String CONTACTS_DATA_KIND = "ContactsDataKind";
}
- public ExternalSource(String resPackageName) {
+ public ExternalAccountType(String resPackageName) {
this.resPackageName = resPackageName;
this.summaryResPackageName = resPackageName;
}
/**
- * Ensure that the constraint rules behind this {@link ContactsSource} have
+ * Ensure that the constraint rules behind this {@link BaseAccountType} have
* been inflated. Because this may involve parsing meta-data from
* {@link PackageManager}, it shouldn't be called from a UI thread.
*/
@@ -112,7 +112,7 @@
}
/**
- * Inflate this {@link ContactsSource} from the given parser. This may only
+ * Inflate this {@link BaseAccountType} from the given parser. This may only
* load details matching the publicly-defined schema.
*/
protected void inflate(Context context, XmlPullParser parser) {
@@ -156,7 +156,7 @@
.getString(com.android.internal.R.styleable.ContactsDataKind_summaryColumn);
if (summaryColumn != null) {
// Inflate a specific column as summary when requested
- kind.actionHeader = new FallbackSource.SimpleInflater(summaryColumn);
+ kind.actionHeader = new FallbackAccountType.SimpleInflater(summaryColumn);
}
final String detailColumn = a
@@ -172,7 +172,7 @@
if (detailColumn != null) {
// Inflate specific column as summary
- kind.actionBody = new FallbackSource.SimpleInflater(detailColumn);
+ kind.actionBody = new FallbackAccountType.SimpleInflater(detailColumn);
}
addKind(kind);
diff --git a/src/com/android/contacts/model/FallbackSource.java b/src/com/android/contacts/model/FallbackAccountType.java
similarity index 97%
rename from src/com/android/contacts/model/FallbackSource.java
rename to src/com/android/contacts/model/FallbackAccountType.java
index dbd56fb..2f4b8ff 100644
--- a/src/com/android/contacts/model/FallbackSource.java
+++ b/src/com/android/contacts/model/FallbackAccountType.java
@@ -39,7 +39,7 @@
import android.provider.ContactsContract.CommonDataKinds.Website;
import android.view.inputmethod.EditorInfo;
-public class FallbackSource extends ContactsSource {
+public class FallbackAccountType extends BaseAccountType {
protected static final int FLAGS_PHONE = EditorInfo.TYPE_CLASS_PHONE;
protected static final int FLAGS_EMAIL = EditorInfo.TYPE_CLASS_TEXT
| EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS;
@@ -61,7 +61,7 @@
| EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; // since SIP addresses have the same
// basic format as email addresses
- public FallbackSource() {
+ public FallbackAccountType() {
this.accountType = null;
this.titleRes = R.string.account_phone;
this.iconRes = R.drawable.ic_launcher_contacts;
@@ -121,7 +121,7 @@
kind.actionBody = new SimpleInflater(Nickname.NAME);
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(StructuredName.DISPLAY_NAME,
R.string.full_name, FLAGS_PERSON_NAME).setShortForm(true));
@@ -180,7 +180,7 @@
kind.actionBody = new SimpleInflater(Nickname.NAME);
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.defaultValues = new ContentValues();
kind.defaultValues.put(Nickname.TYPE, Nickname.TYPE_DEFAULT);
@@ -203,7 +203,7 @@
kind.actionBody = new SimpleInflater(Phone.NUMBER);
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Phone.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
@@ -246,7 +246,7 @@
kind.actionBody = new SimpleInflater(Email.DATA);
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Email.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildEmailType(Email.TYPE_HOME));
@@ -272,7 +272,7 @@
kind.actionBody = new SimpleInflater(StructuredPostal.FORMATTED_ADDRESS);
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = StructuredPostal.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildPostalType(StructuredPostal.TYPE_HOME));
@@ -300,7 +300,7 @@
kind.actionBody = new SimpleInflater(Im.DATA);
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
// NOTE: even though a traditional "type" exists, for editing
// purposes we're using the protocol to pick labels
@@ -336,7 +336,7 @@
kind.actionBody = new SimpleInflater(Organization.TITLE);
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Organization.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildOrgType(Organization.TYPE_WORK));
@@ -360,7 +360,7 @@
kind = addKind(new DataKind(Photo.CONTENT_ITEM_TYPE, -1, -1, -1, true));
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(Photo.PHOTO, -1, -1));
}
@@ -379,7 +379,7 @@
kind.actionBody = new SimpleInflater(Note.NOTE);
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(Note.NOTE, R.string.label_notes, FLAGS_NOTE));
}
@@ -397,7 +397,7 @@
kind.actionBody = new SimpleInflater(Website.URL);
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.defaultValues = new ContentValues();
kind.defaultValues.put(Website.TYPE, Website.TYPE_OTHER);
@@ -457,7 +457,7 @@
kind.actionBody = new SimpleInflater(SipAddress.SIP_ADDRESS);
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(SipAddress.SIP_ADDRESS,
R.string.label_sip_address, FLAGS_SIP_ADDRESS));
@@ -475,7 +475,7 @@
kind.isList = false;
}
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.fieldList = Lists.newArrayList();
kind.fieldList.add(new EditField(GroupMembership.GROUP_ROW_ID, -1, -1));
}
diff --git a/src/com/android/contacts/model/GoogleSource.java b/src/com/android/contacts/model/GoogleAccountType.java
similarity index 89%
rename from src/com/android/contacts/model/GoogleSource.java
rename to src/com/android/contacts/model/GoogleAccountType.java
index f8abb94..404c109 100644
--- a/src/com/android/contacts/model/GoogleSource.java
+++ b/src/com/android/contacts/model/GoogleAccountType.java
@@ -23,10 +23,10 @@
import android.provider.ContactsContract.CommonDataKinds.Email;
import android.provider.ContactsContract.CommonDataKinds.Phone;
-public class GoogleSource extends FallbackSource {
+public class GoogleAccountType extends FallbackAccountType {
public static final String ACCOUNT_TYPE = "com.google";
- public GoogleSource(String resPackageName) {
+ public GoogleAccountType(String resPackageName) {
this.accountType = ACCOUNT_TYPE;
this.resPackageName = null;
this.summaryResPackageName = resPackageName;
@@ -55,9 +55,9 @@
@Override
protected DataKind inflatePhone(Context context, int inflateLevel) {
- final DataKind kind = super.inflatePhone(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflatePhone(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Phone.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildPhoneType(Phone.TYPE_HOME));
@@ -79,9 +79,9 @@
@Override
protected DataKind inflateEmail(Context context, int inflateLevel) {
- final DataKind kind = super.inflateEmail(context, ContactsSource.LEVEL_MIMETYPES);
+ final DataKind kind = super.inflateEmail(context, BaseAccountType.LEVEL_MIMETYPES);
- if (inflateLevel >= ContactsSource.LEVEL_CONSTRAINTS) {
+ if (inflateLevel >= BaseAccountType.LEVEL_CONSTRAINTS) {
kind.typeColumn = Email.TYPE;
kind.typeList = Lists.newArrayList();
kind.typeList.add(buildEmailType(Email.TYPE_HOME));
diff --git a/src/com/android/contacts/preference/ContactsPreferenceActivity.java b/src/com/android/contacts/preference/ContactsPreferenceActivity.java
index 0828abe..3ec2e61 100644
--- a/src/com/android/contacts/preference/ContactsPreferenceActivity.java
+++ b/src/com/android/contacts/preference/ContactsPreferenceActivity.java
@@ -18,10 +18,10 @@
import com.android.contacts.ContactsSearchManager;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
+import com.android.contacts.model.BaseAccountType;
import com.android.contacts.model.EntityDelta.ValuesDelta;
-import com.android.contacts.model.GoogleSource;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.GoogleAccountType;
+import com.android.contacts.model.AccountTypes;
import com.android.contacts.util.EmptyService;
import com.android.contacts.util.LocalizedNameResolver;
import com.android.contacts.util.WeakAsyncTask;
@@ -333,7 +333,7 @@
//
// /**
// * Background operation to build set of {@link AccountDisplay} for each
-// * {@link Sources#getAccounts(boolean)} that provides groups.
+// * {@link AccountTypes#getAccounts(boolean)} that provides groups.
// */
// private static class QueryGroupsTask extends
// WeakAsyncTask<Void, Void, AccountSet, ContactsPreferenceActivity> {
@@ -345,7 +345,7 @@
// protected AccountSet doInBackground(ContactsPreferenceActivity target,
// Void... params) {
// final Context context = target;
-// final Sources sources = Sources.getInstance(context);
+// final AccountTypes sources = AccountTypes.getInstance(context);
// final ContentResolver resolver = context.getContentResolver();
//
// // Inflate groups entry for each account
@@ -676,7 +676,7 @@
// protected static class DisplayAdapter extends BaseExpandableListAdapter {
// private Context mContext;
// private LayoutInflater mInflater;
-// private Sources mSources;
+// private AccountTypes mSources;
// private AccountSet mAccounts;
//
// private boolean mChildWithPhones = false;
@@ -684,7 +684,7 @@
// public DisplayAdapter(Context context) {
// mContext = context;
// mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-// mSources = Sources.getInstance(context);
+// mSources = AccountTypes.getInstance(context);
// }
//
// public void setAccounts(AccountSet accounts) {
@@ -753,8 +753,8 @@
//
// final AccountDisplay account = (AccountDisplay)this.getGroup(groupPosition);
//
-// final ContactsSource source = mSources.getInflatedSource(account.mType,
-// ContactsSource.LEVEL_SUMMARY);
+// final BaseAccountType source = mSources.getInflatedSource(account.mType,
+// BaseAccountType.LEVEL_SUMMARY);
//
// text1.setText(account.mName);
// text2.setText(source.getDisplayLabel(mContext));
@@ -903,7 +903,7 @@
//
// protected int getSyncMode(AccountDisplay account) {
// // TODO: read sync mode through <sync-adapter> definition
-// if (GoogleSource.ACCOUNT_TYPE.equals(account.mType)) {
+// if (GoogleAccountType.ACCOUNT_TYPE.equals(account.mType)) {
// return SYNC_MODE_EVERYTHING;
// } else {
// return SYNC_MODE_UNSUPPORTED;
diff --git a/src/com/android/contacts/quickcontact/QuickContactWindow.java b/src/com/android/contacts/quickcontact/QuickContactWindow.java
index b615f60..4923f45 100644
--- a/src/com/android/contacts/quickcontact/QuickContactWindow.java
+++ b/src/com/android/contacts/quickcontact/QuickContactWindow.java
@@ -20,9 +20,9 @@
import com.android.contacts.ContactPresenceIconUtil;
import com.android.contacts.ContactsUtils;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.AccountTypes;
import com.android.contacts.util.Constants;
import com.android.contacts.util.DataStatus;
import com.android.contacts.util.NotifyingAsyncQueryHandler;
@@ -1186,7 +1186,7 @@
}
final DataStatus status = new DataStatus();
- final Sources sources = Sources.getInstance(mContext);
+ final AccountTypes sources = AccountTypes.getInstance(mContext);
final ImageView photoView = (ImageView)mHeader.findViewById(R.id.photo);
Bitmap photoBitmap = null;
@@ -1212,7 +1212,7 @@
}
final DataKind kind = sources.getKindOrFallback(accountType, mimeType, mContext,
- ContactsSource.LEVEL_MIMETYPES);
+ BaseAccountType.LEVEL_MIMETYPES);
if (kind != null) {
// Build an action for this data entry, find a mapping to a UI
@@ -1233,7 +1233,7 @@
final boolean hasPresence = !cursor.isNull(DataQuery.PRESENCE);
if (hasPresence && Email.CONTENT_ITEM_TYPE.equals(mimeType)) {
final DataKind imKind = sources.getKindOrFallback(accountType,
- Im.CONTENT_ITEM_TYPE, mContext, ContactsSource.LEVEL_MIMETYPES);
+ Im.CONTENT_ITEM_TYPE, mContext, BaseAccountType.LEVEL_MIMETYPES);
if (imKind != null) {
final Action action = new DataAction(mContext, Im.CONTENT_ITEM_TYPE, imKind,
dataId, cursor);
diff --git a/src/com/android/contacts/util/AccountSelectionUtil.java b/src/com/android/contacts/util/AccountSelectionUtil.java
index 19e21bc..6609a87 100644
--- a/src/com/android/contacts/util/AccountSelectionUtil.java
+++ b/src/com/android/contacts/util/AccountSelectionUtil.java
@@ -32,8 +32,8 @@
import android.widget.TextView;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountTypes;
import java.util.List;
@@ -87,7 +87,7 @@
public static Dialog getSelectAccountDialog(Context context, int resId,
DialogInterface.OnClickListener onClickListener,
DialogInterface.OnCancelListener onCancelListener) {
- final Sources sources = Sources.getInstance(context);
+ final AccountTypes sources = AccountTypes.getInstance(context);
final List<Account> writableAccountList = sources.getAccounts(true);
// Assume accountList.size() > 1
@@ -116,9 +116,9 @@
(TextView)convertView.findViewById(android.R.id.text2);
final Account account = this.getItem(position);
- final ContactsSource source =
+ final BaseAccountType source =
sources.getInflatedSource(account.type,
- ContactsSource.LEVEL_SUMMARY);
+ BaseAccountType.LEVEL_SUMMARY);
final Context context = getContext();
text1.setText(account.name);
diff --git a/src/com/android/contacts/vcard/ImportVCardActivity.java b/src/com/android/contacts/vcard/ImportVCardActivity.java
index 3c3bb78..faa8bf3 100644
--- a/src/com/android/contacts/vcard/ImportVCardActivity.java
+++ b/src/com/android/contacts/vcard/ImportVCardActivity.java
@@ -44,7 +44,7 @@
import android.util.Log;
import com.android.contacts.R;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.AccountTypes;
import com.android.contacts.util.AccountSelectionUtil;
import com.android.vcard.VCardEntryCounter;
import com.android.vcard.VCardInterpreterCollection;
@@ -843,7 +843,7 @@
if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(accountType)) {
mAccount = new Account(accountName, accountType);
} else {
- final Sources sources = Sources.getInstance(this);
+ final AccountTypes sources = AccountTypes.getInstance(this);
final List<Account> accountList = sources.getAccounts(true);
if (accountList.size() == 0) {
mAccount = null;
diff --git a/src/com/android/contacts/vcard/SelectAccountActivity.java b/src/com/android/contacts/vcard/SelectAccountActivity.java
index dfd5196..3b78921 100644
--- a/src/com/android/contacts/vcard/SelectAccountActivity.java
+++ b/src/com/android/contacts/vcard/SelectAccountActivity.java
@@ -24,7 +24,7 @@
import android.util.Log;
import com.android.contacts.R;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.AccountTypes;
import com.android.contacts.util.AccountSelectionUtil;
import java.util.List;
@@ -56,7 +56,7 @@
// - just one account -> use the account without asking the user
// - no account -> use phone-local storage without asking the user
final int resId = R.string.import_from_sdcard;
- final Sources sources = Sources.getInstance(this);
+ final AccountTypes sources = AccountTypes.getInstance(this);
final List<Account> accountList = sources.getAccounts(true);
if (accountList.size() == 0) {
Log.w(LOG_TAG, "Account does not exist");
diff --git a/src/com/android/contacts/views/detail/ContactDetailFragment.java b/src/com/android/contacts/views/detail/ContactDetailFragment.java
index 1292ad5..6a11c1b 100644
--- a/src/com/android/contacts/views/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/views/detail/ContactDetailFragment.java
@@ -24,10 +24,10 @@
import com.android.contacts.ContactsUtils.ImActions;
import com.android.contacts.R;
import com.android.contacts.TypePrecedence;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.EditType;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.EditType;
+import com.android.contacts.model.AccountTypes;
import com.android.contacts.util.Constants;
import com.android.contacts.util.DataStatus;
import com.android.contacts.util.DateUtils;
@@ -294,7 +294,7 @@
mWritableRawContactIds.clear();
- final Sources sources = Sources.getInstance(mContext);
+ final AccountTypes sources = AccountTypes.getInstance(mContext);
// Build up method entries
if (mContactData == null) {
@@ -315,8 +315,8 @@
if (!mRawContactIds.contains(rawContactId)) {
mRawContactIds.add(rawContactId);
}
- ContactsSource contactsSource = sources.getInflatedSource(accountType,
- ContactsSource.LEVEL_SUMMARY);
+ BaseAccountType contactsSource = sources.getInflatedSource(accountType,
+ BaseAccountType.LEVEL_SUMMARY);
if (contactsSource == null || !contactsSource.readOnly) {
mWritableRawContactIds.add(rawContactId);
}
@@ -338,7 +338,7 @@
}
final DataKind kind = sources.getKindOrFallback(accountType, mimeType, mContext,
- ContactsSource.LEVEL_CONSTRAINTS);
+ BaseAccountType.LEVEL_CONSTRAINTS);
if (kind == null) continue;
final ViewEntry entry = ViewEntry.fromValues(mContext, mimeType, kind, dataId,
@@ -395,7 +395,7 @@
if (status != null) {
final String imMime = Im.CONTENT_ITEM_TYPE;
final DataKind imKind = sources.getKindOrFallback(accountType,
- imMime, mContext, ContactsSource.LEVEL_MIMETYPES);
+ imMime, mContext, BaseAccountType.LEVEL_MIMETYPES);
final ViewEntry imEntry = ViewEntry.fromValues(mContext,
imMime, imKind, dataId, entryValues);
final ImActions imActions = ContactsUtils.buildImActions(entryValues);
@@ -495,7 +495,7 @@
// TODO: Consider moving the SipAddress into its own
// section (rather than lumping it in with mOtherEntries)
// so that we can reposition it right under the phone number.
- // (Then, we'd also update FallbackSource.java to set
+ // (Then, we'd also update FallbackAccountType.java to set
// secondary=false for this field, and tweak the weight
// of its DataKind.)
} else if (Event.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {
@@ -1004,7 +1004,7 @@
break;
}
case Directory.EXPORT_SUPPORT_ANY_ACCOUNT: {
- final ArrayList<Account> accounts = Sources.getInstance(mContext).getAccounts(true);
+ final ArrayList<Account> accounts = AccountTypes.getInstance(mContext).getAccounts(true);
if (accounts.isEmpty()) {
createCopy(null);
return; // Don't show a dialog.
diff --git a/src/com/android/contacts/views/editor/BaseRawContactEditorView.java b/src/com/android/contacts/views/editor/BaseRawContactEditorView.java
index d3d034d..76c37d7 100644
--- a/src/com/android/contacts/views/editor/BaseRawContactEditorView.java
+++ b/src/com/android/contacts/views/editor/BaseRawContactEditorView.java
@@ -16,8 +16,8 @@
package com.android.contacts.views.editor;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.ContactsSource.EditType;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.BaseAccountType.EditType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
@@ -37,12 +37,12 @@
* Base view that provides common code for the editor interaction for a specific
* RawContact represented through an {@link EntityDelta}. Callers can
* reuse this view and quickly rebuild its contents through
- * {@link #setState(EntityDelta, ContactsSource)}.
+ * {@link #setState(EntityDelta, BaseAccountType)}.
* <p>
* Internal updates are performed against {@link ValuesDelta} so that the
* source {@link Entity} can be swapped out. Any state-based changes, such as
* adding {@link Data} rows or changing {@link EditType}, are performed through
- * {@link EntityModifier} to ensure that {@link ContactsSource} are enforced.
+ * {@link EntityModifier} to ensure that {@link BaseAccountType} are enforced.
*/
public abstract class BaseRawContactEditorView extends LinearLayout {
protected LayoutInflater mInflater;
@@ -95,8 +95,8 @@
/**
* Set the internal state for this view, given a current
- * {@link EntityDelta} state and the {@link ContactsSource} that
+ * {@link EntityDelta} state and the {@link BaseAccountType} that
* apply to that state.
*/
- public abstract void setState(EntityDelta state, ContactsSource source, ViewIdGenerator vig);
+ public abstract void setState(EntityDelta state, BaseAccountType source, ViewIdGenerator vig);
}
diff --git a/src/com/android/contacts/views/editor/ContactEditorFragment.java b/src/com/android/contacts/views/editor/ContactEditorFragment.java
index 87744ca..d7b1f18 100644
--- a/src/com/android/contacts/views/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/views/editor/ContactEditorFragment.java
@@ -18,13 +18,13 @@
import com.android.contacts.JoinContactActivity;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
+import com.android.contacts.model.BaseAccountType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityDeltaList;
import com.android.contacts.model.EntityModifier;
-import com.android.contacts.model.GoogleSource;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.GoogleAccountType;
+import com.android.contacts.model.AccountTypes;
import com.android.contacts.util.EmptyService;
import com.android.contacts.util.WeakAsyncTask;
import com.android.contacts.views.ContactLoader;
@@ -348,16 +348,16 @@
// Find source defining the first RawContact found
final EntityDelta state = mState.get(0);
final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final Sources sources = Sources.getInstance(mContext);
- final ContactsSource source = sources.getInflatedSource(accountType,
- ContactsSource.LEVEL_CONSTRAINTS);
+ final AccountTypes sources = AccountTypes.getInstance(mContext);
+ final BaseAccountType source = sources.getInflatedSource(accountType,
+ BaseAccountType.LEVEL_CONSTRAINTS);
EntityModifier.parseExtras(mContext, source, state, mIntentExtras);
}
bindEditors();
}
private void selectAccountAndCreateContact(boolean isNewContact) {
- final ArrayList<Account> accounts = Sources.getInstance(mContext).getAccounts(true);
+ final ArrayList<Account> accounts = AccountTypes.getInstance(mContext).getAccounts(true);
// No Accounts available. Create a phone-local contact.
if (accounts.isEmpty()) {
createContact(null, isNewContact);
@@ -382,7 +382,7 @@
* @param prefillFromIntent If this is set, the intent extras will be used to prefill the fields
*/
private void createContact(Account account, boolean prefillFromIntent) {
- final Sources sources = Sources.getInstance(mContext);
+ final AccountTypes sources = AccountTypes.getInstance(mContext);
final ContentValues values = new ContentValues();
if (account != null) {
values.put(RawContacts.ACCOUNT_NAME, account.name);
@@ -394,9 +394,9 @@
// Parse any values from incoming intent
EntityDelta insert = new EntityDelta(ValuesDelta.fromAfter(values));
- final ContactsSource source = sources.getInflatedSource(
+ final BaseAccountType source = sources.getInflatedSource(
account != null ? account.type : null,
- ContactsSource.LEVEL_CONSTRAINTS);
+ BaseAccountType.LEVEL_CONSTRAINTS);
EntityModifier.parseExtras(mContext, source, insert,
prefillFromIntent ? mIntentExtras : null);
@@ -424,7 +424,7 @@
final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
- final Sources sources = Sources.getInstance(mContext);
+ final AccountTypes sources = AccountTypes.getInstance(mContext);
int size = mState.size();
for (int i = 0; i < size; i++) {
// TODO ensure proper ordering of entities in the list
@@ -433,8 +433,8 @@
if (!values.isVisible()) continue;
final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
- final ContactsSource source = sources.getInflatedSource(accountType,
- ContactsSource.LEVEL_CONSTRAINTS);
+ final BaseAccountType source = sources.getInflatedSource(accountType,
+ BaseAccountType.LEVEL_CONSTRAINTS);
final long rawContactId = values.getAsLong(RawContacts._ID);
final BaseRawContactEditorView editor;
@@ -694,7 +694,7 @@
mStatus = Status.SAVING;
// Trim any empty fields, and RawContacts, before persisting
- final Sources sources = Sources.getInstance(mContext);
+ final AccountTypes sources = AccountTypes.getInstance(mContext);
EntityModifier.trimEmpty(mState, sources);
if (mState.buildDiff().isEmpty()) {
@@ -949,13 +949,13 @@
return 0;
}
- final Sources sources = Sources.getInstance(mContext);
+ final AccountTypes sources = AccountTypes.getInstance(mContext);
String accountType = one.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final ContactsSource oneSource = sources.getInflatedSource(accountType,
- ContactsSource.LEVEL_SUMMARY);
+ final BaseAccountType oneSource = sources.getInflatedSource(accountType,
+ BaseAccountType.LEVEL_SUMMARY);
accountType = two.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final ContactsSource twoSource = sources.getInflatedSource(accountType,
- ContactsSource.LEVEL_SUMMARY);
+ final BaseAccountType twoSource = sources.getInflatedSource(accountType,
+ BaseAccountType.LEVEL_SUMMARY);
// Check read-only
if (oneSource.readOnly && !twoSource.readOnly) {
@@ -966,8 +966,8 @@
// Check account type
boolean skipAccountTypeCheck = false;
- boolean oneIsGoogle = oneSource instanceof GoogleSource;
- boolean twoIsGoogle = twoSource instanceof GoogleSource;
+ boolean oneIsGoogle = oneSource instanceof GoogleAccountType;
+ boolean twoIsGoogle = twoSource instanceof GoogleAccountType;
if (oneIsGoogle && !twoIsGoogle) {
return -1;
} else if (twoIsGoogle && !oneIsGoogle) {
diff --git a/src/com/android/contacts/views/editor/Editor.java b/src/com/android/contacts/views/editor/Editor.java
index cb1be64..00d1d62 100644
--- a/src/com/android/contacts/views/editor/Editor.java
+++ b/src/com/android/contacts/views/editor/Editor.java
@@ -17,7 +17,7 @@
package com.android.contacts.views.editor;
import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.ContactsSource.DataKind;
+import com.android.contacts.model.BaseAccountType.DataKind;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import android.provider.ContactsContract.Data;
diff --git a/src/com/android/contacts/views/editor/FieldEditorView.java b/src/com/android/contacts/views/editor/FieldEditorView.java
index 3212ab9..7239c0f 100644
--- a/src/com/android/contacts/views/editor/FieldEditorView.java
+++ b/src/com/android/contacts/views/editor/FieldEditorView.java
@@ -18,9 +18,9 @@
import com.android.contacts.ContactsUtils;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.EditField;
-import com.android.contacts.model.ContactsSource.EditType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.EditField;
+import com.android.contacts.model.BaseAccountType.EditType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
diff --git a/src/com/android/contacts/views/editor/GroupMembershipView.java b/src/com/android/contacts/views/editor/GroupMembershipView.java
index 81fcc25..de505b6 100644
--- a/src/com/android/contacts/views/editor/GroupMembershipView.java
+++ b/src/com/android/contacts/views/editor/GroupMembershipView.java
@@ -17,7 +17,7 @@
package com.android.contacts.views.editor;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource.DataKind;
+import com.android.contacts.model.BaseAccountType.DataKind;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
diff --git a/src/com/android/contacts/views/editor/KindSectionView.java b/src/com/android/contacts/views/editor/KindSectionView.java
index 5e65b0f..de1919c 100644
--- a/src/com/android/contacts/views/editor/KindSectionView.java
+++ b/src/com/android/contacts/views/editor/KindSectionView.java
@@ -17,7 +17,7 @@
package com.android.contacts.views.editor;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource.DataKind;
+import com.android.contacts.model.BaseAccountType.DataKind;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
diff --git a/src/com/android/contacts/views/editor/PhotoEditorView.java b/src/com/android/contacts/views/editor/PhotoEditorView.java
index 15186a5..ba3372c 100644
--- a/src/com/android/contacts/views/editor/PhotoEditorView.java
+++ b/src/com/android/contacts/views/editor/PhotoEditorView.java
@@ -18,7 +18,7 @@
import com.android.contacts.R;
import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.ContactsSource.DataKind;
+import com.android.contacts.model.BaseAccountType.DataKind;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import android.content.Context;
diff --git a/src/com/android/contacts/views/editor/RawContactEditorView.java b/src/com/android/contacts/views/editor/RawContactEditorView.java
index cb25eed..f9fe55d 100644
--- a/src/com/android/contacts/views/editor/RawContactEditorView.java
+++ b/src/com/android/contacts/views/editor/RawContactEditorView.java
@@ -17,11 +17,11 @@
package com.android.contacts.views.editor;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
+import com.android.contacts.model.BaseAccountType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityModifier;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.EditType;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.EditType;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import android.content.Context;
@@ -51,12 +51,12 @@
* Custom view that provides all the editor interaction for a specific
* {@link Contacts} represented through an {@link EntityDelta}. Callers can
* reuse this view and quickly rebuild its contents through
- * {@link #setState(EntityDelta, ContactsSource, ViewIdGenerator)}.
+ * {@link #setState(EntityDelta, BaseAccountType, ViewIdGenerator)}.
* <p>
* Internal updates are performed against {@link ValuesDelta} so that the
* source {@link Entity} can be swapped out. Any state-based changes, such as
* adding {@link Data} rows or changing {@link EditType}, are performed through
- * {@link EntityModifier} to ensure that {@link ContactsSource} are enforced.
+ * {@link EntityModifier} to ensure that {@link BaseAccountType} are enforced.
*/
public class RawContactEditorView extends BaseRawContactEditorView {
private View mPhotoStub;
@@ -125,11 +125,11 @@
/**
* Set the internal state for this view, given a current
- * {@link EntityDelta} state and the {@link ContactsSource} that
+ * {@link EntityDelta} state and the {@link BaseAccountType} that
* apply to that state.
*/
@Override
- public void setState(EntityDelta state, ContactsSource source, ViewIdGenerator vig) {
+ public void setState(EntityDelta state, BaseAccountType source, ViewIdGenerator vig) {
// Remove any existing sections
mFields.removeAllViews();
diff --git a/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java b/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java
index 933b281..bf3d811 100644
--- a/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java
+++ b/src/com/android/contacts/views/editor/ReadOnlyRawContactEditorView.java
@@ -18,8 +18,8 @@
import com.android.contacts.ContactsUtils;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.ContactsSource.DataKind;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.BaseAccountType.DataKind;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.android.contacts.model.EntityModifier;
@@ -91,13 +91,13 @@
/**
* Set the internal state for this view, given a current
- * {@link EntityDelta} state and the {@link ContactsSource} that
+ * {@link EntityDelta} state and the {@link BaseAccountType} that
* apply to that state.
*
* TODO: make this more generic using data from the source
*/
@Override
- public void setState(EntityDelta state, ContactsSource source, ViewIdGenerator vig) {
+ public void setState(EntityDelta state, BaseAccountType source, ViewIdGenerator vig) {
// Remove any existing sections
mGeneral.removeAllViews();
diff --git a/src/com/android/contacts/views/editor/SelectAccountDialogFragment.java b/src/com/android/contacts/views/editor/SelectAccountDialogFragment.java
index 1089602..496571d 100644
--- a/src/com/android/contacts/views/editor/SelectAccountDialogFragment.java
+++ b/src/com/android/contacts/views/editor/SelectAccountDialogFragment.java
@@ -17,8 +17,8 @@
package com.android.contacts.views.editor;
import com.android.contacts.R;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.AccountTypes;
import android.accounts.Account;
import android.app.AlertDialog;
@@ -71,8 +71,9 @@
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
- final Sources sources = Sources.getInstance(getActivity());
- final ArrayList<Account> accounts = Sources.getInstance(getActivity()).getAccounts(true);
+ final AccountTypes sources = AccountTypes.getInstance(getActivity());
+ final ArrayList<Account> accounts =
+ AccountTypes.getInstance(getActivity()).getAccounts(true);
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
final LayoutInflater inflater = LayoutInflater.from(builder.getContext());
@@ -93,8 +94,8 @@
final TextView text2 = (TextView)resultView.findViewById(android.R.id.text2);
final Account account = this.getItem(position);
- final ContactsSource source = sources.getInflatedSource(account.type,
- ContactsSource.LEVEL_SUMMARY);
+ final BaseAccountType source = sources.getInflatedSource(account.type,
+ BaseAccountType.LEVEL_SUMMARY);
text1.setText(account.name);
text2.setText(source.getDisplayLabel(getContext()));
diff --git a/src/com/android/contacts/views/editor/ViewIdGenerator.java b/src/com/android/contacts/views/editor/ViewIdGenerator.java
index 8622ded..6cef706 100644
--- a/src/com/android/contacts/views/editor/ViewIdGenerator.java
+++ b/src/com/android/contacts/views/editor/ViewIdGenerator.java
@@ -17,7 +17,7 @@
package com.android.contacts.views.editor;
import com.android.contacts.model.EntityDelta;
-import com.android.contacts.model.ContactsSource.DataKind;
+import com.android.contacts.model.BaseAccountType.DataKind;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import android.os.Bundle;
diff --git a/tests/src/com/android/contacts/EntityDeltaListTests.java b/tests/src/com/android/contacts/EntityDeltaListTests.java
index efd843f..4904fa8 100644
--- a/tests/src/com/android/contacts/EntityDeltaListTests.java
+++ b/tests/src/com/android/contacts/EntityDeltaListTests.java
@@ -22,7 +22,7 @@
import static android.content.ContentProviderOperation.TYPE_UPDATE;
import com.android.contacts.EntityModifierTests.MockContactsSource;
-import com.android.contacts.model.ContactsSource;
+import com.android.contacts.model.BaseAccountType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityModifier;
import com.android.contacts.model.EntityDeltaList;
@@ -81,12 +81,12 @@
}
/**
- * Build a {@link ContactsSource} that has various odd constraints for
+ * Build a {@link BaseAccountType} that has various odd constraints for
* testing purposes.
*/
- protected ContactsSource getSource() {
- final ContactsSource source = new MockContactsSource();
- source.ensureInflated(getContext(), ContactsSource.LEVEL_CONSTRAINTS);
+ protected BaseAccountType getSource() {
+ final BaseAccountType source = new MockContactsSource();
+ source.ensureInflated(getContext(), BaseAccountType.LEVEL_CONSTRAINTS);
return source;
}
@@ -571,7 +571,7 @@
buildEmail(EMAIL_YELLOW)));
// Ensure we have at least one phone
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final EntityDelta bobContact = first.getByRawContactId(CONTACT_BOB);
EntityModifier.ensureKindExists(bobContact, source, Phone.CONTENT_ITEM_TYPE);
final ValuesDelta bobPhone = bobContact.getSuperPrimaryEntry(Phone.CONTENT_ITEM_TYPE, true);
diff --git a/tests/src/com/android/contacts/EntityModifierTests.java b/tests/src/com/android/contacts/EntityModifierTests.java
index af36815..1a0fc07 100644
--- a/tests/src/com/android/contacts/EntityModifierTests.java
+++ b/tests/src/com/android/contacts/EntityModifierTests.java
@@ -20,13 +20,13 @@
import static android.content.ContentProviderOperation.TYPE_INSERT;
import static android.content.ContentProviderOperation.TYPE_UPDATE;
-import com.android.contacts.model.ContactsSource;
+import com.android.contacts.model.BaseAccountType;
import com.android.contacts.model.EntityDelta;
import com.android.contacts.model.EntityModifier;
import com.android.contacts.model.EntityDeltaList;
-import com.android.contacts.model.Sources;
-import com.android.contacts.model.ContactsSource.DataKind;
-import com.android.contacts.model.ContactsSource.EditType;
+import com.android.contacts.model.AccountTypes;
+import com.android.contacts.model.BaseAccountType.DataKind;
+import com.android.contacts.model.BaseAccountType.EditType;
import com.android.contacts.model.EntityDelta.ValuesDelta;
import com.google.android.collect.Lists;
@@ -51,7 +51,7 @@
import java.util.List;
/**
- * Tests for {@link EntityModifier} to verify that {@link ContactsSource}
+ * Tests for {@link EntityModifier} to verify that {@link BaseAccountType}
* constraints are being enforced correctly.
*/
@LargeTest
@@ -79,11 +79,11 @@
mContext = getContext();
}
- public static class MockContactsSource extends ContactsSource {
+ public static class MockContactsSource extends BaseAccountType {
@Override
protected void inflate(Context context, int inflateLevel) {
this.accountType = TEST_ACCOUNT_TYPE;
- this.setInflatedLevel(ContactsSource.LEVEL_CONSTRAINTS);
+ this.setInflatedLevel(BaseAccountType.LEVEL_CONSTRAINTS);
// Phone allows maximum 2 home, 1 work, and unlimited other, with
// constraint of 5 numbers maximum.
@@ -138,20 +138,20 @@
}
/**
- * Build a {@link ContactsSource} that has various odd constraints for
+ * Build a {@link BaseAccountType} that has various odd constraints for
* testing purposes.
*/
- protected ContactsSource getSource() {
- final ContactsSource source = new MockContactsSource();
- source.ensureInflated(getContext(), ContactsSource.LEVEL_CONSTRAINTS);
+ protected BaseAccountType getSource() {
+ final BaseAccountType source = new MockContactsSource();
+ source.ensureInflated(getContext(), BaseAccountType.LEVEL_CONSTRAINTS);
return source;
}
/**
- * Build {@link Sources} instance.
+ * Build {@link AccountTypes} instance.
*/
- protected Sources getSources(ContactsSource... sources) {
- return new Sources(sources);
+ protected AccountTypes getSources(BaseAccountType... sources) {
+ return new AccountTypes(sources);
}
/**
@@ -192,7 +192,7 @@
*/
public void testValidTypes() {
// Build a source and pull specific types
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
final EditType typeWork = EntityModifier.getType(kindPhone, Phone.TYPE_WORK);
@@ -237,7 +237,7 @@
*/
public void testCanInsert() {
// Build a source and pull specific types
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
final EditType typeWork = EntityModifier.getType(kindPhone, Phone.TYPE_WORK);
@@ -266,7 +266,7 @@
*/
public void testBestValidType() {
// Build a source and pull specific types
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
final EditType typeWork = EntityModifier.getType(kindPhone, Phone.TYPE_WORK);
@@ -302,7 +302,7 @@
}
public void testIsEmptyEmpty() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
// Test entirely empty row
@@ -313,7 +313,7 @@
}
public void testIsEmptyDirectFields() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -330,7 +330,7 @@
}
public void testTrimEmptySingle() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -371,7 +371,7 @@
}
public void testTrimEmptySpaces() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -396,7 +396,7 @@
}
public void testTrimLeaveValid() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -424,7 +424,7 @@
}
public void testTrimEmptyUntouched() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -448,7 +448,7 @@
}
public void testTrimEmptyAfterUpdate() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -500,8 +500,8 @@
}
public void testTrimInsertEmpty() {
- final ContactsSource source = getSource();
- final Sources sources = getSources(source);
+ final BaseAccountType source = getSource();
+ final AccountTypes sources = getSources(source);
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -527,8 +527,8 @@
}
public void testTrimInsertInsert() {
- final ContactsSource source = getSource();
- final Sources sources = getSources(source);
+ final BaseAccountType source = getSource();
+ final AccountTypes sources = getSources(source);
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -560,8 +560,8 @@
}
public void testTrimUpdateRemain() {
- final ContactsSource source = getSource();
- final Sources sources = getSources(source);
+ final BaseAccountType source = getSource();
+ final AccountTypes sources = getSources(source);
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -631,8 +631,8 @@
}
public void testTrimUpdateUpdate() {
- final ContactsSource source = getSource();
- final Sources sources = getSources(source);
+ final BaseAccountType source = getSource();
+ final AccountTypes sources = getSources(source);
final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
@@ -686,7 +686,7 @@
}
public void testParseExtrasExistingName() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindName = source.getKindForMimetype(StructuredName.CONTENT_ITEM_TYPE);
// Build "before" name
@@ -706,7 +706,7 @@
}
public void testParseExtrasIgnoreLimit() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final DataKind kindIm = source.getKindForMimetype(Im.CONTENT_ITEM_TYPE);
// Build "before" IM
@@ -730,7 +730,7 @@
}
public void testParseExtrasIgnoreUnhandled() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final EntityDelta state = getEntity(TEST_ID);
// We should silently ignore types unsupported by source
@@ -742,7 +742,7 @@
}
public void testParseExtrasJobTitle() {
- final ContactsSource source = getSource();
+ final BaseAccountType source = getSource();
final EntityDelta state = getEntity(TEST_ID);
// Make sure that we create partial Organizations
diff --git a/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java b/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
index b2ca81d..377fb1b 100644
--- a/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
+++ b/tests/src/com/android/contacts/interactions/ContactDeletionInteractionTest.java
@@ -17,7 +17,7 @@
package com.android.contacts.interactions;
import com.android.contacts.R;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.AccountTypes;
import com.android.contacts.tests.mocks.ContactsMockContext;
import com.android.contacts.tests.mocks.MockContentProvider;
import com.android.contacts.tests.mocks.MockContentProvider.Query;
@@ -66,7 +66,7 @@
}
@Override
- Sources getSources() {
+ AccountTypes getSources() {
return new MockSources();
}
}
diff --git a/tests/src/com/android/contacts/tests/mocks/MockSources.java b/tests/src/com/android/contacts/tests/mocks/MockSources.java
index 201928f..4c3007a 100644
--- a/tests/src/com/android/contacts/tests/mocks/MockSources.java
+++ b/tests/src/com/android/contacts/tests/mocks/MockSources.java
@@ -15,28 +15,28 @@
*/
package com.android.contacts.tests.mocks;
-import com.android.contacts.model.ContactsSource;
-import com.android.contacts.model.FallbackSource;
-import com.android.contacts.model.Sources;
+import com.android.contacts.model.BaseAccountType;
+import com.android.contacts.model.FallbackAccountType;
+import com.android.contacts.model.AccountTypes;
/**
- * A mock {@link Sources} class.
+ * A mock {@link AccountTypes} class.
*/
-public class MockSources extends Sources {
+public class MockSources extends AccountTypes {
public static final String WRITABLE_ACCOUNT_TYPE = "writable";
public static final String READONLY_ACCOUNT_TYPE = "readonly";
@Override
- public ContactsSource getInflatedSource(String accountType, int inflateLevel) {
+ public BaseAccountType getInflatedSource(String accountType, int inflateLevel) {
if (accountType.equals(WRITABLE_ACCOUNT_TYPE)) {
- ContactsSource source = new FallbackSource();
+ BaseAccountType source = new FallbackAccountType();
source.readOnly = false;
return source;
}
if (accountType.equals(READONLY_ACCOUNT_TYPE)) {
- ContactsSource source = new FallbackSource();
+ BaseAccountType source = new FallbackAccountType();
source.readOnly = true;
return source;
}