Default fields in contact editor
- Remove website and notes as default fields that show when
you create a new contact
- Don't allow "Add another field" button to add fields for
sections that are already visible (i.e. if website section is
visible, then "website" won't show up in the popup menu)
- TODO: Handle the case where there are no more fields to
add, need mocks from UX
Change-Id: I3b0929ebf69c93b60220c75c0b00b72cf5b2aa83
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 85d21f3..fe75b9b 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -542,10 +542,8 @@
// ensureKind will not add it, so it is safe to add e.g. Event)
EntityModifier.ensureKindExists(insert, newAccountType, Phone.CONTENT_ITEM_TYPE);
EntityModifier.ensureKindExists(insert, newAccountType, Email.CONTENT_ITEM_TYPE);
- EntityModifier.ensureKindExists(insert, newAccountType, Note.CONTENT_ITEM_TYPE);
EntityModifier.ensureKindExists(insert, newAccountType, Organization.CONTENT_ITEM_TYPE);
EntityModifier.ensureKindExists(insert, newAccountType, Event.CONTENT_ITEM_TYPE);
- EntityModifier.ensureKindExists(insert, newAccountType, Website.CONTENT_ITEM_TYPE);
EntityModifier.ensureKindExists(insert, newAccountType, StructuredPostal.CONTENT_ITEM_TYPE);
if (mState == null) {
diff --git a/src/com/android/contacts/editor/RawContactEditorView.java b/src/com/android/contacts/editor/RawContactEditorView.java
index 881f590..0e8652a 100644
--- a/src/com/android/contacts/editor/RawContactEditorView.java
+++ b/src/com/android/contacts/editor/RawContactEditorView.java
@@ -362,8 +362,13 @@
View child = mFields.getChildAt(i);
if (child instanceof KindSectionView) {
final KindSectionView sectionView = (KindSectionView) child;
- // not a list and already exists? ignore
+ // If the section is already visible (has 1 or more editors), then don't offer the
+ // option to add this type of field in the popup menu
+ if (sectionView.getEditorCount() > 0) {
+ continue;
+ }
DataKind kind = sectionView.getKind();
+ // not a list and already exists? ignore
if (!kind.isList && sectionView.getEditorCount() != 0) {
continue;
}