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

Commit 896cf384 authored by Walter Jang's avatar Walter Jang Committed by Android Git Automerger
Browse files

am 2d549492: am 25f9694f: Fix detection of empty structured names

* commit '2d549492':
  Fix detection of empty structured names
parents 7a1751c0 2d549492
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -212,23 +212,29 @@ public class StructuredNameEditorView extends TextFieldsEditorView {
     */
    public String getDisplayName() {
        final ValuesDelta valuesDelta = getValues();
        if (hasShortAndLongForms() && areOptionalFieldsVisible()) {
            final String displayName = valuesDelta.getDisplayName();
            if (!TextUtils.isEmpty(displayName)) {
                return displayName;
            }
        }
        if (hasShortAndLongForms()) {
            if (areOptionalFieldsVisible()) {
                final Map<String, String> structuredNameMap = valuesToStructuredNameMap(valuesDelta);
                final String displayName = NameConverter.structuredNameToDisplayName(
                        getContext(), structuredNameMap);
                if (!TextUtils.isEmpty(displayName)) {
                    return displayName;
                }
        // The name may have been passed to the compact editor and not written to the underlying
        // data structure.
            } else {
                final String displayName = valuesDelta.getDisplayName();
                if (!TextUtils.isEmpty(displayName)) {
                    return displayName;
                }
            }
        }
        return valuesDelta.getDisplayName();
    }

    @Override
    public boolean isEmpty() {
        return TextUtils.isEmpty(getDisplayName());
    }

    @Override
    protected Parcelable onSaveInstanceState() {
        SavedState state = new SavedState(super.onSaveInstanceState());