Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7351d7df authored by Danny Baumann's avatar Danny Baumann
Browse files

Fix empty field creation for data kinds without type.

When checking for exhaustion of available kind types (introduced by
commit 6c3c5890), make sure to do that
check only for data kinds that actually have a type attached.

RM-165
Change-Id: I7fb69faaf46802faae8ac4e90633627e04d5ee22
(cherry picked from commit 6b4976dc)
parent d5060806
Loading
Loading
Loading
Loading
+8 −10
Original line number Diff line number Diff line
@@ -223,17 +223,15 @@ 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 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.
        if (emptyEditors.size() > 1) {