summaryrefslogtreecommitdiffstats
path: root/src/com/android/contacts/editor/ContactEditorFragment.java
diff options
context:
space:
mode:
authorJay Shrauner <shrauner@google.com>2015-01-09 11:41:14 -0800
committerJay Shrauner <shrauner@google.com>2015-01-09 13:38:17 -0800
commit67e83223e954ed54898daa5e32400dbff6d3831a (patch)
tree440f6f6c6cb09b9a18c509a8bf713572b24ec6a7 /src/com/android/contacts/editor/ContactEditorFragment.java
parent3a9e3b15ba184232412b2df6456589a42cab9745 (diff)
downloadpackages_apps_Contacts-67e83223e954ed54898daa5e32400dbff6d3831a.tar.gz
packages_apps_Contacts-67e83223e954ed54898daa5e32400dbff6d3831a.tar.bz2
packages_apps_Contacts-67e83223e954ed54898daa5e32400dbff6d3831a.zip
Local account handling cleanup
Clean up null account handling and update local account detection to allow for a non-null account to represent a local account. Bug: 18959158 Change-Id: I0d5f7acb7d9a8d1ba7b6d3a4e0b6584e3646934a
Diffstat (limited to 'src/com/android/contacts/editor/ContactEditorFragment.java')
-rw-r--r--src/com/android/contacts/editor/ContactEditorFragment.java22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 664b8c715..e98ba7d58 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -682,11 +682,7 @@ public class ContactEditorFragment extends Fragment implements
// Otherwise, there should be a default account. Then either create a local contact
// (if default account is null) or create a contact with the specified account.
AccountWithDataSet defaultAccount = mEditorUtils.getDefaultAccount();
- if (defaultAccount == null) {
- createContact(null);
- } else {
- createContact(defaultAccount);
- }
+ createContact(defaultAccount);
}
}
@@ -715,9 +711,7 @@ public class ContactEditorFragment extends Fragment implements
*/
private void createContact(AccountWithDataSet account) {
final AccountTypeManager accountTypes = AccountTypeManager.getInstance(mContext);
- final AccountType accountType =
- accountTypes.getAccountType(account != null ? account.type : null,
- account != null ? account.dataSet : null);
+ final AccountType accountType = accountTypes.getAccountTypeForAccount(account);
if (accountType.getCreateContactActivityClassName() != null) {
if (mListener != null) {
@@ -740,10 +734,8 @@ public class ContactEditorFragment extends Fragment implements
RawContactDelta oldState, AccountWithDataSet oldAccount,
AccountWithDataSet newAccount) {
AccountTypeManager accountTypes = AccountTypeManager.getInstance(mContext);
- AccountType oldAccountType = accountTypes.getAccountType(
- oldAccount.type, oldAccount.dataSet);
- AccountType newAccountType = accountTypes.getAccountType(
- newAccount.type, newAccount.dataSet);
+ AccountType oldAccountType = accountTypes.getAccountTypeForAccount(oldAccount);
+ AccountType newAccountType = accountTypes.getAccountTypeForAccount(newAccount);
if (newAccountType.getCreateContactActivityClassName() != null) {
Log.w(TAG, "external activity called in rebind situation");
@@ -772,11 +764,7 @@ public class ContactEditorFragment extends Fragment implements
mStatus = Status.EDITING;
final RawContact rawContact = new RawContact();
- if (newAccount != null) {
- rawContact.setAccount(newAccount);
- } else {
- rawContact.setAccountToLocal();
- }
+ rawContact.setAccount(newAccount);
final ValuesDelta valuesDelta = ValuesDelta.fromAfter(rawContact.getValues());
final RawContactDelta insert = new RawContactDelta(valuesDelta);