From 6b4976dca53312f4f0306250f1ddc2276d2166bf Mon Sep 17 00:00:00 2001 From: Danny Baumann Date: Tue, 27 Oct 2015 10:30:48 +0100 Subject: Fix empty field creation for data kinds without type. When checking for exhaustion of available kind types (introduced by commit 6c3c58900bccea7a96b1435e0e0466a6b99dab36), make sure to do that check only for data kinds that actually have a type attached. Change-Id: I7fb69faaf46802faae8ac4e90633627e04d5ee22 --- src/com/android/contacts/editor/KindSectionView.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/com/android/contacts/editor/KindSectionView.java b/src/com/android/contacts/editor/KindSectionView.java index 002b18746..98a47d15b 100644 --- a/src/com/android/contacts/editor/KindSectionView.java +++ b/src/com/android/contacts/editor/KindSectionView.java @@ -223,16 +223,14 @@ public class KindSectionView extends LinearLayout implements EditorListener { final List emptyEditors = getEmptyEditors(); - // Check for primary best type - AccountType.EditType bestType = RawContactModifier.getBestValidType(mState, mKind, false, - Integer.MIN_VALUE); - if (bestType == null) { - // Fall back to seconday best type - bestType = RawContactModifier.getBestValidType(mState, mKind, true, Integer.MIN_VALUE); - } - // If no type then we don't need an empty for it - if (bestType == null) { - return; + // If a type is attached to our kind, see whether there are more types we can add + if (mKind != null && mKind.typeColumn != null) { + AccountType.EditType bestType = RawContactModifier.getBestValidType(mState, + mKind, true, Integer.MIN_VALUE); + if (bestType == null) { + // No more types to add + return; + } } // If there is more than 1 empty editor, then remove it from the list of editors. -- cgit v1.2.3