Renaming fields and variables from "source" to "accountType"
Change-Id: Ie41036e35a45fc7d9a8c934a3cbe68399c567ad6
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index ee79dbb..7c54f62 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -459,13 +459,13 @@
* Utility for creating a standard tab indicator view.
*
* @param parent The parent ViewGroup to attach the new view to.
- * @param source The {@link AccountType} to build the tab view from.
+ * @param accountType The {@link AccountType} to build the tab view from.
* @return The tab indicator View.
*/
- public static View createTabIndicatorView(ViewGroup parent, AccountType source) {
+ public static View createTabIndicatorView(ViewGroup parent, AccountType accountType) {
Drawable icon = null;
- if (source != null) {
- icon = source.getDisplayIcon(parent.getContext());
+ if (accountType != null) {
+ icon = accountType.getDisplayIcon(parent.getContext());
}
return createTabIndicatorView(parent, null, icon);
}
diff --git a/src/com/android/contacts/SplitAggregateView.java b/src/com/android/contacts/SplitAggregateView.java
index 833d819..3652a64 100644
--- a/src/com/android/contacts/SplitAggregateView.java
+++ b/src/com/android/contacts/SplitAggregateView.java
@@ -73,7 +73,7 @@
private final Uri mAggregateUri;
private OnContactSelectedListener mListener;
- private AccountTypes mSources;
+ private AccountTypes mAccountTypes;
/**
* Listener interface that gets the contact ID of the user-selected contact.
@@ -90,7 +90,7 @@
mAggregateUri = aggregateUri;
- mSources = AccountTypes.getInstance(context);
+ mAccountTypes = AccountTypes.getInstance(context);
final List<RawContactInfo> list = loadData();
@@ -247,10 +247,10 @@
cache.additionalData.setText(info.getAdditionalData());
Drawable icon = null;
- AccountType source = mSources.getInflatedSource(info.accountType,
+ AccountType accountType = mAccountTypes.getInflatedSource(info.accountType,
AccountType.LEVEL_SUMMARY);
- if (source != null) {
- icon = source.getDisplayIcon(getContext());
+ if (accountType != null) {
+ icon = accountType.getDisplayIcon(getContext());
}
if (icon != null) {
cache.sourceIcon.setImageDrawable(icon);
diff --git a/src/com/android/contacts/activities/ContactEditorActivity.java b/src/com/android/contacts/activities/ContactEditorActivity.java
index 8d464c9..ec08b2c 100644
--- a/src/com/android/contacts/activities/ContactEditorActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorActivity.java
@@ -216,13 +216,13 @@
@Override
public void onCustomCreateContactActivityRequested(Account account, Bundle intentExtras) {
- final AccountTypes sources = AccountTypes.getInstance(
- ContactEditorActivity.this);
- final AccountType source = sources.getInflatedSource(
+ final AccountTypes accountTypes = AccountTypes.getInstance(ContactEditorActivity.this);
+ final AccountType accountType = accountTypes.getInflatedSource(
account.type, AccountType.LEVEL_CONSTRAINTS);
Intent intent = new Intent();
- intent.setClassName(source.resPackageName, source.getCreateContactActivityClassName());
+ intent.setClassName(accountType.resPackageName,
+ accountType.getCreateContactActivityClassName());
intent.setAction(Intent.ACTION_INSERT);
intent.setType(Contacts.CONTENT_ITEM_TYPE);
if (intentExtras != null) {
@@ -239,13 +239,14 @@
@Override
public void onCustomEditContactActivityRequested(Account account, Uri rawContactUri,
Bundle intentExtras, boolean redirect) {
- final AccountTypes sources = AccountTypes.getInstance(
+ final AccountTypes accountTypes = AccountTypes.getInstance(
ContactEditorActivity.this);
- final AccountType source = sources.getInflatedSource(
+ final AccountType accountType = accountTypes.getInflatedSource(
account.type, AccountType.LEVEL_CONSTRAINTS);
Intent intent = new Intent();
- intent.setClassName(source.resPackageName, source.getEditContactActivityClassName());
+ intent.setClassName(accountType.resPackageName,
+ accountType.getEditContactActivityClassName());
intent.setAction(Intent.ACTION_EDIT);
intent.setData(rawContactUri);
if (intentExtras != null) {
diff --git a/src/com/android/contacts/detail/ContactDetailFragment.java b/src/com/android/contacts/detail/ContactDetailFragment.java
index 6cf092a..3da165b 100644
--- a/src/com/android/contacts/detail/ContactDetailFragment.java
+++ b/src/com/android/contacts/detail/ContactDetailFragment.java
@@ -362,7 +362,7 @@
mWritableRawContactIds.clear();
- final AccountTypes sources = AccountTypes.getInstance(mContext);
+ final AccountTypes accountTypes = AccountTypes.getInstance(mContext);
// Build up method entries
if (mContactData == null) {
@@ -383,9 +383,9 @@
if (!mRawContactIds.contains(rawContactId)) {
mRawContactIds.add(rawContactId);
}
- AccountType contactsSource = sources.getInflatedSource(accountType,
+ AccountType type = accountTypes.getInflatedSource(accountType,
AccountType.LEVEL_SUMMARY);
- if (contactsSource == null || !contactsSource.readOnly) {
+ if (type == null || !type.readOnly) {
mWritableRawContactIds.add(rawContactId);
}
@@ -405,8 +405,8 @@
continue;
}
- final DataKind kind = sources.getKindOrFallback(accountType, mimeType, mContext,
- AccountType.LEVEL_CONSTRAINTS);
+ final DataKind kind = accountTypes.getKindOrFallback(
+ accountType, mimeType, mContext, AccountType.LEVEL_CONSTRAINTS);
if (kind == null) continue;
final ViewEntry entry = ViewEntry.fromValues(mContext, mimeType, kind, dataId,
@@ -462,7 +462,7 @@
final DataStatus status = mContactData.getStatuses().get(entry.id);
if (status != null) {
final String imMime = Im.CONTENT_ITEM_TYPE;
- final DataKind imKind = sources.getKindOrFallback(accountType,
+ final DataKind imKind = accountTypes.getKindOrFallback(accountType,
imMime, mContext, AccountType.LEVEL_CONSTRAINTS);
final ViewEntry imEntry = ViewEntry.fromValues(mContext,
imMime, imKind, dataId, entryValues);
@@ -1067,7 +1067,8 @@
break;
}
case Directory.EXPORT_SUPPORT_ANY_ACCOUNT: {
- final ArrayList<Account> accounts = AccountTypes.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/editor/AggregationSuggestionView.java b/src/com/android/contacts/editor/AggregationSuggestionView.java
index 19bf299..aa92885 100644
--- a/src/com/android/contacts/editor/AggregationSuggestionView.java
+++ b/src/com/android/contacts/editor/AggregationSuggestionView.java
@@ -115,15 +115,15 @@
return false;
}
- AccountTypes sources = AccountTypes.getInstance(getContext());
+ AccountTypes accountTypes = AccountTypes.getInstance(getContext());
for (RawContact rawContact : mRawContacts) {
String accountType = rawContact.accountType;
if (accountType == null) {
return true;
}
- AccountType source = sources.getInflatedSource(
+ AccountType type = accountTypes.getInflatedSource(
accountType, AccountType.LEVEL_SUMMARY);
- if (!source.readOnly) {
+ if (!type.readOnly) {
return true;
}
}
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index d10fbe5..7086853 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -435,14 +435,14 @@
return;
}
- final AccountTypes sources = AccountTypes.getInstance(mContext);
+ final AccountTypes accountTypes = AccountTypes.getInstance(mContext);
for (EntityDelta state : mState) {
final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final AccountType source = sources.getInflatedSource(accountType,
+ final AccountType type = accountTypes.getInflatedSource(accountType,
AccountType.LEVEL_CONSTRAINTS);
- if (!source.readOnly) {
+ if (!type.readOnly) {
// Apply extras to the first writable raw contact only
- EntityModifier.parseExtras(mContext, source, state, extras);
+ EntityModifier.parseExtras(mContext, type, state, extras);
break;
}
}
@@ -473,20 +473,20 @@
* be created.
*/
private void createContact(Account account) {
- final AccountTypes sources = AccountTypes.getInstance(mContext);
- final AccountType source = sources.getInflatedSource(
+ final AccountTypes accountTypes = AccountTypes.getInstance(mContext);
+ final AccountType type = accountTypes.getInflatedSource(
account != null ? account.type : null, AccountType.LEVEL_CONSTRAINTS);
- if (source.getCreateContactActivityClassName() != null) {
+ if (type.getCreateContactActivityClassName() != null) {
if (mListener != null) {
mListener.onCustomCreateContactActivityRequested(account, mIntentExtras);
}
} else {
- bindEditorsForNewContact(account, source);
+ bindEditorsForNewContact(account, type);
}
}
- private void bindEditorsForNewContact(Account account, final AccountType source) {
+ private void bindEditorsForNewContact(Account account, final AccountType accountType) {
final ContentValues values = new ContentValues();
if (account != null) {
values.put(RawContacts.ACCOUNT_NAME, account.name);
@@ -498,17 +498,17 @@
// Parse any values from incoming intent
EntityDelta insert = new EntityDelta(ValuesDelta.fromAfter(values));
- EntityModifier.parseExtras(mContext, source, insert, mIntentExtras);
+ EntityModifier.parseExtras(mContext, accountType, insert, mIntentExtras);
- // Ensure we have some default fields (if the source does not supper a field,
+ // Ensure we have some default fields (if the account type does not support a field,
// ensureKind will not add it, so it is safe to add e.g. Event)
- EntityModifier.ensureKindExists(insert, source, Phone.CONTENT_ITEM_TYPE);
- EntityModifier.ensureKindExists(insert, source, Email.CONTENT_ITEM_TYPE);
- EntityModifier.ensureKindExists(insert, source, Note.CONTENT_ITEM_TYPE);
- EntityModifier.ensureKindExists(insert, source, Organization.CONTENT_ITEM_TYPE);
- EntityModifier.ensureKindExists(insert, source, Event.CONTENT_ITEM_TYPE);
- EntityModifier.ensureKindExists(insert, source, Website.CONTENT_ITEM_TYPE);
- EntityModifier.ensureKindExists(insert, source, StructuredPostal.CONTENT_ITEM_TYPE);
+ EntityModifier.ensureKindExists(insert, accountType, Phone.CONTENT_ITEM_TYPE);
+ EntityModifier.ensureKindExists(insert, accountType, Email.CONTENT_ITEM_TYPE);
+ EntityModifier.ensureKindExists(insert, accountType, Note.CONTENT_ITEM_TYPE);
+ EntityModifier.ensureKindExists(insert, accountType, Organization.CONTENT_ITEM_TYPE);
+ EntityModifier.ensureKindExists(insert, accountType, Event.CONTENT_ITEM_TYPE);
+ EntityModifier.ensureKindExists(insert, accountType, Website.CONTENT_ITEM_TYPE);
+ EntityModifier.ensureKindExists(insert, accountType, StructuredPostal.CONTENT_ITEM_TYPE);
if (mState == null) {
// Create state if none exists yet
@@ -530,7 +530,7 @@
final LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
- final AccountTypes sources = AccountTypes.getInstance(mContext);
+ final AccountTypes accountTypes = AccountTypes.getInstance(mContext);
int size = mState.size();
for (int i = 0; i < size; i++) {
// TODO ensure proper ordering of entities in the list
@@ -539,12 +539,12 @@
if (!values.isVisible()) continue;
final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
- final AccountType source = sources.getInflatedSource(accountType,
+ final AccountType type = accountTypes.getInflatedSource(accountType,
AccountType.LEVEL_CONSTRAINTS);
final long rawContactId = values.getAsLong(RawContacts._ID);
final BaseRawContactEditorView editor;
- if (source.isExternal()) {
+ if (type.isExternal()) {
editor = (BaseRawContactEditorView) inflater.inflate(
R.layout.external_raw_contact_editor_view, mContent, false);
((ExternalRawContactEditorView) editor).setListener(this);
@@ -556,10 +556,10 @@
mContent.addView(editor);
- editor.setState(entity, source, mViewIdGenerator);
+ editor.setState(entity, type, mViewIdGenerator);
editor.getPhotoEditor().setEditorListener(
- new PhotoEditorListener(editor, source.readOnly));
+ new PhotoEditorListener(editor, type.readOnly));
if (editor instanceof RawContactEditorView) {
final RawContactEditorView rawContactEditor = (RawContactEditorView) editor;
final TextFieldsEditorView nameEditor = rawContactEditor.getNameEditor();
@@ -672,8 +672,8 @@
// If we just started creating a new contact and haven't added any data, it's too
// early to do a join
if (mState.size() == 1 && mState.get(0).isContactInsert()) {
- final AccountTypes sources = AccountTypes.getInstance(mContext);
- EntityModifier.trimEmpty(mState, sources);
+ final AccountTypes accountTypes = AccountTypes.getInstance(mContext);
+ EntityModifier.trimEmpty(mState, accountTypes);
if (mState.buildDiff().isEmpty()) {
Toast.makeText(getActivity(), R.string.toast_join_with_empty_contact,
Toast.LENGTH_LONG).show();
@@ -778,8 +778,8 @@
mStatus = Status.SAVING;
// Trim any empty fields, and RawContacts, before persisting
- final AccountTypes sources = AccountTypes.getInstance(mContext);
- EntityModifier.trimEmpty(mState, sources);
+ final AccountTypes accountTypes = AccountTypes.getInstance(mContext);
+ EntityModifier.trimEmpty(mState, accountTypes);
if (mState.buildDiff().isEmpty()) {
onSaveCompleted(true, saveMode, mLookupUri);
@@ -821,7 +821,7 @@
}
private boolean revert() {
- final AccountTypes sources = AccountTypes.getInstance(mContext);
+ final AccountTypes accountType = AccountTypes.getInstance(mContext);
if (mState.buildDiff().isEmpty()) {
doRevertAction();
} else {
@@ -937,14 +937,14 @@
* Returns true if there is at least one writable raw contact in the current contact.
*/
private boolean isContactWritable() {
- final AccountTypes sources = AccountTypes.getInstance(mContext);
+ final AccountTypes accountTypes = AccountTypes.getInstance(mContext);
int size = mState.size();
for (int i = 0; i < size; i++) {
ValuesDelta values = mState.get(i).getValues();
final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
- final AccountType source = sources.getInflatedSource(accountType,
+ final AccountType type = accountTypes.getInflatedSource(accountType,
AccountType.LEVEL_CONSTRAINTS);
- if (!source.readOnly) {
+ if (!type.readOnly) {
return true;
}
}
@@ -1025,39 +1025,39 @@
return 0;
}
- final AccountTypes sources = AccountTypes.getInstance(mContext);
+ final AccountTypes accountTypes = AccountTypes.getInstance(mContext);
String accountType = one.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final AccountType oneSource = sources.getInflatedSource(accountType,
+ final AccountType accountType1 = accountTypes.getInflatedSource(accountType,
AccountType.LEVEL_SUMMARY);
accountType = two.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final AccountType twoSource = sources.getInflatedSource(accountType,
+ final AccountType accountType2 = accountTypes.getInflatedSource(accountType,
AccountType.LEVEL_SUMMARY);
// Check read-only
- if (oneSource.readOnly && !twoSource.readOnly) {
+ if (accountType1.readOnly && !accountType2.readOnly) {
return 1;
- } else if (twoSource.readOnly && !oneSource.readOnly) {
+ } else if (!accountType1.readOnly && accountType2.readOnly) {
return -1;
}
// Check account type
boolean skipAccountTypeCheck = false;
- boolean oneIsGoogle = oneSource instanceof GoogleAccountType;
- boolean twoIsGoogle = twoSource instanceof GoogleAccountType;
- if (oneIsGoogle && !twoIsGoogle) {
+ boolean isGoogleAccount1 = accountType1 instanceof GoogleAccountType;
+ boolean isGoogleAccount2 = accountType2 instanceof GoogleAccountType;
+ if (isGoogleAccount1 && !isGoogleAccount2) {
return -1;
- } else if (twoIsGoogle && !oneIsGoogle) {
+ } else if (!isGoogleAccount1 && isGoogleAccount2) {
return 1;
- } else if (oneIsGoogle && twoIsGoogle){
+ } else if (isGoogleAccount1 && isGoogleAccount2){
skipAccountTypeCheck = true;
}
int value;
if (!skipAccountTypeCheck) {
- if (oneSource.accountType == null) {
+ if (accountType1.accountType == null) {
return 1;
}
- value = oneSource.accountType.compareTo(twoSource.accountType);
+ value = accountType1.accountType.compareTo(accountType2.accountType);
if (value != 0) {
return value;
}
@@ -1752,11 +1752,11 @@
private final class PhotoEditorListener
implements EditorListener, PhotoActionPopup.Listener {
private final BaseRawContactEditorView mEditor;
- private final boolean mSourceReadOnly;
+ private final boolean mAccountReadOnly;
- private PhotoEditorListener(BaseRawContactEditorView editor, boolean sourceReadOnly) {
+ private PhotoEditorListener(BaseRawContactEditorView editor, boolean accountReadOnly) {
mEditor = editor;
- mSourceReadOnly = sourceReadOnly;
+ mAccountReadOnly = accountReadOnly;
}
@Override
@@ -1766,7 +1766,7 @@
if (request == EditorListener.REQUEST_PICK_PHOTO) {
// Determine mode
final int mode;
- if (mSourceReadOnly) {
+ if (mAccountReadOnly) {
if (mEditor.hasSetPhoto() && hasMoreThanOnePhoto()) {
mode = PhotoActionPopup.MODE_READ_ONLY_ALLOW_PRIMARY;
} else {
diff --git a/src/com/android/contacts/editor/ExternalRawContactEditorView.java b/src/com/android/contacts/editor/ExternalRawContactEditorView.java
index 0775fb0..aaa1e44 100644
--- a/src/com/android/contacts/editor/ExternalRawContactEditorView.java
+++ b/src/com/android/contacts/editor/ExternalRawContactEditorView.java
@@ -111,25 +111,23 @@
* Set the internal state for this view, given a current
* {@link EntityDelta} state and the {@link AccountType} that
* apply to that state.
- *
- * TODO: make this more generic using data from the source
*/
@Override
- public void setState(EntityDelta state, AccountType source, ViewIdGenerator vig) {
+ public void setState(EntityDelta state, AccountType type, ViewIdGenerator vig) {
// Remove any existing sections
mGeneral.removeAllViews();
// Bail if invalid state or source
- if (state == null || source == null) return;
+ if (state == null || type == null) return;
// Make sure we have StructuredName
- EntityModifier.ensureKindExists(state, source, StructuredName.CONTENT_ITEM_TYPE);
+ EntityModifier.ensureKindExists(state, type, StructuredName.CONTENT_ITEM_TYPE);
// Fill in the header info
ValuesDelta values = state.getValues();
mAccountName = values.getAsString(RawContacts.ACCOUNT_NAME);
mAccountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
- CharSequence accountType = source.getDisplayLabel(mContext);
+ CharSequence accountType = type.getDisplayLabel(mContext);
if (TextUtils.isEmpty(accountType)) {
accountType = mContext.getString(R.string.account_phone);
}
@@ -138,20 +136,20 @@
mContext.getString(R.string.from_account_format, mAccountName));
}
mHeaderAccountType.setText(mContext.getString(R.string.account_type_format, accountType));
- mHeaderIcon.setImageDrawable(source.getDisplayIcon(mContext));
+ mHeaderIcon.setImageDrawable(type.getDisplayIcon(mContext));
mRawContactId = values.getAsLong(RawContacts._ID);
ValuesDelta primary;
// Photo
- DataKind kind = source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE);
+ DataKind kind = type.getKindForMimetype(Photo.CONTENT_ITEM_TYPE);
if (kind != null) {
- EntityModifier.ensureKindExists(state, source, Photo.CONTENT_ITEM_TYPE);
- boolean hasPhotoEditor = source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null;
+ EntityModifier.ensureKindExists(state, type, Photo.CONTENT_ITEM_TYPE);
+ boolean hasPhotoEditor = type.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null;
setHasPhotoEditor(hasPhotoEditor);
primary = state.getPrimaryEntry(Photo.CONTENT_ITEM_TYPE);
- getPhotoEditor().setValues(kind, primary, state, source.readOnly, vig);
+ getPhotoEditor().setValues(kind, primary, state, type.readOnly, vig);
if (!hasPhotoEditor || !getPhotoEditor().hasSetPhoto()) {
mPhotoStub.setVisibility(View.GONE);
} else {
@@ -165,7 +163,7 @@
primary = state.getPrimaryEntry(StructuredName.CONTENT_ITEM_TYPE);
mName.setText(primary.getAsString(StructuredName.DISPLAY_NAME));
- if (source.readOnly) {
+ if (type.readOnly) {
mReadOnlyWarning.setText(mContext.getString(R.string.contact_read_only, accountType));
mReadOnlyWarning.setVisibility(View.VISIBLE);
mEditExternallyButton.setVisibility(View.GONE);
diff --git a/src/com/android/contacts/editor/RawContactEditorView.java b/src/com/android/contacts/editor/RawContactEditorView.java
index 7d10690..b7ca774 100644
--- a/src/com/android/contacts/editor/RawContactEditorView.java
+++ b/src/com/android/contacts/editor/RawContactEditorView.java
@@ -147,24 +147,24 @@
* apply to that state.
*/
@Override
- public void setState(EntityDelta state, AccountType source, ViewIdGenerator vig) {
+ public void setState(EntityDelta state, AccountType type, ViewIdGenerator vig) {
mState = state;
// Remove any existing sections
mFields.removeAllViews();
- // Bail if invalid state or source
- if (state == null || source == null) return;
+ // Bail if invalid state or account type
+ if (state == null || type == null) return;
setId(vig.getId(state, null, null, ViewIdGenerator.NO_VIEW_INDEX));
// Make sure we have StructuredName
- EntityModifier.ensureKindExists(state, source, StructuredName.CONTENT_ITEM_TYPE);
+ EntityModifier.ensureKindExists(state, type, StructuredName.CONTENT_ITEM_TYPE);
// Fill in the header info
ValuesDelta values = state.getValues();
String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
- CharSequence accountType = source.getDisplayLabel(mContext);
+ CharSequence accountType = type.getDisplayLabel(mContext);
if (TextUtils.isEmpty(accountType)) {
accountType = mContext.getString(R.string.account_phone);
}
@@ -173,13 +173,13 @@
mContext.getString(R.string.from_account_format, accountName));
}
mHeaderAccountType.setText(mContext.getString(R.string.account_type_format, accountType));
- mHeaderIcon.setImageDrawable(source.getDisplayIcon(mContext));
+ mHeaderIcon.setImageDrawable(type.getDisplayIcon(mContext));
mRawContactId = values.getAsLong(RawContacts._ID);
// Show photo editor when supported
- EntityModifier.ensureKindExists(state, source, Photo.CONTENT_ITEM_TYPE);
- setHasPhotoEditor((source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null));
+ EntityModifier.ensureKindExists(state, type, Photo.CONTENT_ITEM_TYPE);
+ setHasPhotoEditor((type.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null));
getPhotoEditor().setEnabled(isEnabled());
mName.setEnabled(isEnabled());
@@ -187,7 +187,7 @@
mFields.setVisibility(View.VISIBLE);
mName.setVisibility(View.VISIBLE);
- mGroupMembershipKind = source.getKindForMimetype(GroupMembership.CONTENT_ITEM_TYPE);
+ mGroupMembershipKind = type.getKindForMimetype(GroupMembership.CONTENT_ITEM_TYPE);
if (mGroupMembershipKind != null) {
mGroupMembershipView = (GroupMembershipView)mInflater.inflate(
R.layout.item_group_membership, mFields, false);
@@ -196,7 +196,7 @@
}
// Create editor sections for each possible data kind
- for (DataKind kind : source.getSortedDataKinds()) {
+ for (DataKind kind : type.getSortedDataKinds()) {
// Skip kind of not editable
if (!kind.editable) continue;
diff --git a/src/com/android/contacts/interactions/ContactDeletionInteraction.java b/src/com/android/contacts/interactions/ContactDeletionInteraction.java
index b90482d..1769cd6 100644
--- a/src/com/android/contacts/interactions/ContactDeletionInteraction.java
+++ b/src/com/android/contacts/interactions/ContactDeletionInteraction.java
@@ -146,16 +146,16 @@
HashSet<Long> readOnlyRawContacts = Sets.newHashSet();
HashSet<Long> writableRawContacts = Sets.newHashSet();
- AccountTypes sources = getSources();
+ AccountTypes accountTypes = getAccountTypes();
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
final long rawContactId = cursor.getLong(COLUMN_INDEX_RAW_CONTACT_ID);
final String accountType = cursor.getString(COLUMN_INDEX_ACCOUNT_TYPE);
contactId = cursor.getLong(COLUMN_INDEX_CONTACT_ID);
lookupKey = cursor.getString(COLUMN_INDEX_LOOKUP_KEY);
- AccountType contactsSource = sources.getInflatedSource(accountType,
+ AccountType type = accountTypes.getInflatedSource(accountType,
AccountType.LEVEL_SUMMARY);
- boolean readonly = contactsSource != null && contactsSource.readOnly;
+ boolean readonly = type != null && type.readOnly;
if (readonly) {
readOnlyRawContacts.add(rawContactId);
} else {
@@ -182,7 +182,7 @@
public void onLoaderReset(Loader<Cursor> loader) {
}
-
+
/* Visible for testing */
void showDialog(int messageId, final Uri contactUri) {
mDialog = new AlertDialog.Builder(getActivity())
@@ -230,7 +230,7 @@
}
/* Visible for testing */
- AccountTypes getSources() {
+ AccountTypes getAccountTypes() {
return AccountTypes.getInstance(getActivity());
}
}
diff --git a/src/com/android/contacts/interactions/ImportExportInteraction.java b/src/com/android/contacts/interactions/ImportExportInteraction.java
index 1055672..418882e 100644
--- a/src/com/android/contacts/interactions/ImportExportInteraction.java
+++ b/src/com/android/contacts/interactions/ImportExportInteraction.java
@@ -199,8 +199,8 @@
// - 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 AccountTypes sources = AccountTypes.getInstance(mContext);
- final List<Account> accountList = sources.getAccounts(true);
+ final AccountTypes accountTypes = AccountTypes.getInstance(mContext);
+ final List<Account> accountList = accountTypes.getAccounts(true);
final int size = accountList.size();
if (size > 1) {
showDialog(resId, null);
diff --git a/src/com/android/contacts/interactions/PhoneNumberInteraction.java b/src/com/android/contacts/interactions/PhoneNumberInteraction.java
index 5834189..4dcd7bf 100644
--- a/src/com/android/contacts/interactions/PhoneNumberInteraction.java
+++ b/src/com/android/contacts/interactions/PhoneNumberInteraction.java
@@ -128,11 +128,11 @@
* A list adapter that populates the list of contact's phone numbers.
*/
private class PhoneItemAdapter extends ArrayAdapter<PhoneItem> {
- private final AccountTypes mSources;
+ private final AccountTypes mAccountTypes;
public PhoneItemAdapter(Context context) {
super(context, R.layout.phone_disambig_item, android.R.id.text2);
- mSources = AccountTypes.getInstance(context);
+ mAccountTypes = AccountTypes.getInstance(context);
}
@Override
@@ -140,13 +140,13 @@
View view = super.getView(position, convertView, parent);
PhoneItem item = getItem(position);
- AccountType source = mSources.getInflatedSource(item.accountType,
+ AccountType accountType = mAccountTypes.getInflatedSource(item.accountType,
AccountType.LEVEL_SUMMARY);
// Obtain a string representation of the phone type specific to the
- // ContactSource associated with that phone number
+ // account type associated with that phone number
TextView typeView = (TextView)view.findViewById(android.R.id.text1);
- DataKind kind = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
+ DataKind kind = accountType.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
if (kind != null) {
ContentValues values = new ContentValues();
values.put(Phone.TYPE, item.type);
diff --git a/src/com/android/contacts/list/ContactListFilterLoader.java b/src/com/android/contacts/list/ContactListFilterLoader.java
index ebc23d6..0f79902 100644
--- a/src/com/android/contacts/list/ContactListFilterLoader.java
+++ b/src/com/android/contacts/list/ContactListFilterLoader.java
@@ -76,12 +76,12 @@
ArrayList<ContactListFilter> results = new ArrayList<ContactListFilter>();
Context context = getContext();
- final AccountTypes sources = AccountTypes.getInstance(context);
- ArrayList<Account> accounts = sources.getAccounts(false);
+ final AccountTypes accountTypes = AccountTypes.getInstance(context);
+ ArrayList<Account> accounts = accountTypes.getAccounts(false);
for (Account account : accounts) {
- AccountType source = sources.getInflatedSource(
+ AccountType accountType = accountTypes.getInflatedSource(
account.type, AccountType.LEVEL_SUMMARY);
- Drawable icon = source != null ? source.getDisplayIcon(getContext()) : null;
+ Drawable icon = accountType != null ? accountType.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 35297fe..79e5b40 100644
--- a/src/com/android/contacts/list/CustomContactListFilterActivity.java
+++ b/src/com/android/contacts/list/CustomContactListFilterActivity.java
@@ -166,12 +166,12 @@
protected AccountSet doInBackground(CustomContactListFilterActivity target,
Void... params) {
final Context context = target;
- final AccountTypes sources = AccountTypes.getInstance(context);
+ final AccountTypes accountTypes = AccountTypes.getInstance(context);
final ContentResolver resolver = context.getContentResolver();
// Inflate groups entry for each account
final AccountSet accounts = new AccountSet();
- for (Account account : sources.getAccounts(false)) {
+ for (Account account : accountTypes.getAccounts(false)) {
accounts.add(new AccountDisplay(resolver, account.name, account.type));
}
@@ -497,13 +497,13 @@
/**
* {@link ExpandableListAdapter} that shows {@link GroupDelta} settings,
- * grouped by {@link Account} source. Shows footer row when any groups are
+ * grouped by {@link Account} type. Shows footer row when any groups are
* unsynced, as determined through {@link AccountDisplay#mUnsyncedGroups}.
*/
protected static class DisplayAdapter extends BaseExpandableListAdapter {
private Context mContext;
private LayoutInflater mInflater;
- private AccountTypes mSources;
+ private AccountTypes mAccountTypes;
private AccountSet mAccounts;
private boolean mChildWithPhones = false;
@@ -511,7 +511,7 @@
public DisplayAdapter(Context context) {
mContext = context;
mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mSources = AccountTypes.getInstance(context);
+ mAccountTypes = AccountTypes.getInstance(context);
}
public void setAccounts(AccountSet accounts) {
@@ -528,6 +528,7 @@
}
/** {@inheritDoc} */
+ @Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
if (convertView == null) {
@@ -559,7 +560,7 @@
return convertView;
}
- /** {@inheritDoc} */
+ @Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
ViewGroup parent) {
if (convertView == null) {
@@ -571,17 +572,17 @@
final AccountDisplay account = (AccountDisplay)this.getGroup(groupPosition);
- final AccountType source = mSources.getInflatedSource(account.mType,
+ final AccountType accountType = mAccountTypes.getInflatedSource(account.mType,
AccountType.LEVEL_SUMMARY);
text1.setText(account.mName);
- text2.setText(source.getDisplayLabel(mContext));
+ text2.setText(accountType.getDisplayLabel(mContext));
text2.setVisibility(account.mName == null ? View.GONE : View.VISIBLE);
return convertView;
}
- /** {@inheritDoc} */
+ @Override
public Object getChild(int groupPosition, int childPosition) {
final AccountDisplay account = mAccounts.get(groupPosition);
final boolean validChild = childPosition >= 0
@@ -593,7 +594,7 @@
}
}
- /** {@inheritDoc} */
+ @Override
public long getChildId(int groupPosition, int childPosition) {
final GroupDelta child = (GroupDelta)getChild(groupPosition, childPosition);
if (child != null) {
@@ -604,7 +605,7 @@
}
}
- /** {@inheritDoc} */
+ @Override
public int getChildrenCount(int groupPosition) {
// Count is any synced groups, plus possible footer
final AccountDisplay account = mAccounts.get(groupPosition);
@@ -612,12 +613,12 @@
return account.mSyncedGroups.size() + (anyHidden ? 1 : 0);
}
- /** {@inheritDoc} */
+ @Override
public Object getGroup(int groupPosition) {
return mAccounts.get(groupPosition);
}
- /** {@inheritDoc} */
+ @Override
public int getGroupCount() {
if (mAccounts == null) {
return 0;
@@ -625,17 +626,17 @@
return mAccounts.size();
}
- /** {@inheritDoc} */
+ @Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
- /** {@inheritDoc} */
+ @Override
public boolean hasStableIds() {
return true;
}
- /** {@inheritDoc} */
+ @Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
diff --git a/src/com/android/contacts/model/AccountTypes.java b/src/com/android/contacts/model/AccountTypes.java
index 2ea4a86..8256471 100644
--- a/src/com/android/contacts/model/AccountTypes.java
+++ b/src/com/android/contacts/model/AccountTypes.java
@@ -63,11 +63,11 @@
private Context mApplicationContext;
private AccountManager mAccountManager;
- private AccountType mFallbackSource = null;
+ private AccountType mFallbackAccountType = null;
private ArrayList<Account> mAccounts = Lists.newArrayList();
private ArrayList<Account> mWritableAccounts = Lists.newArrayList();
- private HashMap<String, AccountType> mSources = Maps.newHashMap();
+ private HashMap<String, AccountType> mAccountTypes = Maps.newHashMap();
private HashSet<String> mKnownPackages = Sets.newHashSet();
private static final int MESSAGE_LOAD_DATA = 0;
@@ -115,8 +115,8 @@
mApplicationContext = context.getApplicationContext();
mAccountManager = AccountManager.get(mApplicationContext);
- // Create fallback contacts source for on-phone contacts
- mFallbackSource = new FallbackAccountType();
+ // Create fallback contacts account type for on-phone contacts
+ mFallbackAccountType = new FallbackAccountType();
mListenerThread = new HandlerThread("AccountChangeListener");
mListenerThread.start();
@@ -161,15 +161,15 @@
}
/** @hide exposed for unit tests */
- public AccountTypes(AccountType... sources) {
- for (AccountType source : sources) {
- addSource(source);
+ public AccountTypes(AccountType... accountTypes) {
+ for (AccountType accountType : accountTypes) {
+ addAccountType(accountType);
}
}
- protected void addSource(AccountType source) {
- mSources.put(source.accountType, source);
- mKnownPackages.add(source.resPackageName);
+ protected void addAccountType(AccountType accountType) {
+ mAccountTypes.put(accountType.accountType, accountType);
+ mKnownPackages.add(accountType.resPackageName);
}
@Override
@@ -204,10 +204,10 @@
for (String packageName : pkgList) {
final boolean knownPackage = mKnownPackages.contains(packageName);
if (knownPackage) {
- // Invalidate cache of existing source
+ // Invalidate cache of existing account type
invalidateCache(packageName);
} else {
- // Unknown source, so reload from scratch
+ // Unknown account type, so reload from scratch
loadAccountsInBackground();
}
}
@@ -218,18 +218,18 @@
}
protected void invalidateCache(String packageName) {
- for (AccountType source : mSources.values()) {
- if (TextUtils.equals(packageName, source.resPackageName)) {
+ for (AccountType accountType : mAccountTypes.values()) {
+ if (TextUtils.equals(packageName, accountType.resPackageName)) {
// Invalidate any cache for the changed package
- source.invalidateCache();
+ accountType.invalidateCache();
}
}
}
protected void invalidateAllCache() {
- mFallbackSource.invalidateCache();
- for (AccountType source : mSources.values()) {
- source.invalidateCache();
+ mFallbackAccountType.invalidateCache();
+ for (AccountType accountType : mAccountTypes.values()) {
+ accountType.invalidateCache();
}
}
@@ -263,7 +263,7 @@
* background thread.
*/
protected void loadAccountsInBackground() {
- mSources.clear();
+ mAccountTypes.clear();
mKnownPackages.clear();
mAccounts.clear();
mWritableAccounts.clear();
@@ -283,31 +283,31 @@
// Look for the formatting details provided by each sync
// adapter, using the authenticator to find general resources.
- final String accountType = sync.accountType;
- final AuthenticatorDescription auth = findAuthenticator(auths, accountType);
+ final String type = sync.accountType;
+ final AuthenticatorDescription auth = findAuthenticator(auths, type);
if (auth == null) {
- Log.w(TAG, "No authenticator found for type=" + accountType + ", ignoring it.");
+ Log.w(TAG, "No authenticator found for type=" + type + ", ignoring it.");
continue;
}
- AccountType source;
- if (GoogleAccountType.ACCOUNT_TYPE.equals(accountType)) {
- source = new GoogleAccountType(auth.packageName);
- } else if (ExchangeAccountType.ACCOUNT_TYPE.equals(accountType)) {
- source = new ExchangeAccountType(auth.packageName);
+ AccountType accountType;
+ if (GoogleAccountType.ACCOUNT_TYPE.equals(type)) {
+ accountType = new GoogleAccountType(auth.packageName);
+ } else if (ExchangeAccountType.ACCOUNT_TYPE.equals(type)) {
+ accountType = new ExchangeAccountType(auth.packageName);
} else {
// TODO: use syncadapter package instead, since it provides resources
- Log.d(TAG, "Creating external source for type=" + accountType
+ Log.d(TAG, "Creating external source for type=" + type
+ ", packageName=" + auth.packageName);
- source = new ExternalAccountType(auth.packageName);
- source.readOnly = !sync.supportsUploading();
+ accountType = new ExternalAccountType(auth.packageName);
+ accountType.readOnly = !sync.supportsUploading();
}
- source.accountType = auth.type;
- source.titleRes = auth.labelId;
- source.iconRes = auth.iconId;
+ accountType.accountType = auth.type;
+ accountType.titleRes = auth.labelId;
+ accountType.iconRes = auth.iconId;
- addSource(source);
+ addAccountType(accountType);
}
} catch (RemoteException e) {
Log.w(TAG, "Problem loading accounts: " + e.toString());
@@ -376,7 +376,7 @@
/**
* Find the best {@link DataKind} matching the requested
* {@link AccountType#accountType} and {@link DataKind#mimeType}. If no
- * direct match found, we try searching {@link #mFallbackSource}.
+ * direct match found, we try searching {@link #mFallbackAccountType}.
* When fourceRefresh is set to true, cache is refreshed and inflation of each
* EditField will occur.
*/
@@ -385,17 +385,17 @@
ensureAccountsLoaded();
DataKind kind = null;
- // Try finding source and kind matching request
- final AccountType source = mSources.get(accountType);
- if (source != null) {
- source.ensureInflated(context, inflateLevel);
- kind = source.getKindForMimetype(mimeType);
+ // Try finding account type and kind matching request
+ final AccountType type = mAccountTypes.get(accountType);
+ if (type != null) {
+ type.ensureInflated(context, inflateLevel);
+ kind = type.getKindForMimetype(mimeType);
}
if (kind == null) {
// Nothing found, so try fallback as last resort
- mFallbackSource.ensureInflated(context, inflateLevel);
- kind = mFallbackSource.getKindForMimetype(mimeType);
+ mFallbackAccountType.ensureInflated(context, inflateLevel);
+ kind = mFallbackAccountType.getKindForMimetype(mimeType);
}
if (kind == null) {
@@ -415,16 +415,16 @@
AccountType getAccountType(String accountType, int inflateLevel) {
// Try finding specific source, otherwise use fallback
- AccountType source = mSources.get(accountType);
- if (source == null) source = mFallbackSource;
+ AccountType type = mAccountTypes.get(accountType);
+ if (type == null) type = mFallbackAccountType;
- if (source.isInflated(inflateLevel)) {
+ if (type.isInflated(inflateLevel)) {
// Already inflated, so return directly
- return source;
+ return type;
} else {
// Not inflated, but requested that we force-inflate
- source.ensureInflated(mContext, inflateLevel);
- return source;
+ type.ensureInflated(mContext, inflateLevel);
+ return type;
}
}
}
diff --git a/src/com/android/contacts/model/EntityModifier.java b/src/com/android/contacts/model/EntityModifier.java
index 63ae586..9e09c6a 100644
--- a/src/com/android/contacts/model/EntityModifier.java
+++ b/src/com/android/contacts/model/EntityModifier.java
@@ -82,8 +82,9 @@
* 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, AccountType source, String mimeType) {
- final DataKind kind = source.getKindForMimetype(mimeType);
+ public static void ensureKindExists(
+ EntityDelta state, AccountType accountType, String mimeType) {
+ final DataKind kind = accountType.getKindForMimetype(mimeType);
final boolean hasChild = state.getMimeEntriesCount(mimeType, true) > 0;
if (!hasChild && kind != null) {
@@ -353,10 +354,10 @@
* dictates the structure for various fields. This method ignores rows not
* described by the {@link AccountType}.
*/
- public static void trimEmpty(EntityDeltaList set, AccountTypes sources) {
+ public static void trimEmpty(EntityDeltaList set, AccountTypes accountTypes) {
for (EntityDelta state : set) {
final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
- final AccountType source = sources.getInflatedSource(accountType,
+ final AccountType source = accountTypes.getInflatedSource(accountType,
AccountType.LEVEL_CONSTRAINTS);
trimEmpty(state, source);
}
@@ -368,11 +369,11 @@
* the structure for various fields. This method ignores rows not described
* by the {@link AccountType}.
*/
- public static void trimEmpty(EntityDelta state, AccountType source) {
+ public static void trimEmpty(EntityDelta state, AccountType accountType) {
boolean hasValues = false;
// Walk through entries for each well-known kind
- for (DataKind kind : source.getSortedDataKinds()) {
+ for (DataKind kind : accountType.getSortedDataKinds()) {
final String mimeType = kind.mimeType;
final ArrayList<ValuesDelta> entries = state.getMimeEntries(mimeType);
if (entries == null) continue;
@@ -386,10 +387,10 @@
}
// Test and remove this row if empty and it isn't a photo from google
- final boolean isGoogleSource = TextUtils.equals(GoogleAccountType.ACCOUNT_TYPE,
+ final boolean isGoogleAccount = 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;
+ final boolean isGooglePhoto = isPhoto && isGoogleAccount;
if (EntityModifier.isEmpty(entry, kind) && !isGooglePhoto) {
// TODO: remove this verbose logging
@@ -448,7 +449,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, AccountType source, EntityDelta state,
+ public static void parseExtras(Context context, AccountType accountType, EntityDelta state,
Bundle extras) {
if (extras == null || extras.size() == 0) {
// Bail early if no useful data
@@ -457,7 +458,7 @@
{
// StructuredName
- EntityModifier.ensureKindExists(state, source, StructuredName.CONTENT_ITEM_TYPE);
+ EntityModifier.ensureKindExists(state, accountType, StructuredName.CONTENT_ITEM_TYPE);
final ValuesDelta child = state.getPrimaryEntry(StructuredName.CONTENT_ITEM_TYPE);
final String name = extras.getString(Insert.NAME);
@@ -473,14 +474,14 @@
{
// StructuredPostal
- final DataKind kind = source.getKindForMimetype(StructuredPostal.CONTENT_ITEM_TYPE);
+ final DataKind kind = accountType.getKindForMimetype(StructuredPostal.CONTENT_ITEM_TYPE);
parseExtras(state, kind, extras, Insert.POSTAL_TYPE, Insert.POSTAL,
StructuredPostal.FORMATTED_ADDRESS);
}
{
// Phone
- final DataKind kind = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
+ final DataKind kind = accountType.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
parseExtras(state, kind, extras, Insert.PHONE_TYPE, Insert.PHONE, Phone.NUMBER);
parseExtras(state, kind, extras, Insert.SECONDARY_PHONE_TYPE, Insert.SECONDARY_PHONE,
Phone.NUMBER);
@@ -490,7 +491,7 @@
{
// Email
- final DataKind kind = source.getKindForMimetype(Email.CONTENT_ITEM_TYPE);
+ final DataKind kind = accountType.getKindForMimetype(Email.CONTENT_ITEM_TYPE);
parseExtras(state, kind, extras, Insert.EMAIL_TYPE, Insert.EMAIL, Email.DATA);
parseExtras(state, kind, extras, Insert.SECONDARY_EMAIL_TYPE, Insert.SECONDARY_EMAIL,
Email.DATA);
@@ -500,7 +501,7 @@
{
// Im
- final DataKind kind = source.getKindForMimetype(Im.CONTENT_ITEM_TYPE);
+ final DataKind kind = accountType.getKindForMimetype(Im.CONTENT_ITEM_TYPE);
fixupLegacyImType(extras);
parseExtras(state, kind, extras, Insert.IM_PROTOCOL, Insert.IM_HANDLE, Im.DATA);
}
@@ -508,7 +509,7 @@
// Organization
final boolean hasOrg = extras.containsKey(Insert.COMPANY)
|| extras.containsKey(Insert.JOB_TITLE);
- final DataKind kindOrg = source.getKindForMimetype(Organization.CONTENT_ITEM_TYPE);
+ final DataKind kindOrg = accountType.getKindForMimetype(Organization.CONTENT_ITEM_TYPE);
if (hasOrg && EntityModifier.canInsert(state, kindOrg)) {
final ValuesDelta child = EntityModifier.insertChild(state, kindOrg);
@@ -525,7 +526,7 @@
// Notes
final boolean hasNotes = extras.containsKey(Insert.NOTES);
- final DataKind kindNotes = source.getKindForMimetype(Note.CONTENT_ITEM_TYPE);
+ final DataKind kindNotes = accountType.getKindForMimetype(Note.CONTENT_ITEM_TYPE);
if (hasNotes && EntityModifier.canInsert(state, kindNotes)) {
final ValuesDelta child = EntityModifier.insertChild(state, kindNotes);
@@ -538,12 +539,12 @@
// Arbitrary additional data
ArrayList<ContentValues> values = extras.getParcelableArrayList(Insert.DATA);
if (values != null) {
- parseValues(state, source, values);
+ parseValues(state, accountType, values);
}
}
private static void parseValues(
- EntityDelta state, AccountType source, ArrayList<ContentValues> dataValueList) {
+ EntityDelta state, AccountType accountType, ArrayList<ContentValues> dataValueList) {
for (ContentValues values : dataValueList) {
String mimeType = values.getAsString(Data.MIMETYPE);
if (TextUtils.isEmpty(mimeType)) {
@@ -556,9 +557,9 @@
continue;
}
- DataKind kind = source.getKindForMimetype(mimeType);
+ DataKind kind = accountType.getKindForMimetype(mimeType);
if (kind == null) {
- Log.e(TAG, "Mimetype not supported for account type " + source.accountType
+ Log.e(TAG, "Mimetype not supported for account type " + accountType.accountType
+ ". Ignoring: " + values);
continue;
}
@@ -752,7 +753,7 @@
String typeExtra, String valueExtra, String valueColumn) {
final CharSequence value = extras.getCharSequence(valueExtra);
- // Bail early if source doesn't handle this type
+ // Bail early if account type doesn't handle this MIME type
if (kind == null) return;
// Bail when can't insert type, or value missing
diff --git a/src/com/android/contacts/quickcontact/QuickContactWindow.java b/src/com/android/contacts/quickcontact/QuickContactWindow.java
index 7265edd..beae4e3 100644
--- a/src/com/android/contacts/quickcontact/QuickContactWindow.java
+++ b/src/com/android/contacts/quickcontact/QuickContactWindow.java
@@ -653,7 +653,7 @@
mDefaultsMap.clear();
final DataStatus status = new DataStatus();
- final AccountTypes sources = AccountTypes.getInstance(mContext);
+ final AccountTypes accountTypes = AccountTypes.getInstance(mContext);
final ImageView photoView = (ImageView)mHeader.findViewById(R.id.photo);
Bitmap photoBitmap = null;
@@ -680,7 +680,7 @@
continue;
}
- final DataKind kind = sources.getKindOrFallback(accountType, mimeType, mContext,
+ final DataKind kind = accountTypes.getKindOrFallback(accountType, mimeType, mContext,
AccountType.LEVEL_MIMETYPES);
if (kind != null) {
@@ -707,7 +707,7 @@
// Handle Email rows with presence data as Im entry
final boolean hasPresence = !cursor.isNull(DataQuery.PRESENCE);
if (hasPresence && Email.CONTENT_ITEM_TYPE.equals(mimeType)) {
- final DataKind imKind = sources.getKindOrFallback(accountType,
+ final DataKind imKind = accountTypes.getKindOrFallback(accountType,
Im.CONTENT_ITEM_TYPE, mContext, AccountType.LEVEL_MIMETYPES);
if (imKind != null) {
final DataAction action = new DataAction(mContext, Im.CONTENT_ITEM_TYPE, imKind,
diff --git a/src/com/android/contacts/util/AccountSelectionUtil.java b/src/com/android/contacts/util/AccountSelectionUtil.java
index 0035d6d..db908a9 100644
--- a/src/com/android/contacts/util/AccountSelectionUtil.java
+++ b/src/com/android/contacts/util/AccountSelectionUtil.java
@@ -87,8 +87,8 @@
public static Dialog getSelectAccountDialog(Context context, int resId,
DialogInterface.OnClickListener onClickListener,
DialogInterface.OnCancelListener onCancelListener) {
- final AccountTypes sources = AccountTypes.getInstance(context);
- final List<Account> writableAccountList = sources.getAccounts(true);
+ final AccountTypes accountTypes = AccountTypes.getInstance(context);
+ final List<Account> writableAccountList = accountTypes.getAccounts(true);
Log.i(LOG_TAG, "The number of available accounts: " + writableAccountList.size());
@@ -118,13 +118,13 @@
(TextView)convertView.findViewById(android.R.id.text2);
final Account account = this.getItem(position);
- final AccountType source =
- sources.getInflatedSource(account.type,
+ final AccountType accountType =
+ accountTypes.getInflatedSource(account.type,
AccountType.LEVEL_SUMMARY);
final Context context = getContext();
text1.setText(account.name);
- text2.setText(source.getDisplayLabel(context));
+ text2.setText(accountType.getDisplayLabel(context));
return convertView;
}
diff --git a/src/com/android/contacts/util/AccountsListAdapter.java b/src/com/android/contacts/util/AccountsListAdapter.java
index 260a1c3..47ea4e4 100644
--- a/src/com/android/contacts/util/AccountsListAdapter.java
+++ b/src/com/android/contacts/util/AccountsListAdapter.java
@@ -37,13 +37,13 @@
public final class AccountsListAdapter extends BaseAdapter {
private final LayoutInflater mInflater;
private final List<Account> mAccounts;
- private final AccountTypes mSources;
+ private final AccountTypes mAccountTypes;
private final Context mContext;
public AccountsListAdapter(Context context, boolean writableOnly) {
mContext = context;
- mSources = AccountTypes.getInstance(context);
- mAccounts = mSources.getAccounts(writableOnly);
+ mAccountTypes = AccountTypes.getInstance(context);
+ mAccounts = mAccountTypes.getAccounts(writableOnly);
mInflater = LayoutInflater.from(context);
}
@@ -57,12 +57,12 @@
final ImageView icon = (ImageView)resultView.findViewById(android.R.id.icon);
final Account account = mAccounts.get(position);
- final AccountType source = mSources.getInflatedSource(account.type,
+ final AccountType accountType = mAccountTypes.getInflatedSource(account.type,
AccountType.LEVEL_SUMMARY);
text1.setText(account.name);
- text2.setText(source.getDisplayLabel(mContext));
- icon.setImageDrawable(source.getDisplayIcon(mContext));
+ text2.setText(accountType.getDisplayLabel(mContext));
+ icon.setImageDrawable(accountType.getDisplayIcon(mContext));
return resultView;
}
diff --git a/src/com/android/contacts/vcard/ImportVCardActivity.java b/src/com/android/contacts/vcard/ImportVCardActivity.java
index b375804..67e3797 100644
--- a/src/com/android/contacts/vcard/ImportVCardActivity.java
+++ b/src/com/android/contacts/vcard/ImportVCardActivity.java
@@ -769,8 +769,8 @@
if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(accountType)) {
mAccount = new Account(accountName, accountType);
} else {
- final AccountTypes sources = AccountTypes.getInstance(this);
- final List<Account> accountList = sources.getAccounts(true);
+ final AccountTypes accountTypes = AccountTypes.getInstance(this);
+ final List<Account> accountList = accountTypes.getAccounts(true);
if (accountList.size() == 0) {
mAccount = null;
} else if (accountList.size() == 1) {
diff --git a/src/com/android/contacts/vcard/SelectAccountActivity.java b/src/com/android/contacts/vcard/SelectAccountActivity.java
index e9127e9..91e6902 100644
--- a/src/com/android/contacts/vcard/SelectAccountActivity.java
+++ b/src/com/android/contacts/vcard/SelectAccountActivity.java
@@ -56,8 +56,8 @@
// - 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 AccountTypes sources = AccountTypes.getInstance(this);
- final List<Account> accountList = sources.getAccounts(true);
+ final AccountTypes accountTypes = AccountTypes.getInstance(this);
+ final List<Account> accountList = accountTypes.getAccounts(true);
if (accountList.size() == 0) {
Log.w(LOG_TAG, "Account does not exist");
finish();