diff --git a/res/layout/item_contact_editor.xml b/res/layout/item_contact_editor.xml
index f5e7bd3..57d641f 100644
--- a/res/layout/item_contact_editor.xml
+++ b/res/layout/item_contact_editor.xml
@@ -14,7 +14,7 @@
      limitations under the License.
 -->
 
-<!-- placed inside act_edit as tabcontent -->
+<!-- placed inside act_edit -->
 <com.android.contacts.ui.widget.ContactEditorView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
@@ -22,14 +22,6 @@
     android:orientation="horizontal"
 >
 
-    <!-- Left side color bar -->
-    <ImageView
-        android:id="@+id/color_bar"
-        android:layout_width="4dip"
-        android:layout_height="match_parent"
-        android:visibility="gone"
-    />
-
     <!-- The content -->
     <LinearLayout
         android:layout_width="0dip"
@@ -116,65 +108,28 @@
             android:layout_marginBottom="4dip"
             layout="@layout/item_generic_editor" />
 
-        <TextView android:id="@+id/read_only_name"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="6dip"
-            android:layout_marginBottom="6dip"
-            android:layout_marginLeft="10dip"
-
-            android:textAppearance="?android:attr/textAppearanceLarge"
-        />
-
         <LinearLayout
-            android:id="@+id/sect_general"
+            android:id="@+id/sect_fields"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical"
         />
 
-        <View android:id="@+id/head_secondary_divider"
+        <View
             android:layout_width="match_parent"
             android:layout_height="1px"
-            android:background="?android:attr/listDivider" />
-
-        <TextView
-            android:id="@+id/head_secondary"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-
-            android:gravity="center_vertical"
-            android:minHeight="?android:attr/listPreferredItemHeight"
-            android:text="@string/edit_secondary_collapse"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textColor="@color/kind_title"
-            android:singleLine="true"
-            android:ellipsize="marquee"
-            android:focusable="true"
-            android:clickable="true"
-            android:paddingLeft="10dip"
-            android:drawablePadding="10dip" />
-
-        <LinearLayout
-            android:id="@+id/sect_secondary"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical" />
-
-        <TextView
-            android:id="@+id/edit_read_only"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="10dip"
-            android:layout_marginBottom="10dip"
-            android:layout_marginLeft="10dip"
-
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:textColor="?android:attr/textColorPrimary"
-            android:drawableLeft="@android:drawable/ic_dialog_alert"
-            android:drawablePadding="10dip"
+            android:layout_alignParentBottom="true"
+            android:background="?android:attr/listDivider"
         />
 
+        <Button
+            android:id="@+id/button_add_field"
+            android:text="@string/add_field"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="right"
+            android:layout_marginTop="10dip"
+        />
     </LinearLayout>
 
 </com.android.contacts.ui.widget.ContactEditorView>
diff --git a/res/layout/item_kind_section.xml b/res/layout/item_kind_section.xml
index d1dec5e..a78896b 100644
--- a/res/layout/item_kind_section.xml
+++ b/res/layout/item_kind_section.xml
@@ -25,7 +25,7 @@
 
     <View
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
+        android:layout_height="1px"
         android:background="?android:attr/listDivider" />
 
     <LinearLayout
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 32bada1..e95dc3c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1171,4 +1171,6 @@
     <!-- The text displayed when the contacts list is empty while displaying only selected contacts in multiple picker -->
     <string name="no_contacts_selected">"No contacts selected."</string>
 
+    <!-- The add field button shown in the editor under each editable Raw Contact -->
+    <string name="add_field">Add information</string>
 </resources>
diff --git a/src/com/android/contacts/ui/widget/ContactEditorView.java b/src/com/android/contacts/ui/widget/ContactEditorView.java
index 83bf2fb..0916bc0 100644
--- a/src/com/android/contacts/ui/widget/ContactEditorView.java
+++ b/src/com/android/contacts/ui/widget/ContactEditorView.java
@@ -25,13 +25,15 @@
 import com.android.contacts.model.Editor.EditorListener;
 import com.android.contacts.model.EntityDelta.ValuesDelta;
 import com.android.contacts.ui.ViewIdGenerator;
+import com.android.contacts.util.DialogManager;
+import com.android.contacts.util.DialogManager.DialogShowingView;
 
+import android.app.AlertDialog;
+import android.app.Dialog;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Entity;
-import android.content.res.Resources;
-import android.graphics.drawable.Drawable;
-import android.os.Parcel;
-import android.os.Parcelable;
+import android.os.Bundle;
 import android.provider.ContactsContract.Contacts;
 import android.provider.ContactsContract.Data;
 import android.provider.ContactsContract.RawContacts;
@@ -39,49 +41,46 @@
 import android.provider.ContactsContract.CommonDataKinds.StructuredName;
 import android.text.TextUtils;
 import android.util.AttributeSet;
+import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.View.OnClickListener;
+import android.widget.Button;
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import java.util.ArrayList;
+
 /**
  * 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)}.
+ * {@link #setState(EntityDelta, ContactsSource, 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.
  */
-public class ContactEditorView extends BaseContactEditorView implements OnClickListener {
-    private TextView mReadOnly;
-    private TextView mReadOnlyName;
-
+public class ContactEditorView extends BaseContactEditorView implements DialogShowingView {
     private View mPhotoStub;
     private GenericEditorView mName;
 
-    private boolean mIsSourceReadOnly;
-    private ViewGroup mGeneral;
-    private ViewGroup mSecondary;
-    private boolean mSecondaryVisible;
+    private ViewGroup mFields;
 
-    private TextView mSecondaryHeader;
-
-    private Drawable mSecondaryOpen;
-    private Drawable mSecondaryClosed;
-
-    private View mHeaderColorBar;
-    private View mSideBar;
     private ImageView mHeaderIcon;
     private TextView mHeaderAccountType;
     private TextView mHeaderAccountName;
 
+    private Button mAddFieldButton;
+
     private long mRawContactId = -1;
 
+    private DialogManager mDialogManager = null;
+
+    private static final String DIALOG_ID_KEY = "dialog_id";
+    private static final int DIALOG_ID_FIELD_SELECTOR = 1;
+
     public ContactEditorView(Context context) {
         super(context);
     }
@@ -95,66 +94,29 @@
     protected void onFinishInflate() {
         super.onFinishInflate();
 
-        mInflater = (LayoutInflater)getContext().getSystemService(
-                Context.LAYOUT_INFLATER_SERVICE);
+        mInflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
         mPhoto = (PhotoEditorView)findViewById(R.id.edit_photo);
         mPhotoStub = findViewById(R.id.stub_photo);
 
         final int photoSize = getResources().getDimensionPixelSize(R.dimen.edit_photo_size);
 
-        mReadOnly = (TextView)findViewById(R.id.edit_read_only);
-
         mName = (GenericEditorView)findViewById(R.id.edit_name);
         mName.setMinimumHeight(photoSize);
         mName.setDeletable(false);
 
-        mReadOnlyName = (TextView) findViewById(R.id.read_only_name);
+        mFields = (ViewGroup)findViewById(R.id.sect_fields);
 
-        mGeneral = (ViewGroup)findViewById(R.id.sect_general);
-        mSecondary = (ViewGroup)findViewById(R.id.sect_secondary);
-
-        mHeaderColorBar = findViewById(R.id.header_color_bar);
-        mSideBar = findViewById(R.id.color_bar);
         mHeaderIcon = (ImageView) findViewById(R.id.header_icon);
         mHeaderAccountType = (TextView) findViewById(R.id.header_account_type);
         mHeaderAccountName = (TextView) findViewById(R.id.header_account_name);
 
-        mSecondaryHeader = (TextView)findViewById(R.id.head_secondary);
-        mSecondaryHeader.setOnClickListener(this);
-
-        final Resources res = getResources();
-        mSecondaryOpen = res.getDrawable(com.android.internal.R.drawable.expander_ic_maximized);
-        mSecondaryClosed = res.getDrawable(com.android.internal.R.drawable.expander_ic_minimized);
-
-        this.setSecondaryVisible(false);
-    }
-
-    /** {@inheritDoc} */
-    public void onClick(View v) {
-        // Toggle visibility of secondary kinds
-        final boolean makeVisible = mSecondary.getVisibility() != View.VISIBLE;
-        this.setSecondaryVisible(makeVisible);
-    }
-
-    /**
-     * Set the visibility of secondary sections, along with header icon.
-     *
-     * <p>If the source is read-only and there's no secondary fields, the entire secondary section
-     * will be hidden.
-     */
-    private void setSecondaryVisible(boolean makeVisible) {
-        mSecondaryVisible = makeVisible;
-
-        if (!mIsSourceReadOnly && mSecondary.getChildCount() > 0) {
-            mSecondaryHeader.setVisibility(View.VISIBLE);
-            mSecondaryHeader.setCompoundDrawablesWithIntrinsicBounds(
-                    makeVisible ? mSecondaryOpen : mSecondaryClosed, null, null, null);
-            mSecondary.setVisibility(makeVisible ? View.VISIBLE : View.GONE);
-        } else {
-            mSecondaryHeader.setVisibility(View.GONE);
-            mSecondary.setVisibility(View.GONE);
-        }
+        mAddFieldButton = (Button) findViewById(R.id.button_add_field);
+        mAddFieldButton.setOnClickListener(new OnClickListener() {
+            public void onClick(View v) {
+                showDialog(DIALOG_ID_FIELD_SELECTOR);
+            }
+        });
     }
 
     /**
@@ -165,16 +127,13 @@
     @Override
     public void setState(EntityDelta state, ContactsSource source, ViewIdGenerator vig) {
         // Remove any existing sections
-        mGeneral.removeAllViews();
-        mSecondary.removeAllViews();
+        mFields.removeAllViews();
 
         // Bail if invalid state or source
         if (state == null || source == null) return;
 
         setId(vig.getId(state, null, null, ViewIdGenerator.NO_VIEW_INDEX));
 
-        mIsSourceReadOnly = source.readOnly;
-
         // Make sure we have StructuredName
         EntityModifier.ensureKindExists(state, source, StructuredName.CONTENT_ITEM_TYPE);
 
@@ -198,24 +157,13 @@
         EntityModifier.ensureKindExists(state, source, Photo.CONTENT_ITEM_TYPE);
         mHasPhotoEditor = (source.getKindForMimetype(Photo.CONTENT_ITEM_TYPE) != null);
         mPhoto.setVisibility(mHasPhotoEditor ? View.VISIBLE : View.GONE);
-        mPhoto.setEnabled(!mIsSourceReadOnly);
-        mName.setEnabled(!mIsSourceReadOnly);
+        mPhoto.setEnabled(true);
+        mName.setEnabled(true);
 
         // Show and hide the appropriate views
-        if (mIsSourceReadOnly) {
-            mGeneral.setVisibility(View.GONE);
-            mName.setVisibility(View.GONE);
-            mReadOnly.setVisibility(View.VISIBLE);
-            mReadOnly.setText(mContext.getString(R.string.contact_read_only, accountType));
-            mReadOnlyName.setVisibility(View.VISIBLE);
-        } else {
-            mGeneral.setVisibility(View.VISIBLE);
-            mName.setVisibility(View.VISIBLE);
-            mReadOnly.setVisibility(View.GONE);
-            mReadOnlyName.setVisibility(View.GONE);
-        }
+        mFields.setVisibility(View.VISIBLE);
+        mName.setVisibility(View.VISIBLE);
 
-        boolean anySecondaryFieldFilled = false;
         // Create editor sections for each possible data kind
         for (DataKind kind : source.getSortedDataKinds()) {
             // Skip kind of not editable
@@ -225,36 +173,21 @@
             if (StructuredName.CONTENT_ITEM_TYPE.equals(mimeType)) {
                 // Handle special case editor for structured name
                 final ValuesDelta primary = state.getPrimaryEntry(mimeType);
-                if (!mIsSourceReadOnly) {
-                    mName.setValues(kind, primary, state, mIsSourceReadOnly, vig);
-                } else {
-                    String displayName = primary.getAsString(StructuredName.DISPLAY_NAME);
-                    mReadOnlyName.setText(displayName);
-                }
+                mName.setValues(kind, primary, state, false, vig);
             } else if (Photo.CONTENT_ITEM_TYPE.equals(mimeType)) {
                 // Handle special case editor for photos
                 final ValuesDelta primary = state.getPrimaryEntry(mimeType);
-                mPhoto.setValues(kind, primary, state, mIsSourceReadOnly, vig);
-                if (mIsSourceReadOnly && !mPhoto.hasSetPhoto()) {
-                    mPhotoStub.setVisibility(View.GONE);
-                } else {
-                    mPhotoStub.setVisibility(View.VISIBLE);
-                }
-            } else if (!mIsSourceReadOnly) {
+                mPhoto.setValues(kind, primary, state, false, vig);
+                mPhotoStub.setVisibility(View.VISIBLE);
+            } else {
                 // Otherwise use generic section-based editors
                 if (kind.fieldList == null) continue;
-                final ViewGroup parent = kind.secondary ? mSecondary : mGeneral;
                 final KindSectionView section = (KindSectionView)mInflater.inflate(
-                        R.layout.item_kind_section, parent, false);
-                section.setState(kind, state, mIsSourceReadOnly, vig);
-                if (kind.secondary && section.isAnyEditorFilledOut()) {
-                    anySecondaryFieldFilled = true;
-                }
-                parent.addView(section);
+                        R.layout.item_kind_section, mFields, false);
+                section.setState(kind, state, false, vig);
+                mFields.addView(section);
             }
         }
-
-        setSecondaryVisible(anySecondaryFieldFilled);
     }
 
     /**
@@ -270,56 +203,53 @@
         return mRawContactId;
     }
 
-    private static class SavedState extends BaseSavedState {
-        public boolean mSecondaryVisible;
-
-        SavedState(Parcelable superState) {
-            super(superState);
-        }
-
-        private SavedState(Parcel in) {
-            super(in);
-            mSecondaryVisible = (in.readInt() == 0 ? false : true);
-        }
-
-        @Override
-        public void writeToParcel(Parcel out, int flags) {
-            super.writeToParcel(out, flags);
-            out.writeInt(mSecondaryVisible ? 1 : 0);
-        }
-
-        public static final Parcelable.Creator<SavedState> CREATOR
-                = new Parcelable.Creator<SavedState>() {
-            public SavedState createFromParcel(Parcel in) {
-                return new SavedState(in);
-            }
-
-            public SavedState[] newArray(int size) {
-                return new SavedState[size];
-            }
-        };
+    /* package */
+    void showDialog(int bundleDialogId) {
+        final Bundle bundle = new Bundle();
+        bundle.putInt(DIALOG_ID_KEY, bundleDialogId);
+        getDialogManager().showDialogInView(this, bundle);
     }
 
-    /**
-     * Saves the visibility of the secondary field.
-     */
-    @Override
-    protected Parcelable onSaveInstanceState() {
-        Parcelable superState = super.onSaveInstanceState();
-        SavedState ss = new SavedState(superState);
-
-        ss.mSecondaryVisible = mSecondaryVisible;
-        return ss;
+    private DialogManager getDialogManager() {
+        if (mDialogManager == null) {
+            Context context = getContext();
+            if (!(context instanceof DialogManager.DialogShowingViewActivity)) {
+                throw new IllegalStateException(
+                        "View must be hosted in an Activity that implements " +
+                        "DialogManager.DialogShowingViewActivity");
+            }
+            mDialogManager = ((DialogManager.DialogShowingViewActivity)context).getDialogManager();
+        }
+        return mDialogManager;
     }
 
-    /**
-     * Restores the visibility of the secondary field.
-     */
-    @Override
-    protected void onRestoreInstanceState(Parcelable state) {
-        SavedState ss = (SavedState) state;
-        super.onRestoreInstanceState(ss.getSuperState());
-
-        setSecondaryVisible(ss.mSecondaryVisible);
+    public Dialog createDialog(Bundle bundle) {
+        if (bundle == null) throw new IllegalArgumentException("bundle must not be null");
+        int dialogId = bundle.getInt(DIALOG_ID_KEY);
+        switch (dialogId) {
+            case DIALOG_ID_FIELD_SELECTOR:
+                final ArrayList<CharSequence> items =
+                        new ArrayList<CharSequence>(mFields.getChildCount());
+                for (int i = 0; i < mFields.getChildCount(); i++) {
+                    final KindSectionView sectionView = (KindSectionView) mFields.getChildAt(i);
+                    // not a list and already exists? ignore
+                    if (!sectionView.getKind().isList && sectionView.getEditorCount() != 0) {
+                        continue;
+                    }
+                    items.add(sectionView.getTitle());
+                }
+                final DialogInterface.OnClickListener itemClickListener =
+                        new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int which) {
+                        final KindSectionView view = (KindSectionView) mFields.getChildAt(which);
+                        view.addItem();
+                    }
+                };
+                return new AlertDialog.Builder(getContext())
+                        .setItems(items.toArray(new CharSequence[0]), itemClickListener)
+                        .create();
+            default:
+                throw new IllegalArgumentException("Invalid dialogId: " + dialogId);
+        }
     }
 }
diff --git a/src/com/android/contacts/ui/widget/GenericEditorView.java b/src/com/android/contacts/ui/widget/GenericEditorView.java
index de4dfae..5c2f9b7 100644
--- a/src/com/android/contacts/ui/widget/GenericEditorView.java
+++ b/src/com/android/contacts/ui/widget/GenericEditorView.java
@@ -388,16 +388,17 @@
                 // Keep around in model, but mark as deleted
                 mEntry.markDeleted();
 
-                final ViewGroupAnimator animator = ViewGroupAnimator.captureView(getRootView());
+//                final ViewGroupAnimator animator = ViewGroupAnimator.captureView(getRootView());
 
-                animator.removeView(this);
+//                animator.removeView(this);
+                ((ViewGroup) getParent()).removeView(this);
 
                 if (mListener != null) {
                     // Notify listener when present
                     mListener.onDeleted(this);
                 }
 
-                animator.animate();
+//                animator.animate();
                 break;
             }
             case R.id.edit_more_or_less: {
@@ -406,7 +407,7 @@
                 final int focusedViewId = focusedChild == null ? -1 : focusedChild.getId();
 
                 // Snapshot for animation
-                final ViewGroupAnimator animator = ViewGroupAnimator.captureView(getRootView());
+//                final ViewGroupAnimator animator = ViewGroupAnimator.captureView(getRootView());
 
                 // Reconfigure GUI
                 mHideOptional = !mHideOptional;
@@ -423,7 +424,7 @@
                 }
 
                 // Animate
-                animator.animate();
+//                animator.animate();
                 break;
             }
         }
diff --git a/src/com/android/contacts/ui/widget/KindSectionView.java b/src/com/android/contacts/ui/widget/KindSectionView.java
index 56ffc8c..88f88c7 100644
--- a/src/com/android/contacts/ui/widget/KindSectionView.java
+++ b/src/com/android/contacts/ui/widget/KindSectionView.java
@@ -24,7 +24,6 @@
 import com.android.contacts.model.Editor.EditorListener;
 import com.android.contacts.model.EntityDelta.ValuesDelta;
 import com.android.contacts.ui.ViewIdGenerator;
-import com.android.contacts.util.ViewGroupAnimator;
 
 import android.content.Context;
 import android.provider.ContactsContract.Data;
@@ -32,7 +31,6 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.View.OnClickListener;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -42,7 +40,7 @@
  * {@link DataKind} around a {@link Data#MIMETYPE}. This view shows a
  * section header and a trigger for adding new {@link Data} rows.
  */
-public class KindSectionView extends LinearLayout implements OnClickListener, EditorListener {
+public class KindSectionView extends LinearLayout implements EditorListener {
     private static final String TAG = "KindSectionView";
 
     private LayoutInflater mInflater;
@@ -78,7 +76,11 @@
         mEditors = (ViewGroup)findViewById(R.id.kind_editors);
 
         mAdd = findViewById(R.id.kind_header);
-        mAdd.setOnClickListener(this);
+        mAdd.setOnClickListener(new OnClickListener() {
+            public void onClick(View v) {
+                addItem();
+            }
+        });
 
         mAddPlusButton = (ImageView) findViewById(R.id.kind_plus);
 
@@ -87,8 +89,9 @@
 
     /** {@inheritDoc} */
     public void onDeleted(Editor editor) {
-        this.updateAddEnabled();
-        this.updateEditorsVisible();
+        updateAddEnabled();
+        updateEditorsVisible();
+        updateVisible();
     }
 
     /** {@inheritDoc} */
@@ -110,12 +113,17 @@
         // Only show the add button if this is a list
         mAddPlusButton.setVisibility(mKind.isList ? View.VISIBLE : View.GONE);
 
-        this.rebuildFromState();
-        this.updateAddEnabled();
-        this.updateEditorsVisible();
+        rebuildFromState();
+        updateAddEnabled();
+        updateEditorsVisible();
+        updateVisible();
     }
 
-    public boolean isAnyEditorFilledOut() {
+    public CharSequence getTitle() {
+        return mTitle.getText();
+    }
+
+    public boolean getFieldCount() {
         if (mState == null) {
             return false;
         }
@@ -124,7 +132,7 @@
             return false;
         }
 
-        int editorCount = mEditors.getChildCount();
+        int editorCount = getEditorCount();
         for (int i = 0; i < editorCount; i++) {
             GenericEditorView editorView = (GenericEditorView) mEditors.getChildAt(i);
             if (editorView.isAnyFieldFilledOut()) {
@@ -145,23 +153,6 @@
         // Check if we are displaying anything here
         boolean hasEntries = mState.hasMimeEntries(mKind.mimeType);
 
-        if (!mKind.isList) {
-            if (hasEntries) {
-                // we might have no visible entries. check that, too
-                for (ValuesDelta entry : mState.getMimeEntries(mKind.mimeType)) {
-                    if (!entry.isVisible()) {
-                        hasEntries = false;
-                        break;
-                    }
-                }
-            }
-
-            if (!hasEntries) {
-                EntityModifier.insertChild(mState, mKind);
-                hasEntries = true;
-            }
-        }
-
         if (hasEntries) {
             int entryIndex = 0;
             for (ValuesDelta entry : mState.getMimeEntries(mKind.mimeType)) {
@@ -171,11 +162,6 @@
                 final GenericEditorView editor = (GenericEditorView)mInflater.inflate(
                         R.layout.item_generic_editor, mEditors, false);
                 editor.setValues(mKind, entry, mState, mReadOnly, mViewIdGenerator);
-                // older versions of android had lists where we now have a single value
-                // in these cases we should show the remove button for all but the first value
-                // to ensure that nothing is removed
-                editor.mDelete.setVisibility((mKind.isList || (entryIndex != 0))
-                        ? View.VISIBLE : View.GONE);
                 editor.setEditorListener(this);
                 mEditors.addView(editor);
                 entryIndex++;
@@ -184,10 +170,15 @@
     }
 
     protected void updateEditorsVisible() {
-        final boolean hasChildren = mEditors.getChildCount() > 0;
+        final boolean hasChildren = getEditorCount() > 0;
         mEditors.setVisibility(hasChildren ? View.VISIBLE : View.GONE);
     }
 
+    private void updateVisible() {
+        setVisibility(getEditorCount() != 0 ? VISIBLE : GONE);
+    }
+
+
     protected void updateAddEnabled() {
         // Set enabled state on the "add" view
         final boolean canInsert = EntityModifier.canInsert(mState, mKind);
@@ -195,20 +186,18 @@
         mAdd.setEnabled(isEnabled);
     }
 
-    /** {@inheritDoc} */
-    public void onClick(View v) {
-        // if this is not a list the plus button is not visible but the user might have clicked
-        // the text.
-        if (!mKind.isList)
+    public void addItem() {
+        // if this is a list, we can freely add. if not, only allow adding the first
+        if (!mKind.isList && getEditorCount() == 1)
             return;
 
-        final ViewGroupAnimator animator = ViewGroupAnimator.captureView(getRootView());
+//        final ViewGroupAnimator animator = ViewGroupAnimator.captureView(getRootView());
 
         // Insert a new child and rebuild
         final ValuesDelta newValues = EntityModifier.insertChild(mState, mKind);
-        this.rebuildFromState();
-        this.updateAddEnabled();
-        this.updateEditorsVisible();
+        rebuildFromState();
+        updateAddEnabled();
+        updateEditorsVisible();
 
         // Find the newly added EditView and set focus.
         final int newFieldId = mViewIdGenerator.getId(mState, mKind, newValues, 0);
@@ -217,6 +206,16 @@
             newField.requestFocus();
         }
 
-        animator.animate();
+        updateVisible();
+
+//        animator.animate();
+    }
+
+    public int getEditorCount() {
+        return mEditors.getChildCount();
+    }
+
+    public DataKind getKind() {
+        return mKind;
     }
 }
