Merge "Don't hide types when associated label is empty" into ub-contactsdialer-a-dev
diff --git a/src/com/android/contacts/editor/CompactKindSectionView.java b/src/com/android/contacts/editor/CompactKindSectionView.java
index c902e77..8962de1 100644
--- a/src/com/android/contacts/editor/CompactKindSectionView.java
+++ b/src/com/android/contacts/editor/CompactKindSectionView.java
@@ -417,12 +417,6 @@
         final View view = mLayoutInflater.inflate(
                 EditorUiUtils.getLayoutResourceId(dataKind.mimeType), mEditors, false);
         view.setEnabled(isEnabled());
-
-        // Hide the types drop downs until the associated edit field is focused
-        if (view instanceof LabeledEditorView) {
-            ((LabeledEditorView) view).setHideTypeInitially(true);
-        }
-
         if (view instanceof Editor) {
             final Editor editor = (Editor) view;
             editor.setDeletable(true);
diff --git a/src/com/android/contacts/editor/EditorAnimator.java b/src/com/android/contacts/editor/EditorAnimator.java
index 251357a..2e17e23 100644
--- a/src/com/android/contacts/editor/EditorAnimator.java
+++ b/src/com/android/contacts/editor/EditorAnimator.java
@@ -47,15 +47,7 @@
 
     private AnimatorRunner mRunner = new AnimatorRunner();
 
-    public void hideEditorView(final View victim) {
-        removeEditorView(victim, /* removeVictimFromParent =*/ false);
-    }
-
     public void removeEditorView(final View victim) {
-        removeEditorView(victim, /* removeVictimFromParent =*/ true);
-    }
-
-    private void removeEditorView(final View victim, final boolean removeVictimFromParent) {
         mRunner.endOldAnimation();
         final int offset = victim.getHeight();
 
@@ -79,15 +71,11 @@
                     final View view = viewsToMove.get(i);
                     view.setTranslationY(0.0f);
                 }
-                if (removeVictimFromParent) {
-                    // Remove our target view (if parent is null, we were run several times by quick
-                    // fingers. Just ignore)
-                    final ViewGroup victimParent = (ViewGroup) victim.getParent();
-                    if (victimParent != null) {
-                        victimParent.removeView(victim);
-                    }
-                } else {
-                    victim.setVisibility(View.GONE);
+                // Remove our target view (if parent is null, we were run several times by quick
+                // fingers. Just ignore)
+                final ViewGroup victimParent = (ViewGroup) victim.getParent();
+                if (victimParent != null) {
+                    victimParent.removeView(victim);
                 }
             }
         });
diff --git a/src/com/android/contacts/editor/EventFieldEditorView.java b/src/com/android/contacts/editor/EventFieldEditorView.java
index b8ded06..059208e 100644
--- a/src/com/android/contacts/editor/EventFieldEditorView.java
+++ b/src/com/android/contacts/editor/EventFieldEditorView.java
@@ -84,9 +84,6 @@
         mDateView.setOnClickListener(new OnClickListener() {
             @Override
             public void onClick(View v) {
-                if (!isTypeVisible()) {
-                    showType();
-                }
                 showDialog(R.id.dialog_event_date_picker);
             }
         });
@@ -134,9 +131,6 @@
             mDateView.setText(data);
             mDateView.setTextColor(mPrimaryTextColor);
             setDeleteButtonVisible(true);
-            if (!isTypeVisible()) {
-                showType();
-            }
         }
     }
 
diff --git a/src/com/android/contacts/editor/KindSectionView.java b/src/com/android/contacts/editor/KindSectionView.java
index 23b0c21..ee11645 100644
--- a/src/com/android/contacts/editor/KindSectionView.java
+++ b/src/com/android/contacts/editor/KindSectionView.java
@@ -194,13 +194,7 @@
                     layoutResId + " for MIME type " + mKind.mimeType +
                     " with error " + e.toString());
         }
-        // Hide the types drop downs until the associated edit field is focused
-        if (view instanceof LabeledEditorView) {
-            ((LabeledEditorView) view).setHideTypeInitially(true);
-        }
-
         view.setEnabled(isEnabled());
-
         if (view instanceof Editor) {
             Editor editor = (Editor) view;
             editor.setDeletable(true);
diff --git a/src/com/android/contacts/editor/LabeledEditorView.java b/src/com/android/contacts/editor/LabeledEditorView.java
index b68310a..d09fb89 100644
--- a/src/com/android/contacts/editor/LabeledEditorView.java
+++ b/src/com/android/contacts/editor/LabeledEditorView.java
@@ -79,8 +79,6 @@
     private boolean mWasEmpty = true;
     private boolean mIsDeletable = true;
     private boolean mIsAttachedToWindow;
-    private boolean mHideTypeInitially;
-    private boolean mHasTypes;
 
     private EditType mType;
 
@@ -239,39 +237,6 @@
         }
     }
 
-    /**
-     * Whether to hide the type dropdown after values have been set.
-     * By default the drop down is always displayed if there are types to display.
-     */
-    public void setHideTypeInitially(boolean hideTypeInitially) {
-        mHideTypeInitially = hideTypeInitially;
-    }
-
-    /**
-     * Whether the type drop down is visible.
-     */
-    public boolean isTypeVisible() {
-        return mLabel == null ? false : mLabel.getVisibility() == View.VISIBLE;
-    }
-
-    /**
-     * Makes the type drop down visible if it is not already so, and there are types to display.
-     */
-    public void showType() {
-        if (mHasTypes && mLabel != null && mLabel.getVisibility() != View.VISIBLE) {
-            EditorAnimator.getInstance().slideAndFadeIn(mLabel, mLabel.getHeight());
-        }
-    }
-
-    /**
-     * Hides the type drop down if there are types to display and it is not already hidden.
-     */
-    public void hideType() {
-        if (mHasTypes && mLabel != null && mLabel.getVisibility() != View.GONE) {
-            EditorAnimator.getInstance().hideEditorView(mLabel);
-        }
-    }
-
     protected void onOptionalFieldVisibilityChange() {
         if (mListener != null) {
             mListener.onRequest(EditorListener.EDITOR_FORM_CHANGED);
@@ -422,15 +387,12 @@
         setVisibility(View.VISIBLE);
 
         // Display label selector if multiple types available
-        mHasTypes = RawContactModifier.hasEditTypes(kind);
-        setupLabelButton(mHasTypes);
+        final boolean hasTypes = RawContactModifier.hasEditTypes(kind);
+        setupLabelButton(hasTypes);
         mLabel.setEnabled(!readOnly && isEnabled());
-        if (mHasTypes) {
+        if (hasTypes) {
             mType = RawContactModifier.getCurrentType(entry, kind);
             rebuildLabel();
-            if (mHideTypeInitially) {
-                mLabel.setVisibility(View.GONE);
-            }
         }
     }
 
diff --git a/src/com/android/contacts/editor/TextFieldsEditorView.java b/src/com/android/contacts/editor/TextFieldsEditorView.java
index 51c9d94..d82b019 100644
--- a/src/com/android/contacts/editor/TextFieldsEditorView.java
+++ b/src/com/android/contacts/editor/TextFieldsEditorView.java
@@ -152,16 +152,6 @@
             if (getEditorListener() != null) {
                 getEditorListener().onRequest(EditorListener.EDITOR_FOCUS_CHANGED);
             }
-            // Check whether this field contains focus by calling findFocus() instead of
-            // hasFocus(). The hasFocus() value is not necessarily up to date.
-            final boolean foundFocus = TextFieldsEditorView.this.findFocus() != null;
-            if (foundFocus && !isTypeVisible()) {
-                // We just got focus and the types are not visible
-                showType();
-            } else if (isEmpty()) {
-                // We just lost focus and the field is empty
-                hideType();
-            }
             // Rebuild the label spinner using the new colors.
             rebuildLabel();
         }
@@ -255,11 +245,6 @@
             final String value = entry.getAsString(column);
             fieldView.setText(value);
 
-            // Show the type drop down if we have a non-empty value.
-            if (!isTypeVisible() && !TextUtils.isEmpty(value)) {
-                showType();
-            }
-
             // Show the delete button if we have a non-null value
             setDeleteButtonVisible(value != null);