diff options
author | Danny Baumann <dannybaumann@web.de> | 2015-10-27 10:30:48 +0100 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2015-10-27 10:30:48 +0100 |
commit | 6b4976dca53312f4f0306250f1ddc2276d2166bf (patch) | |
tree | e50dd2dd595ee20684bf8df800deaa1e4530ab12 | |
parent | ab1e2accef66a3090a34a4bcf2327e3ec5609460 (diff) | |
download | packages_apps_Contacts-6b4976dca53312f4f0306250f1ddc2276d2166bf.tar.gz packages_apps_Contacts-6b4976dca53312f4f0306250f1ddc2276d2166bf.tar.bz2 packages_apps_Contacts-6b4976dca53312f4f0306250f1ddc2276d2166bf.zip |
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
-rw-r--r-- | src/com/android/contacts/editor/KindSectionView.java | 18 |
1 files 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<View> 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. |