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

Commit 35a61837 authored by Walter Jang's avatar Walter Jang Committed by Android Git Automerger
Browse files

am 4ee224b7: Merge "Hide all empty email and phone KindSectionViews expect the last" into mnc-dev

* commit '4ee224b7':
  Hide all empty email and phone KindSectionViews expect the last
parents 5c2437c1 4ee224b7
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();
    }