Loading src/com/android/contacts/detail/ContactDetailFragment.java +2 −2 Original line number Diff line number Diff line Loading @@ -550,7 +550,7 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen mRawContactIds.add(rawContactId); } AccountType type = accountTypes.getAccountType(accountType, dataSet); if (type == null || !type.readOnly) { if (type == null || type.areContactsWritable()) { mWritableRawContactIds.add(rawContactId); } Loading Loading @@ -1948,7 +1948,7 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen AccountTypeManager.getInstance(mContext); final AccountType type = accountTypes.getAccountType(accountType, dataSet); // Offline or non-writeable account? Nothing to fix if (type == null || type.readOnly) return false; if (type == null || !type.areContactsWritable()) return false; // Check whether the contact is in the default group boolean isInDefaultGroup = false; Loading src/com/android/contacts/editor/AggregationSuggestionView.java +1 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ public class AggregationSuggestionView extends LinearLayout { return true; } AccountType type = accountTypes.getAccountType(accountType, dataSet); if (!type.readOnly) { if (type.areContactsWritable()) { return true; } } Loading src/com/android/contacts/editor/ContactEditorFragment.java +16 −16 Original line number Diff line number Diff line Loading @@ -519,7 +519,7 @@ public class ContactEditorFragment extends Fragment implements final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE); final String dataSet = state.getValues().getAsString(RawContacts.DATA_SET); final AccountType type = accountTypes.getAccountType(accountType, dataSet); if (!type.readOnly) { if (type.areContactsWritable()) { // Apply extras to the first writable raw contact only EntityModifier.parseExtras(mContext, type, state, extras); break; Loading Loading @@ -698,7 +698,7 @@ public class ContactEditorFragment extends Fragment implements editor.setState(entity, type, mViewIdGenerator, isEditingUserProfile()); editor.getPhotoEditor().setEditorListener( new PhotoEditorListener(editor, type.readOnly)); new PhotoEditorListener(editor, type.areContactsWritable())); if (editor instanceof RawContactEditorView) { final RawContactEditorView rawContactEditor = (RawContactEditorView) editor; EditorListener listener = new EditorListener() { Loading Loading @@ -1154,7 +1154,7 @@ public class ContactEditorFragment extends Fragment implements final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE); final String dataSet = values.getAsString(RawContacts.DATA_SET); final AccountType type = accountTypes.getAccountType(accountType, dataSet); if (!type.readOnly) { if (type.areContactsWritable()) { return true; } } Loading Loading @@ -1234,9 +1234,9 @@ public class ContactEditorFragment extends Fragment implements final AccountType type2 = accountTypes.getAccountType(accountType2, dataSet2); // Check read-only if (type1.readOnly && !type2.readOnly) { if (!type1.areContactsWritable() && type2.areContactsWritable()) { return 1; } else if (!type1.readOnly && type2.readOnly) { } else if (type1.areContactsWritable() && !type2.areContactsWritable()) { return -1; } Loading Loading @@ -1693,11 +1693,11 @@ public class ContactEditorFragment extends Fragment implements private final class PhotoEditorListener implements EditorListener, PhotoActionPopup.Listener { private final BaseRawContactEditorView mEditor; private final boolean mAccountReadOnly; private final boolean mAccountWritable; private PhotoEditorListener(BaseRawContactEditorView editor, boolean accountReadOnly) { private PhotoEditorListener(BaseRawContactEditorView editor, boolean accountWritable) { mEditor = editor; mAccountReadOnly = accountReadOnly; mAccountWritable = accountWritable; } @Override Loading @@ -1707,14 +1707,7 @@ public class ContactEditorFragment extends Fragment implements if (request == EditorListener.REQUEST_PICK_PHOTO) { // Determine mode final int mode; if (mAccountReadOnly) { if (mEditor.hasSetPhoto() && hasMoreThanOnePhoto()) { mode = PhotoActionPopup.MODE_READ_ONLY_ALLOW_PRIMARY; } else { // Read-only and either no photo or the only photo ==> no options return; } } else { if (mAccountWritable) { if (mEditor.hasSetPhoto()) { if (hasMoreThanOnePhoto()) { mode = PhotoActionPopup.MODE_PHOTO_ALLOW_PRIMARY; Loading @@ -1724,6 +1717,13 @@ public class ContactEditorFragment extends Fragment implements } else { mode = PhotoActionPopup.MODE_NO_PHOTO; } } else { if (mEditor.hasSetPhoto() && hasMoreThanOnePhoto()) { mode = PhotoActionPopup.MODE_READ_ONLY_ALLOW_PRIMARY; } else { // Read-only and either no photo or the only photo ==> no options return; } } PhotoActionPopup.createPopupMenu(mContext, mEditor.getPhotoEditor(), this, mode) .show(); Loading src/com/android/contacts/editor/ExternalRawContactEditorView.java +6 −6 Original line number Diff line number Diff line Loading @@ -176,7 +176,7 @@ public class ExternalRawContactEditorView extends BaseRawContactEditorView boolean hasPhotoEditor = type.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null; setHasPhotoEditor(hasPhotoEditor); primary = state.getPrimaryEntry(Photo.CONTENT_ITEM_TYPE); getPhotoEditor().setValues(kind, primary, state, type.readOnly, vig); getPhotoEditor().setValues(kind, primary, state, !type.areContactsWritable(), vig); if (!hasPhotoEditor || !getPhotoEditor().hasSetPhoto()) { mPhotoStub.setVisibility(View.GONE); } else { Loading @@ -191,7 +191,11 @@ public class ExternalRawContactEditorView extends BaseRawContactEditorView mName.setText(primary != null ? primary.getAsString(StructuredName.DISPLAY_NAME) : mContext.getString(R.string.missing_name)); if (type.readOnly) { if (type.areContactsWritable()) { mAccountContainer.setBackgroundDrawable(null); mAccountContainer.setEnabled(false); mEditExternallyButton.setVisibility(View.VISIBLE); } else { mAccountContainer.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Loading @@ -200,10 +204,6 @@ public class ExternalRawContactEditorView extends BaseRawContactEditorView } }); mEditExternallyButton.setVisibility(View.GONE); } else { mAccountContainer.setBackgroundDrawable(null); mAccountContainer.setEnabled(false); mEditExternallyButton.setVisibility(View.VISIBLE); } final Resources res = mContext.getResources(); Loading src/com/android/contacts/interactions/ContactDeletionInteraction.java +4 −4 Original line number Diff line number Diff line Loading @@ -240,11 +240,11 @@ public class ContactDeletionInteraction extends Fragment contactId = cursor.getLong(COLUMN_INDEX_CONTACT_ID); lookupKey = cursor.getString(COLUMN_INDEX_LOOKUP_KEY); AccountType type = accountTypes.getAccountType(accountType, dataSet); boolean readonly = type != null && type.readOnly; if (readonly) { readOnlyRawContacts.add(rawContactId); } else { boolean writable = type == null || type.areContactsWritable(); if (writable) { writableRawContacts.add(rawContactId); } else { readOnlyRawContacts.add(rawContactId); } } Loading Loading
src/com/android/contacts/detail/ContactDetailFragment.java +2 −2 Original line number Diff line number Diff line Loading @@ -550,7 +550,7 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen mRawContactIds.add(rawContactId); } AccountType type = accountTypes.getAccountType(accountType, dataSet); if (type == null || !type.readOnly) { if (type == null || type.areContactsWritable()) { mWritableRawContactIds.add(rawContactId); } Loading Loading @@ -1948,7 +1948,7 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen AccountTypeManager.getInstance(mContext); final AccountType type = accountTypes.getAccountType(accountType, dataSet); // Offline or non-writeable account? Nothing to fix if (type == null || type.readOnly) return false; if (type == null || !type.areContactsWritable()) return false; // Check whether the contact is in the default group boolean isInDefaultGroup = false; Loading
src/com/android/contacts/editor/AggregationSuggestionView.java +1 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ public class AggregationSuggestionView extends LinearLayout { return true; } AccountType type = accountTypes.getAccountType(accountType, dataSet); if (!type.readOnly) { if (type.areContactsWritable()) { return true; } } Loading
src/com/android/contacts/editor/ContactEditorFragment.java +16 −16 Original line number Diff line number Diff line Loading @@ -519,7 +519,7 @@ public class ContactEditorFragment extends Fragment implements final String accountType = state.getValues().getAsString(RawContacts.ACCOUNT_TYPE); final String dataSet = state.getValues().getAsString(RawContacts.DATA_SET); final AccountType type = accountTypes.getAccountType(accountType, dataSet); if (!type.readOnly) { if (type.areContactsWritable()) { // Apply extras to the first writable raw contact only EntityModifier.parseExtras(mContext, type, state, extras); break; Loading Loading @@ -698,7 +698,7 @@ public class ContactEditorFragment extends Fragment implements editor.setState(entity, type, mViewIdGenerator, isEditingUserProfile()); editor.getPhotoEditor().setEditorListener( new PhotoEditorListener(editor, type.readOnly)); new PhotoEditorListener(editor, type.areContactsWritable())); if (editor instanceof RawContactEditorView) { final RawContactEditorView rawContactEditor = (RawContactEditorView) editor; EditorListener listener = new EditorListener() { Loading Loading @@ -1154,7 +1154,7 @@ public class ContactEditorFragment extends Fragment implements final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE); final String dataSet = values.getAsString(RawContacts.DATA_SET); final AccountType type = accountTypes.getAccountType(accountType, dataSet); if (!type.readOnly) { if (type.areContactsWritable()) { return true; } } Loading Loading @@ -1234,9 +1234,9 @@ public class ContactEditorFragment extends Fragment implements final AccountType type2 = accountTypes.getAccountType(accountType2, dataSet2); // Check read-only if (type1.readOnly && !type2.readOnly) { if (!type1.areContactsWritable() && type2.areContactsWritable()) { return 1; } else if (!type1.readOnly && type2.readOnly) { } else if (type1.areContactsWritable() && !type2.areContactsWritable()) { return -1; } Loading Loading @@ -1693,11 +1693,11 @@ public class ContactEditorFragment extends Fragment implements private final class PhotoEditorListener implements EditorListener, PhotoActionPopup.Listener { private final BaseRawContactEditorView mEditor; private final boolean mAccountReadOnly; private final boolean mAccountWritable; private PhotoEditorListener(BaseRawContactEditorView editor, boolean accountReadOnly) { private PhotoEditorListener(BaseRawContactEditorView editor, boolean accountWritable) { mEditor = editor; mAccountReadOnly = accountReadOnly; mAccountWritable = accountWritable; } @Override Loading @@ -1707,14 +1707,7 @@ public class ContactEditorFragment extends Fragment implements if (request == EditorListener.REQUEST_PICK_PHOTO) { // Determine mode final int mode; if (mAccountReadOnly) { if (mEditor.hasSetPhoto() && hasMoreThanOnePhoto()) { mode = PhotoActionPopup.MODE_READ_ONLY_ALLOW_PRIMARY; } else { // Read-only and either no photo or the only photo ==> no options return; } } else { if (mAccountWritable) { if (mEditor.hasSetPhoto()) { if (hasMoreThanOnePhoto()) { mode = PhotoActionPopup.MODE_PHOTO_ALLOW_PRIMARY; Loading @@ -1724,6 +1717,13 @@ public class ContactEditorFragment extends Fragment implements } else { mode = PhotoActionPopup.MODE_NO_PHOTO; } } else { if (mEditor.hasSetPhoto() && hasMoreThanOnePhoto()) { mode = PhotoActionPopup.MODE_READ_ONLY_ALLOW_PRIMARY; } else { // Read-only and either no photo or the only photo ==> no options return; } } PhotoActionPopup.createPopupMenu(mContext, mEditor.getPhotoEditor(), this, mode) .show(); Loading
src/com/android/contacts/editor/ExternalRawContactEditorView.java +6 −6 Original line number Diff line number Diff line Loading @@ -176,7 +176,7 @@ public class ExternalRawContactEditorView extends BaseRawContactEditorView boolean hasPhotoEditor = type.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null; setHasPhotoEditor(hasPhotoEditor); primary = state.getPrimaryEntry(Photo.CONTENT_ITEM_TYPE); getPhotoEditor().setValues(kind, primary, state, type.readOnly, vig); getPhotoEditor().setValues(kind, primary, state, !type.areContactsWritable(), vig); if (!hasPhotoEditor || !getPhotoEditor().hasSetPhoto()) { mPhotoStub.setVisibility(View.GONE); } else { Loading @@ -191,7 +191,11 @@ public class ExternalRawContactEditorView extends BaseRawContactEditorView mName.setText(primary != null ? primary.getAsString(StructuredName.DISPLAY_NAME) : mContext.getString(R.string.missing_name)); if (type.readOnly) { if (type.areContactsWritable()) { mAccountContainer.setBackgroundDrawable(null); mAccountContainer.setEnabled(false); mEditExternallyButton.setVisibility(View.VISIBLE); } else { mAccountContainer.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Loading @@ -200,10 +204,6 @@ public class ExternalRawContactEditorView extends BaseRawContactEditorView } }); mEditExternallyButton.setVisibility(View.GONE); } else { mAccountContainer.setBackgroundDrawable(null); mAccountContainer.setEnabled(false); mEditExternallyButton.setVisibility(View.VISIBLE); } final Resources res = mContext.getResources(); Loading
src/com/android/contacts/interactions/ContactDeletionInteraction.java +4 −4 Original line number Diff line number Diff line Loading @@ -240,11 +240,11 @@ public class ContactDeletionInteraction extends Fragment contactId = cursor.getLong(COLUMN_INDEX_CONTACT_ID); lookupKey = cursor.getString(COLUMN_INDEX_LOOKUP_KEY); AccountType type = accountTypes.getAccountType(accountType, dataSet); boolean readonly = type != null && type.readOnly; if (readonly) { readOnlyRawContacts.add(rawContactId); } else { boolean writable = type == null || type.areContactsWritable(); if (writable) { writableRawContacts.add(rawContactId); } else { readOnlyRawContacts.add(rawContactId); } } Loading