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

Commit 791082e2 authored by Yorke Lee's avatar Yorke Lee
Browse files

Add number type label to favorites list

Bug: 10888792
Change-Id: I60ab15389c01cdb5cebc72ede15cced93dca50ef
parent d73ea85a
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -53,6 +53,21 @@
            android:ellipsize="marquee"
            android:textAlignment="viewStart" />

        <TextView
            android:id="@+id/contact_tile_phone_type"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_below="@id/contact_tile_name"
            android:layout_toRightOf="@id/contact_tile_quick"
            android:layout_toEndOf="@id/contact_tile_quick"
            android:textSize="12sp"
            android:ellipsize="marquee"
            android:singleLine="true"
            android:textColor="@color/dialtacts_secondary_text_color"
            android:layout_marginLeft="8dip"
            android:layout_marginStart="8dip"
            android:layout_gravity="bottom" />

    </RelativeLayout>

    <LinearLayout
+0 −4
Original line number Diff line number Diff line
@@ -18,15 +18,11 @@ package com.android.dialer.list;
import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.View;

import com.android.contacts.common.util.ViewUtil;
import com.android.dialer.R;

import com.android.dialer.list.PhoneFavoritesTileAdapter.ContactTileRow;


public class PhoneFavoriteRegularRowView extends PhoneFavoriteTileView {
    private static final String TAG = PhoneFavoriteRegularRowView.class.getSimpleName();
    private static final boolean DEBUG = false;
+12 −27
Original line number Diff line number Diff line
@@ -106,16 +106,11 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
    protected int mPresenceIndex;
    protected int mStatusIndex;

    /**
     * Only valid when {@link DisplayType#STREQUENT_PHONE_ONLY} is true
     *
     * TODO krelease: Remove entirely if not needed
     */
    private int mPhoneNumberIndex;
    private int mPhoneNumberTypeIndex;
    private int mPhoneNumberLabelIndex;
    protected int mPinnedIndex;
    protected int mContactIdForFrequentIndex;
    protected int mContactIdIndex;

    private final int mPaddingInPixels;

@@ -209,7 +204,7 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
        mPhoneNumberTypeIndex = ContactTileLoaderFactory.PHONE_NUMBER_TYPE;
        mPhoneNumberLabelIndex = ContactTileLoaderFactory.PHONE_NUMBER_LABEL;
        mPinnedIndex = ContactTileLoaderFactory.PINNED;
        mContactIdForFrequentIndex = ContactTileLoaderFactory.CONTACT_ID_FOR_FREQUENT;
        mContactIdIndex = ContactTileLoaderFactory.CONTACT_ID_FOR_DATA;
    }

    /**
@@ -274,14 +269,12 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
            final int starred = cursor.getInt(mStarredIndex);
            final long id;

            if (starred > 0) {
                id = cursor.getLong(mIdIndex);
            } else if (counter >= TILES_SOFT_LIMIT) {
            // We display a maximum of TILES_SOFT_LIMIT contacts, or the total number of starred
            // whichever is greater.
            if (starred < 1 && counter >= TILES_SOFT_LIMIT) {
                break;
            } else {
                // The contact id for frequent contacts is stored in the .contact_id field rather
                // than the _id field
                id = cursor.getLong(mContactIdForFrequentIndex);
                id = cursor.getLong(mContactIdIndex);
            }

            if (duplicates.get(id) == null) {
@@ -305,20 +298,12 @@ public class PhoneFavoritesTileAdapter extends BaseAdapter implements
                    Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, lookupKey), id);


            // TODO krelease: These columns are temporarily unused for now so that
            // the contact tiles will be treated like favorites since they don't have a phone
            // number. Depending on how the final UX goes we will either remove or enable
            // them again.

            /*
            // Set phone number, label and status
            final int phoneNumberType = cursor.getInt(mPhoneNumberTypeIndex);
            final String phoneNumberCustomLabel = cursor.getString(mPhoneNumberLabelIndex);
            contact.phoneLabel = (String) Phone.getTypeLabel(mResources, phoneNumberType,
                    phoneNumberCustomLabel);
            contact.phoneNumber = cursor.getString(mPhoneNumberIndex);
                contact.status = cursor.getString(mStatusIndex);
            */

            contact.pinned = pinned;
            mContactEntries.add(contact);