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

Commit ae9c9ec4 authored by Walter Jang's avatar Walter Jang
Browse files

Hide all empty email and phone KindSectionViews expect the last

Bug 22331611

Change-Id: I5c4544ed3cc82982f159f7c1758a1e6cd8868c48
parent 995bb4af
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -744,6 +744,15 @@ public class CompactRawContactsEditorView extends LinearLayout implements View.O
        }
        // Only the last editor should show an empty editor
        if (lastVisibleKindSectionView != null) {
            // Hide all empty kind sections except the last one
            for (int i = 0; i < viewGroup.getChildCount(); i++) {
                final KindSectionView kindSectionView = (KindSectionView) viewGroup.getChildAt(i);
                if (kindSectionView != lastVisibleKindSectionView
                        && kindSectionView.areAllEditorsEmpty()) {
                    kindSectionView.setVisibility(View.GONE);
                }
            }
            // Set the last editor to show empty editor fields
            lastVisibleKindSectionView.setShowOneEmptyEditor(true);
            lastVisibleKindSectionView.updateEmptyEditors(/* shouldAnimate =*/ false);
        }
+10 −0
Original line number Diff line number Diff line
@@ -326,6 +326,16 @@ public class KindSectionView extends LinearLayout implements EditorListener {
        return emptyEditorViews;
    }

    public boolean areAllEditorsEmpty() {
        for (int i = 0; i < mEditors.getChildCount(); i++) {
            final View view = mEditors.getChildAt(i);
            if (!((Editor) view).isEmpty()) {
                return false;
            }
        }
        return true;
    }

    public int getEditorCount() {
        return mEditors.getChildCount();
    }