Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38959cf5 authored by Daniel Lehmann's avatar Daniel Lehmann Committed by Dave Santoro
Browse files

DO NOT MERGE Make third party sync adapters editable

Bug:3093621

Change-Id: If3bb34f7d29bea4bd873342232bea3c1a77bcd2a
parent 96e87fd6
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -14,8 +14,7 @@
     limitations under the License.
-->

<!-- placed inside act_edit as tabcontent -->
<com.android.contacts.editor.ExternalRawContactEditorView
<com.android.contacts.editor.RawContactReadOnlyEditorView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
@@ -77,4 +76,4 @@
        android:layout_height="wrap_content"
        android:orientation="vertical"/>

</com.android.contacts.editor.ExternalRawContactEditorView>
</com.android.contacts.editor.RawContactReadOnlyEditorView>
+1 −2
Original line number Diff line number Diff line
@@ -560,8 +560,7 @@ public class ConfirmAddDetailActivity extends Activity implements
            final String dataSet = state.getValues().getAsString(RawContacts.DATA_SET);
            final AccountType type = mAccountTypeManager.getAccountType(accountType, dataSet);

            // Raw contacts that are not from external sources should be editable.
            if (!type.isExternal()) {
            if (type.areContactsWritable()) {
                mEditableAccountType = type;
                mState = state;
                return;
+1 −7
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import com.android.contacts.ContactPresenceIconUtil;
import com.android.contacts.ContactSaveService;
import com.android.contacts.ContactsUtils;
import com.android.contacts.GroupMetaData;
import com.android.contacts.NfcHandler;
import com.android.contacts.R;
import com.android.contacts.TypePrecedence;
import com.android.contacts.activities.ContactDetailActivity.FragmentKeyListener;
@@ -154,7 +153,6 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen

    private Button mQuickFixButton;
    private QuickFix mQuickFix;
    private final ArrayList<Long> mWritableRawContactIds = new ArrayList<Long>();
    private int mNumPhoneNumbers = 0;
    private String mDefaultCountryIso;
    private boolean mContactHasSocialUpdates;
@@ -531,8 +529,6 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen
        mPrimaryPhoneUri = null;
        mNumPhoneNumbers = 0;

        mWritableRawContactIds.clear();

        final AccountTypeManager accountTypes = AccountTypeManager.getInstance(mContext);

        // Build up method entries
@@ -550,10 +546,8 @@ public class ContactDetailFragment extends Fragment implements FragmentKeyListen
            if (!mRawContactIds.contains(rawContactId)) {
                mRawContactIds.add(rawContactId);
            }

            AccountType type = accountTypes.getAccountType(accountType, dataSet);
            if (type == null || type.areContactsWritable()) {
                mWritableRawContactIds.add(rawContactId);
            }

            for (NamedContentValues subValue : entity.getSubValues()) {
                final ContentValues entryValues = subValue.values;
+6 −5
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ import java.util.List;
public class ContactEditorFragment extends Fragment implements
        SplitContactConfirmationDialogFragment.Listener,
        AggregationSuggestionEngine.Listener, AggregationSuggestionView.Listener,
        ExternalRawContactEditorView.Listener {
        RawContactReadOnlyEditorView.Listener {

    private static final String TAG = ContactEditorFragment.class.getSimpleName();

@@ -449,7 +449,8 @@ public class ContactEditorFragment extends Fragment implements
            String dataSet = entityValues.getAsString(RawContacts.DATA_SET);
            AccountType accountType = AccountTypeManager.getInstance(mContext).getAccountType(
                    type, dataSet);
            if (accountType.getEditContactActivityClassName() != null) {
            if (accountType.getEditContactActivityClassName() != null &&
                    !accountType.areContactsWritable()) {
                if (mListener != null) {
                    String name = entityValues.getAsString(RawContacts.ACCOUNT_NAME);
                    long rawContactId = entityValues.getAsLong(RawContacts.Entity._ID);
@@ -671,10 +672,10 @@ public class ContactEditorFragment extends Fragment implements
            final long rawContactId = values.getAsLong(RawContacts._ID);

            final BaseRawContactEditorView editor;
            if (type.isExternal()) {
            if (!type.areContactsWritable()) {
                editor = (BaseRawContactEditorView) inflater.inflate(
                        R.layout.external_raw_contact_editor_view, mContent, false);
                ((ExternalRawContactEditorView) editor).setListener(this);
                        R.layout.raw_contact_readonly_editor_view, mContent, false);
                ((RawContactReadOnlyEditorView) editor).setListener(this);
            } else {
                editor = (RawContactEditorView) inflater.inflate(R.layout.raw_contact_editor_view,
                        mContent, false);
+6 −5
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ import java.util.ArrayList;
/**
 * Custom view that displays external contacts in the edit screen.
 */
public class ExternalRawContactEditorView extends BaseRawContactEditorView
public class RawContactReadOnlyEditorView extends BaseRawContactEditorView
        implements OnClickListener {
    private LayoutInflater mInflater;

@@ -76,11 +76,11 @@ public class ExternalRawContactEditorView extends BaseRawContactEditorView
        void onExternalEditorRequest(AccountWithDataSet account, Uri uri);
    }

    public ExternalRawContactEditorView(Context context) {
    public RawContactReadOnlyEditorView(Context context) {
        super(context);
    }

    public ExternalRawContactEditorView(Context context, AttributeSet attrs) {
    public RawContactReadOnlyEditorView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

@@ -187,7 +187,7 @@ public class ExternalRawContactEditorView extends BaseRawContactEditorView
        mName.setText(primary != null ? primary.getAsString(StructuredName.DISPLAY_NAME) :
                mContext.getString(R.string.missing_name));

        if (type.areContactsWritable()) {
        if (type.getEditContactActivityClassName() != null) {
            mAccountContainer.setBackgroundDrawable(null);
            mAccountContainer.setEnabled(false);
            mEditExternallyButton.setVisibility(View.VISIBLE);
@@ -237,7 +237,8 @@ public class ExternalRawContactEditorView extends BaseRawContactEditorView
                } else {
                    emailType = null;
                }
                bindData(mContext.getText(R.string.emailLabelsGroup), emailAddress, null, i == 0);
                bindData(mContext.getText(R.string.emailLabelsGroup), emailAddress, emailType,
                        i == 0);
            }
        }

Loading