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

Commit 82b29371 authored by Tingting Wang's avatar Tingting Wang Committed by Android (Google) Code Review
Browse files

Merge "Fix bug when adding an empty editor type in Editor UI." into ub-contactsdialer-b-dev

parents 49eedc81 6d8c6294
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -542,10 +542,11 @@ public class CompactKindSectionView extends LinearLayout {
        }
        // Determine if we should add a new empty editor
        final DataKind dataKind = mKindSectionDataList.get(0).getDataKind();
        final RawContactDelta rawContactDelta =
                mKindSectionDataList.get(0).getRawContactDelta();
        if (dataKind == null // There is nothing we can do.
                // We have already reached the maximum number of editors, don't add any more.
                || (dataKind.typeOverallMax == mEditors.getChildCount()
                        && dataKind.typeOverallMax != 0)
                || !RawContactModifier.canInsert(rawContactDelta, dataKind)
                // We have already reached the maximum number of empty editors, don't add any more.
                || emptyEditors.size() == 1) {
            return;
@@ -556,8 +557,6 @@ public class CompactKindSectionView extends LinearLayout {
            if (Nickname.CONTENT_ITEM_TYPE.equals(mimeType) && mEditors.getChildCount() > 0) {
                return;
            }
            final RawContactDelta rawContactDelta =
                    mKindSectionDataList.get(0).getRawContactDelta();
            final ValuesDelta values = RawContactModifier.insertChild(rawContactDelta, dataKind);
            final Editor.EditorListener editorListener = Event.CONTENT_ITEM_TYPE.equals(mimeType)
                    ? new EventEditorListener() : new NonNameEditorListener();
+1 −1
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ public class KindSectionView extends LinearLayout implements EditorListener {
        } else if (isReadOnly()) {
            // We don't show empty editors for read only data kinds.
            return;
        } else if (mKind.typeOverallMax == getEditorCount() && mKind.typeOverallMax != 0) {
        } else if (!RawContactModifier.canInsert(mState, mKind)) {
            // We have already reached the maximum number of editors. Lets not add any more.
            return;
        } else if (emptyEditors.size() == 1) {