protected void updateAddEnabled() {
   // Set enabled state on the "add" view
   final boolean canInsert = EntityModifier.canInsert(mState, mKind);
   final boolean isEnabled = !mReadOnly && canInsert;
   mAdd.setEnabled(isEnabled);
   mAddPlusButton.setVisibility(isEnabled && mKind.isList ? View.VISIBLE : View.GONE);
 }
  /** Test {@link EntityModifier#canInsert(EntityDelta, DataKind)} by inserting various rows. */
  public void testCanInsert() {
    // Build a source and pull specific types
    final ContactsSource source = getSource();
    final DataKind kindPhone = source.getKindForMimetype(Phone.CONTENT_ITEM_TYPE);
    final EditType typeHome = EntityModifier.getType(kindPhone, Phone.TYPE_HOME);
    final EditType typeWork = EntityModifier.getType(kindPhone, Phone.TYPE_WORK);
    final EditType typeOther = EntityModifier.getType(kindPhone, Phone.TYPE_OTHER);

    // Add first home, first work
    final EntityDelta state = getEntity(TEST_ID);
    EntityModifier.insertChild(state, kindPhone, typeHome);
    EntityModifier.insertChild(state, kindPhone, typeWork);
    assertTrue("Unable to insert", EntityModifier.canInsert(state, kindPhone));

    // Add two other, which puts us just under "5" overall limit
    EntityModifier.insertChild(state, kindPhone, typeOther);
    EntityModifier.insertChild(state, kindPhone, typeOther);
    assertTrue("Unable to insert", EntityModifier.canInsert(state, kindPhone));

    // Add second home, which should push to snug limit
    EntityModifier.insertChild(state, kindPhone, typeHome);
    assertFalse("Able to insert", EntityModifier.canInsert(state, kindPhone));
  }