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

Commit 95130ade authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Hide phonetic name view when phonetic name data kind is not present

Bug: 31547816

Test: manual
  - follow steps to repro in bug
  - also rotate screen

Change-Id: Ic7e04268e426bf1e58d8c4fa9df40fca52ed7a15
parent a3c507a2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -380,8 +380,10 @@ public abstract class LabeledEditorView extends LinearLayout implements Editor,
    }

    protected void rebuildValues() {
        if (mKind != null) {
            setValues(mKind, mEntry, mState, mReadOnly, mViewIdGenerator);
        }
    }

    /**
     * Prepare this editor using the given {@link DataKind} for defining structure and
+7 −4
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.contacts.common.model.account.AccountDisplayInfo;
@@ -247,9 +246,13 @@ public class RawContactEditorView extends BaseRawContactEditorView {
                mName.setValues(
                        type.getKindForMimetype(DataKind.PSEUDO_MIME_TYPE_DISPLAY_NAME),
                        primary, state, false, vig);
                mPhoneticName.setValues(
                        type.getKindForMimetype(DataKind.PSEUDO_MIME_TYPE_PHONETIC_NAME),
                        primary, state, false, vig);
                final DataKind phoneticNameKind =
                        type.getKindForMimetype(DataKind.PSEUDO_MIME_TYPE_PHONETIC_NAME);
                if (phoneticNameKind != null) {
                    mPhoneticName.setValues(phoneticNameKind, primary, state, false, vig);
                } else {
                    mPhoneticName.setVisibility(View.GONE);
                }
                // It is useful to use Nickname outside of a KindSectionView so that we can treat it
                // as a part of StructuredName's fake KindSectionView, even though it uses a
                // different CP2 mime-type. We do a bit of extra work below to make this possible.