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

Commit aeae357f authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

Showing phonetic name in the contact header.

Change-Id: I83f608ddf3a01ba6c29687f9e78212800e4ad4b1
parent 147113ee
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
            Contacts.LOOKUP_KEY,
            Contacts.PHOTO_ID,
            Contacts.DISPLAY_NAME,
            Contacts.PHONETIC_NAME,
            Contacts.STARRED,
            Contacts.CONTACT_PRESENCE,
            Contacts.CONTACT_STATUS,
@@ -110,14 +111,15 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
        int LOOKUP_KEY = 1;
        int PHOTO_ID = 2;
        int DISPLAY_NAME = 3;
        int PHONETIC_NAME = 4;
        //TODO: We need to figure out how we're going to get the phonetic name.
        //static final int HEADER_PHONETIC_NAME_COLUMN_INDEX
        int STARRED = 4;
        int CONTACT_PRESENCE_STATUS = 5;
        int CONTACT_STATUS = 6;
        int CONTACT_STATUS_TIMESTAMP = 7;
        int CONTACT_STATUS_RES_PACKAGE = 8;
        int CONTACT_STATUS_LABEL = 9;
        int STARRED = 5;
        int CONTACT_PRESENCE_STATUS = 6;
        int CONTACT_STATUS = 7;
        int CONTACT_STATUS_TIMESTAMP = 8;
        int CONTACT_STATUS_RES_PACKAGE = 9;
        int CONTACT_STATUS_LABEL = 10;
    }

    private interface PhotoQuery {
@@ -321,7 +323,7 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
    }

    /**
     * Turn on/off showing of the aggregate bage element.
     * Turn on/off showing of the aggregate badge element.
     */
    public void showAggregateBadge(boolean showBagde) {
        mAggregateBadge.setVisibility(showBagde ? View.VISIBLE : View.GONE);
@@ -380,8 +382,11 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
     */
    public void setDisplayName(CharSequence displayName, CharSequence phoneticName) {
        mDisplayNameView.setText(displayName);
        if (mPhoneticNameView != null) {
        if (!TextUtils.isEmpty(phoneticName)) {
            mPhoneticNameView.setText(phoneticName);
            mPhoneticNameView.setVisibility(View.VISIBLE);
        } else {
            mPhoneticNameView.setVisibility(View.GONE);
        }
    }

@@ -524,10 +529,9 @@ public class ContactHeaderWidget extends FrameLayout implements View.OnClickList
     * Bind the contact details provided by the given {@link Cursor}.
     */
    protected void bindContactInfo(Cursor c) {
        // TODO: Bring back phonetic name
        final String displayName = c.getString(ContactQuery.DISPLAY_NAME);
        final String phoneticName = null;
        this.setDisplayName(displayName, null);
        final String phoneticName = c.getString(ContactQuery.PHONETIC_NAME);
        this.setDisplayName(displayName, phoneticName);

        final boolean starred = c.getInt(ContactQuery.STARRED) != 0;
        mStarredView.setChecked(starred);
+0 −44
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- In Japanese-language locales, the "Name" field contains two separate
     TextViews: the name itself, and also the phonetic ("furigana") field. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="0dip"
    android:layout_weight="1"
    android:layout_height="match_parent">

    <TextView android:id="@+id/name"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:singleLine="true"
        android:ellipsize="end"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textStyle="bold"
        android:shadowColor="#BB000000"
        android:shadowRadius="2.75"
        />

    <TextView android:id="@+id/phonetic_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:ellipsize="end"
        android:textAppearance="?android:attr/textAppearanceSmall"
        />

</LinearLayout>
+21 −4
Original line number Diff line number Diff line
@@ -50,18 +50,35 @@
                android:src="@drawable/ic_aggregated"
            />

            <!-- "Name" field is locale-specific. -->
            <include layout="@layout/contact_header_name"/>

            <TextView android:id="@+id/name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:singleLine="true"
                android:ellipsize="end"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textStyle="bold"
                android:shadowColor="#BB000000"
                android:shadowRadius="2.75"
                android:layout_marginBottom="-4dip"
                />
        </LinearLayout>

        <TextView android:id="@+id/phonetic_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:singleLine="true"
            android:ellipsize="end"
            android:layout_marginTop="-2dip"
        />

        <TextView android:id="@+id/status"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:singleLine="true"
            android:ellipsize="end"
            android:layout_marginTop="-4dip"
            android:layout_marginTop="-2dip"
        />

        <TextView android:id="@+id/status_date"
+0 −29
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<!-- In the default locale, the "Name" field is a single TextView -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/name"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textStyle="bold"
    android:singleLine="true"
    android:ellipsize="end"
    android:layout_gravity="center_vertical"
    android:shadowColor="#BB000000"
    android:shadowRadius="2.75"
    />